Mercurial > public > ostc4
annotate Discovery/Src/t3.c @ 860:3e499569baf3 Evo_2_23
Code cleanup
author | Ideenmodellierer |
---|---|
date | Tue, 07 May 2024 21:20:56 +0200 |
parents | ba1aebc6d5af |
children | db92692c014f |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/t3.c | |
5 /// \brief Main Template file for dive mode special scree t3 | |
6 /// \author Heinrichs Weikamp gmbh | |
7 /// \date 10-Nov-2014 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
30 #include <stdbool.h> |
841 | 31 #include <stdlib.h> |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
32 |
38 | 33 #include "t3.h" |
34 | |
35 #include "data_exchange_main.h" | |
36 #include "decom.h" | |
37 #include "gfx_fonts.h" | |
38 #include "math.h" | |
39 #include "tHome.h" | |
40 #include "timer.h" | |
41 #include "unit.h" | |
553 | 42 #include "motion.h" |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
43 #include "logbook_miniLive.h" |
835 | 44 #include "tMenuEditCustom.h" |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
45 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
46 |
599 | 47 #define CV_PROFILE_WIDTH (600U) |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
48 |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
49 //* Imported function prototypes ---------------------------------------------*/ |
38 | 50 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); |
51 | |
52 /* Exported variables --------------------------------------------------------*/ | |
53 | |
54 const uint16_t BigFontSeperationLeftRight = 399; | |
55 const uint16_t BigFontSeperationTopBottom = 240; | |
56 | |
57 /* Private variables ---------------------------------------------------------*/ | |
58 GFX_DrawCfgScreen t3screen; | |
59 GFX_DrawCfgWindow t3l1; | |
60 GFX_DrawCfgWindow t3r1; | |
61 GFX_DrawCfgWindow t3c1; | |
62 GFX_DrawCfgWindow t3c2; | |
63 | |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
64 uint8_t t3_selection_customview = CVIEW_noneOrDebug; |
38 | 65 |
841 | 66 static uint8_t AF_lastDecoDepth = 0; |
67 static uint16_t AF_lastTTS = 0; | |
68 | |
69 | |
38 | 70 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/ |
71 | |
72 /* Private types -------------------------------------------------------------*/ | |
73 #define TEXTSIZE 16 | |
74 | |
841 | 75 /* defines for autofocus of compass */ |
76 #define AF_COMPASS_ACTIVATION_ANGLE (10.0f) /* angle for pitch and roll. Compass gets activated in case the value is smaller (OSTC4 hold in horitontal position */ | |
77 #define AF_COMPASS_DEBOUNCE (10u) /* debouncing value to avoid compass activation during normal movement */ | |
78 | |
79 | |
38 | 80 /* Private function prototypes -----------------------------------------------*/ |
81 void t3_refresh_divemode(void); | |
82 | |
83 uint8_t t3_test_customview_warnings(void); | |
84 void t3_refresh_customview(float depth); | |
496 | 85 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading); |
841 | 86 uint8_t t3_EvaluateAFCondition(uint8_t T3CView); |
38 | 87 |
88 /* Exported functions --------------------------------------------------------*/ | |
89 | |
90 void t3_init(void) | |
91 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
92 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
93 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
94 |
837 | 95 t3_selection_customview = cv_changelist_BS[0]; |
38 | 96 |
97 t3screen.FBStartAdress = 0; | |
98 t3screen.ImageHeight = 480; | |
99 t3screen.ImageWidth = 800; | |
100 t3screen.LayerIndex = 1; | |
101 | |
102 t3l1.Image = &t3screen; | |
103 t3l1.WindowNumberOfTextLines = 2; | |
104 t3l1.WindowLineSpacing = 19; // Abstand von Y0 | |
105 t3l1.WindowTab = 100; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
106 |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
107 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
108 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
109 t3l1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
110 t3l1.WindowX1 = BigFontSeperationLeftRight - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
111 t3l1.WindowY0 = BigFontSeperationTopBottom + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
112 t3l1.WindowY1 = 479; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
113 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
114 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
115 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
116 t3l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
117 t3l1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
118 t3l1.WindowY0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
119 t3l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
120 } |
38 | 121 |
122 t3r1.Image = &t3screen; | |
123 t3r1.WindowNumberOfTextLines = t3l1.WindowNumberOfTextLines; | |
124 t3r1.WindowLineSpacing = t3l1.WindowLineSpacing; | |
125 t3r1.WindowTab = t3l1.WindowTab; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
126 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
127 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
128 t3r1.WindowX0 = BigFontSeperationLeftRight + 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
129 t3r1.WindowX1 = 799; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
130 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
131 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
132 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
133 t3r1.WindowX0 = 0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
134 t3r1.WindowX1 = BigFontSeperationLeftRight - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
135 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
136 |
38 | 137 t3r1.WindowY0 = t3l1.WindowY0; |
138 t3r1.WindowY1 = t3l1.WindowY1; | |
139 | |
518 | 140 /* t3c1 is across the complete lower part of the display */ |
38 | 141 t3c1.Image = &t3screen; |
142 t3c1.WindowNumberOfTextLines = 2; | |
518 | 143 t3c1.WindowLineSpacing = 84 + 5; /* double font + spacing */ |
38 | 144 t3c1.WindowX0 = 0; |
145 t3c1.WindowX1 = 799; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
146 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
147 { |
511 | 148 t3c1.WindowY0 = 5; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
149 t3c1.WindowY1 = BigFontSeperationTopBottom - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
150 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
151 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
152 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
153 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5; |
511 | 154 t3c1.WindowY1 = 479 - 5; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
155 } |
38 | 156 |
518 | 157 /* t3c2 is just showing the lower right part of the display */ |
38 | 158 t3c2.Image = &t3screen; |
159 t3c2.WindowNumberOfTextLines = 3; | |
511 | 160 t3c2.WindowLineSpacing = t3c1.WindowLineSpacing ; |
38 | 161 t3c2.WindowX0 = 370; |
162 t3c2.WindowX1 = 799; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
163 t3c2.WindowY0 = t3c1.WindowY0; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
164 t3c2.WindowY1 = t3c1.WindowY1; |
38 | 165 t3c2.WindowTab = 600; |
841 | 166 |
167 t3_EvaluateAFCondition(CVIEW_T3_END); /* reset debounce counters */ | |
38 | 168 } |
169 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
170 void t3_select_customview(uint8_t selectedCustomview) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
171 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
172 if(selectedCustomview < CVIEW_T3_END) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
173 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
174 t3_selection_customview = selectedCustomview; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
175 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
176 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
177 |
610 | 178 void t3_drawMarker(GFX_DrawCfgScreen *hgfx, const SWindowGimpStyle *window, uint8_t *data, uint16_t datalength, uint8_t color) |
179 { | |
180 uint16_t line = 0; | |
181 uint16_t dataIndex = 0; | |
182 uint16_t lastDataIndex = 0; | |
183 uint16_t windowWidth = 0; | |
184 int16_t factor = 0; | |
185 uint8_t setMarker = 0; | |
186 | |
187 point_t start; | |
188 point_t stop; | |
189 | |
190 | |
191 if( (window->bottom <= 479) | |
192 && (window->top <= 479) | |
193 && (window->right <= 799) | |
194 && (window->left <= 799) | |
195 && (window->right >= 0) | |
196 && (window->left >= 0) | |
197 && (window->bottom > window->top) | |
198 && (window->right > window->left)) | |
199 { | |
200 windowWidth = window->right - window->left; | |
201 | |
624
930f1bbe0ac2
Development bugfix: Marker in standard t3 view drawn in wrong direction
Ideenmodellierer
parents:
622
diff
changeset
|
202 start.y = 479 - BigFontSeperationTopBottom - 5; |
930f1bbe0ac2
Development bugfix: Marker in standard t3 view drawn in wrong direction
Ideenmodellierer
parents:
622
diff
changeset
|
203 stop.y =5; |
930f1bbe0ac2
Development bugfix: Marker in standard t3 view drawn in wrong direction
Ideenmodellierer
parents:
622
diff
changeset
|
204 |
610 | 205 while((line <= windowWidth) && (dataIndex < datalength)) |
206 { | |
207 factor = (10 * line * (long)datalength)/windowWidth; | |
208 dataIndex = factor/10; | |
209 /* check if a marker is set in the intervall which is bypassed because of data reduction */ | |
210 setMarker = 0; | |
211 while(lastDataIndex <= dataIndex) | |
212 { | |
213 lastDataIndex++; | |
214 if(data[lastDataIndex] != 0) | |
215 { | |
216 setMarker = 1; | |
217 break; | |
218 } | |
219 } | |
220 lastDataIndex = dataIndex; | |
221 int rest = factor - dataIndex*10; | |
222 if(rest >= 5) | |
223 dataIndex++; | |
224 | |
225 if((datalength - 1) < dataIndex) | |
226 dataIndex = datalength-1; | |
227 | |
228 if((line > 0) && (setMarker)) /* draw marker line */ | |
229 { | |
230 start.x = line; | |
231 stop.x = line; | |
232 GFX_draw_line(hgfx, start, stop, color); | |
233 } | |
234 line++; | |
235 dataIndex++; | |
236 } | |
237 } | |
238 } | |
239 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
240 void t3_miniLiveLogProfile(void) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
241 { |
641
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
242 static uint8_t wasDecoDive = 0; |
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
243 |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
244 SWindowGimpStyle wintemp; |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
245 uint16_t replayDataLength = 0; |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
246 uint16_t liveDataLength = 0; |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
247 uint16_t drawDataLength = 0; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
248 uint16_t* pReplayData; |
610 | 249 uint8_t* pReplayMarker; |
599 | 250 uint16_t max_depth = 10; |
251 char text[TEXTSIZE]; | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
252 point_t start, stop; |
599 | 253 uint16_t diveMinutes = 0; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
254 |
622 | 255 SSettings* pSettings; |
256 pSettings = settingsGetPointer(); | |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
257 |
622 | 258 wintemp.top = 479 - BigFontSeperationTopBottom + 5; |
599 | 259 wintemp.bottom = 479 - 5; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
260 |
622 | 261 if(!pSettings->FlipDisplay) |
262 { | |
263 wintemp.left = t3c1.WindowX0; | |
264 wintemp.right = t3c1.WindowX0 + CV_PROFILE_WIDTH; | |
265 } | |
266 else | |
267 { | |
268 wintemp.left = t3c1.WindowX1 - CV_PROFILE_WIDTH;; | |
269 wintemp.right = t3c1.WindowX1; | |
270 } | |
271 | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
272 start.x = CV_PROFILE_WIDTH + 2; |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
273 stop.x = start.x; |
622 | 274 start.y = 479 - BigFontSeperationTopBottom - 5; |
275 stop.y =5; | |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
276 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
277 GFX_draw_line(&t3screen, start, stop, CLUT_Font020); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
278 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
279 if(getReplayOffset() != 0xFFFF) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
280 { |
610 | 281 getReplayInfo(&pReplayData, &pReplayMarker, &replayDataLength, &max_depth, &diveMinutes); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
282 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
283 |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
284 if(max_depth < (uint16_t)(stateUsed->lifeData.max_depth_meter * 100)) |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
285 { |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
286 max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 100); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
287 } |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
288 |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
289 liveDataLength = getMiniLiveReplayLength(); |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
290 |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
291 if(replayDataLength > liveDataLength) |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
292 { |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
293 drawDataLength = replayDataLength; |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
294 } |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
295 else |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
296 { |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
297 drawDataLength = liveDataLength; |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
298 } |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
299 |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
300 if(drawDataLength < CV_PROFILE_WIDTH) |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
301 { |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
302 drawDataLength = CV_PROFILE_WIDTH; |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
303 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
304 |
599 | 305 if(diveMinutes != 0) |
306 { | |
307 snprintf(text,TEXTSIZE,"\002%dmin",diveMinutes); | |
308 GFX_write_string(&FontT42,&t3c1,text,1); | |
309 } | |
310 | |
311 snprintf(text,TEXTSIZE,"\002%01.1fm", max_depth / 100.0); | |
312 GFX_write_string(&FontT42,&t3c1,text,0); | |
313 | |
641
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
314 if(getMiniLiveReplayLength() < 10) /* new dive startet => reset the visualization state for deco data */ |
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
315 { |
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
316 wasDecoDive = 0; |
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
317 } |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
318 |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
758
diff
changeset
|
319 const SDecoinfo * pDecoinfo = getDecoInfo(); |
641
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
320 if((pDecoinfo->output_time_to_surface_seconds) || (wasDecoDive)) /* draw deco data first => will be overlayed by all other informations */ |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
321 { |
641
ed5422ac4ffb
Development Bugfix Deco bars not shown after last deco stop passed:
Ideenmodellierer
parents:
633
diff
changeset
|
322 wasDecoDive = 1; |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
323 GFX_graph_print(&t3screen,&wintemp,wintemp.top * -1,1,0,max_depth, getMiniLiveDecoPointerToData(),drawDataLength, CLUT_NiceGreen, NULL); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
324 } |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
325 |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
326 if(replayDataLength != 0) |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
327 { |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
328 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, pReplayData, drawDataLength, CLUT_Font031, NULL); |
610 | 329 if(pReplayMarker[0] != 0xFF) |
330 { | |
331 t3_drawMarker(&t3screen, &wintemp, pReplayMarker, drawDataLength, CLUT_CompassUserHeadingTick); | |
332 } | |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
333 } |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
334 |
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
335 if(liveDataLength > 3) |
599 | 336 { |
602
2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents:
601
diff
changeset
|
337 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, getMiniLiveReplayPointerToData(), drawDataLength, CLUT_Font030, NULL); |
599 | 338 } |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
339 } |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
340 |
38 | 341 |
342 void t3_refresh(void) | |
343 { | |
496 | 344 static uint8_t last_mode = MODE_SURFACE; |
345 | |
38 | 346 SStateList status; |
347 get_globalStateList(&status); | |
348 | |
349 if(stateUsed->mode != MODE_DIVE) | |
350 { | |
351 settingsGetPointer()->design = 7; | |
352 return; | |
353 } | |
354 | |
355 if(status.base != BaseHome) | |
356 return; | |
357 | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
358 if(last_mode != MODE_DIVE) /* Select custom view */ |
496 | 359 { |
360 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
361 { | |
362 t3_selection_customview = CVIEW_noneOrDebug; | |
363 } | |
364 else | |
365 { | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
366 t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF; |
496 | 367 } |
368 t3_change_customview(ACTION_END); | |
369 } | |
38 | 370 t3screen.FBStartAdress = getFrame(24); |
371 t3_refresh_divemode(); | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
372 GFX_SetFramesTopBottom(t3screen.FBStartAdress, 0,480); |
38 | 373 releaseAllFramesExcept(24,t3screen.FBStartAdress); |
496 | 374 last_mode = stateUsed->mode; |
38 | 375 } |
376 | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
377 void t3_set_customview_to_primary(void) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
378 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
379 if(stateUsed->mode == MODE_DIVE) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
380 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
381 t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF; |
599 | 382 t3_change_customview(ACTION_END); |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
383 } |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
384 } |
38 | 385 |
386 /* Private functions ---------------------------------------------------------*/ | |
387 | |
388 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
389 { | |
518 | 390 char text[256]; |
391 uint8_t textPointer; | |
38 | 392 uint8_t color; |
393 uint8_t depthChangeRate; | |
394 uint8_t depthChangeAscent; | |
395 point_t start, stop, startZeroLine; | |
518 | 396 SDivetime Divetime = {0,0,0,0}; |
38 | 397 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
398 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
399 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
400 |
38 | 401 start.x = 0; |
402 stop.x = 799; | |
403 stop.y = start.y = BigFontSeperationTopBottom; | |
642
c737cf5d9067
Do not show focus indicator in case motion detection is suspended:
Ideenmodellierer
parents:
641
diff
changeset
|
404 if((viewInFocus()) && (!viewDetectionSuspended())) |
553 | 405 { |
406 GFX_draw_line(tXscreen, start, stop, CLUT_Font023); | |
407 } | |
408 else | |
409 { | |
410 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
411 } | |
412 | |
38 | 413 |
414 start.y = BigFontSeperationTopBottom; | |
415 stop.y = 479; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
416 |
38 | 417 stop.x = start.x = BigFontSeperationLeftRight; |
642
c737cf5d9067
Do not show focus indicator in case motion detection is suspended:
Ideenmodellierer
parents:
641
diff
changeset
|
418 if((viewInFocus() && (!viewDetectionSuspended()))) |
553 | 419 { |
420 GFX_draw_line(tXscreen, start, stop, CLUT_Font023); | |
421 } | |
422 else | |
423 { | |
424 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
425 } | |
38 | 426 |
427 /* depth */ | |
174
ecb71521d004
Bugfix: make max depth move with current depth (part 2)
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
428 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
38 | 429 |
430 if(depth <= 0.3f) | |
431 depth = 0; | |
432 | |
433 if(settingsGetPointer()->nonMetricalSystem) | |
434 snprintf(text,TEXTSIZE,"\032\f[feet]"); | |
435 else | |
436 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Depth); | |
437 GFX_write_string(&FontT42,tXl1,text,0); | |
438 | |
439 if( ((mode == DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4 ))) | |
440 || ((mode != DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10))) | |
441 ) | |
442 { | |
443 snprintf(text,TEXTSIZE,"\f\002%.0f %c%c/min " | |
444 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
445 , unit_depth_char1() | |
446 , unit_depth_char2() | |
447 ); | |
448 GFX_write_string(&FontT42,tXl1,text,0); | |
449 } | |
450 | |
451 if( depth < 100) | |
452 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",depth); | |
453 else | |
454 snprintf(text,TEXTSIZE,"\020\003\016%01.0f",depth); | |
455 | |
456 t3_basics_colorscheme_mod(text); | |
457 GFX_write_string(&FontT105,tXl1,text,1); | |
458 | |
459 | |
460 /* ascentrate graph */ | |
461 if(mode == DIVEMODE_Apnea) | |
462 { | |
463 /* ascentrate graph - apnea mode */ | |
464 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
465 { | |
466 depthChangeAscent = 1; | |
467 if(stateUsed->lifeData.ascent_rate_meter_per_min < 200) | |
468 depthChangeRate = (uint8_t)stateUsed->lifeData.ascent_rate_meter_per_min; | |
469 else | |
470 depthChangeRate = 200; | |
471 } | |
472 else | |
473 { | |
474 depthChangeAscent = 0; | |
475 if(stateUsed->lifeData.ascent_rate_meter_per_min > -200) | |
476 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min); | |
477 else | |
478 depthChangeRate = 200; | |
479 } | |
413 | 480 |
481 if(!pSettings->FlipDisplay) | |
482 { | |
483 start.y = tXl1->WindowY0 - 1; | |
484 } | |
485 else | |
486 { | |
487 start.y = tXl1->WindowY1 + 1; | |
488 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
489 startZeroLine.y = start.y; |
38 | 490 for(int i = 0; i<5;i++) |
491 { | |
492 start.y += 40; | |
493 stop.y = start.y; | |
413 | 494 if(!pSettings->FlipDisplay) |
495 { | |
496 start.x = tXl1->WindowX1 - 1; | |
497 } | |
498 else | |
499 { | |
500 start.x = tXr1->WindowX1 - 1; | |
501 } | |
38 | 502 stop.x = start.x - 17; |
503 | |
504 if(depthChangeRate <= 6) | |
505 { | |
506 if(i == 2) | |
507 { | |
508 startZeroLine.y = start.y; | |
509 stop.x = start.x - 34; | |
510 } | |
511 } | |
512 else | |
513 { | |
514 if(((i == 1) && depthChangeAscent) || ((i == 3) && !depthChangeAscent)) | |
515 { | |
516 startZeroLine.y = start.y; | |
517 stop.x = start.x - 34; | |
518 } | |
519 } | |
520 GFX_draw_line(tXscreen, start, stop, 0); | |
521 } | |
522 // new thick bar design Sept. 2015 | |
523 if((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4)) | |
524 { | |
525 start.y = startZeroLine.y; | |
526 if(depthChangeAscent) | |
527 { | |
528 color = CLUT_EverythingOkayGreen; | |
529 start.y += 7; // starte etwas weiter oben | |
530 stop.y = start.y + (uint16_t)(depthChangeRate * 4) - 9; // - x; // wegen der Liniendicke | |
531 if(stop.y > 475) | |
532 stop.y = 475; | |
533 } | |
534 else | |
535 { | |
536 color = CLUT_Font023; | |
537 start.y -= 7; | |
538 stop.y = start.y - (uint16_t)(depthChangeRate * 4) + 9; | |
539 if(stop.y <= tXl1->WindowY0) | |
540 stop.y = tXl1->WindowY0 + 1; | |
541 } | |
413 | 542 if(!pSettings->FlipDisplay) |
543 { | |
544 start.x = tXl1->WindowX1 - 3 - 5; | |
545 } | |
546 else | |
547 { | |
548 start.x = tXr1->WindowX1 - 3 - 5; | |
549 } | |
550 | |
551 stop.x = start.x; | |
38 | 552 GFX_draw_thick_line(12,tXscreen, start, stop, color); |
553 } | |
554 } | |
555 else | |
556 { | |
557 /* ascentrate graph -standard mode */ | |
558 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
559 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
560 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
561 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
562 start.y = tXl1->WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
563 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
564 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
565 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
566 start.y = tXl1->WindowY1 + 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
567 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
568 |
38 | 569 for(int i = 0; i<4;i++) |
570 { | |
571 start.y += 5*8; | |
572 stop.y = start.y; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
573 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
574 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
575 start.x = tXl1->WindowX1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
576 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
577 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
578 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
579 start.x = tXr1->WindowX1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
580 } |
38 | 581 stop.x = start.x - 17; |
582 GFX_draw_line(tXscreen, start, stop, 0); | |
583 } | |
584 // new thick bar design Sept. 2015 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
585 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
586 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
587 start.x = tXl1->WindowX1 - 3 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
588 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
589 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
590 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
591 start.x = tXr1->WindowX1 - 3 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
592 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
593 |
38 | 594 stop.x = start.x; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
595 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
596 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
597 start.y = tXl1->WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
598 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
599 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
600 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
601 start.y = tXl1->WindowY1 + 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
602 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
603 |
38 | 604 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8); |
605 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
606 if(stop.y >= 470) | |
607 stop.y = 470; | |
608 start.y += 7; // starte etwas weiter oben | |
609 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
610 color = CLUT_EverythingOkayGreen; | |
611 else | |
612 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
613 color = CLUT_WarningYellow; | |
614 else | |
615 color = CLUT_WarningRed; | |
616 | |
617 GFX_draw_thick_line(12,tXscreen, start, stop, color); | |
618 } | |
619 } | |
620 | |
621 // divetime | |
622 if(mode == DIVEMODE_Apnea) | |
623 { | |
624 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
625 { | |
626 SDivetime SurfaceBreakTime = {0,0,0,0}; | |
627 | |
628 SurfaceBreakTime.Total = stateUsed->lifeData.counterSecondsShallowDepth; | |
629 SurfaceBreakTime.Minutes = SurfaceBreakTime.Total / 60; | |
630 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60); | |
631 | |
632 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface); | |
633 GFX_write_string(&FontT42,tXr1,text,0); | |
634 | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
635 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); |
38 | 636 } |
637 else | |
638 { | |
639 Divetime.Total = stateUsed->lifeData.dive_time_seconds; | |
640 Divetime.Minutes = Divetime.Total / 60; | |
641 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
642 | |
643 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
644 GFX_write_string(&FontT42,tXr1,text,0); | |
645 | |
646 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
647 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
38 | 648 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
649 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
38 | 650 } |
518 | 651 t3_basics_colorscheme_mod(text); |
652 GFX_write_string(&FontT105,tXr1,text,1); | |
38 | 653 } |
654 else | |
655 { | |
518 | 656 switch(get_globalState()) |
657 { | |
739 | 658 case StDMENU: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ); |
659 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
660 break; | |
518 | 661 case StDBEAR: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveBearingQ); |
662 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
663 break; | |
664 case StDRAVG: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveResetAvgQ); | |
665 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
666 break; | |
38 | 667 |
518 | 668 case StDMGAS: |
669 textPointer = 0; | |
670 text[textPointer++] = '\a'; | |
671 text[textPointer++] = '\001'; | |
672 text[textPointer++] = ' '; | |
673 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&text[textPointer]); | |
674 text[textPointer++] = '?'; | |
675 text[textPointer++] = ' '; | |
676 text[textPointer++] = 0; | |
677 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
678 break; | |
613 | 679 |
680 case StDMARK: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_SetMarkerShort); | |
681 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
682 break; | |
683 | |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
684 case StDCHECK: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_CheckMarker); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
685 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
686 break; |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
687 |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
688 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
689 case StDSIM1: snprintf(text,TEXTSIZE,"\a\003\001PPO S0 +"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
690 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
691 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
692 case StDSIM2: snprintf(text,TEXTSIZE,"\a\003\001PPO S0 -"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
693 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
694 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
695 case StDSIM3: snprintf(text,TEXTSIZE,"\a\003\001PPO S1 +"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
696 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
697 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
698 case StDSIM4: snprintf(text,TEXTSIZE,"\a\003\001PPO S1 -"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
699 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
700 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
701 case StDSIM5: snprintf(text,TEXTSIZE,"\a\003\001PPO S2 +"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
702 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
703 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
704 case StDSIM6: snprintf(text,TEXTSIZE,"\a\003\001PPO S2 -"); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
705 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
706 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
624
diff
changeset
|
707 #endif |
518 | 708 default: /* show divetime */ |
38 | 709 |
518 | 710 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; |
711 Divetime.Minutes = Divetime.Total / 60; | |
712 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
713 | |
714 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
715 GFX_write_string(&FontT42,tXr1,text,0); | |
716 | |
717 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
718 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
518 | 719 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
720 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
518 | 721 |
722 t3_basics_colorscheme_mod(text); | |
723 GFX_write_string(&FontT105,tXr1,text,1); | |
724 break; | |
725 } | |
38 | 726 } |
727 | |
728 return depth; | |
729 } | |
730 | |
731 | |
732 void t3_refresh_divemode(void) | |
733 { | |
734 uint8_t customview_warnings = 0; | |
735 float depth_meter = 0.0; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
736 |
38 | 737 // everything like lines, depth, ascent graph and divetime |
738 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials | |
739 | |
740 // customview | |
741 if(stateUsed->warnings.numWarnings) | |
742 customview_warnings = t3_test_customview_warnings(); | |
743 | |
744 if(customview_warnings && warning_count_high_time) | |
745 t3_basics_show_customview_warnings(&t3c1); | |
746 else | |
747 t3_refresh_customview(depth_meter); | |
748 | |
749 if(stateUsed->warnings.lowBattery) | |
496 | 750 t3_basics_battery_low_customview_extra(&t3r1); //t3c1); |
38 | 751 } |
752 | |
753 | |
754 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1) | |
755 { | |
756 char TextC1[256]; | |
757 | |
496 | 758 TextC1[0] = ' ';//'\002'; |
38 | 759 TextC1[1] = '\f'; |
760 TextC1[2] = '\025'; | |
761 TextC1[3] = '3'; | |
762 TextC1[4] = '1'; | |
763 TextC1[5] = '1'; | |
764 TextC1[6] = '1'; | |
765 TextC1[7] = '1'; | |
766 TextC1[8] = '1'; | |
767 TextC1[9] = '1'; | |
768 TextC1[10] = '1'; | |
769 TextC1[11] = '1'; | |
770 TextC1[12] = '1'; | |
771 TextC1[13] = '1'; | |
772 TextC1[14] = '0'; | |
773 TextC1[15] = 0; | |
774 | |
775 if(!warning_count_high_time) | |
776 TextC1[4] = '2'; | |
777 | |
778 GFX_write_string(&Batt24,tXc1,TextC1,0); | |
779 } | |
780 | |
781 | |
782 | |
783 void t3_refresh_customview(float depth) | |
784 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
237
diff
changeset
|
785 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, stateUsedWrite->diveSettings.diveMode); |
38 | 786 } |
787 | |
788 | |
789 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
790 { | |
722 | 791 char text[30]; |
38 | 792 uint16_t textpointer = 0; |
793 | |
794 // CVIEW_T3_Temperature | |
795 float temperature; | |
413 | 796 SSettings* pSettings; |
797 pSettings = settingsGetPointer(); | |
38 | 798 |
799 SDivetime TotalDivetime = {0,0,0,0}; | |
800 SDivetime LastDivetime = {0,0,0,0}; | |
801 | |
802 uint16_t tempWinX0; | |
413 | 803 uint16_t tempWinX1; |
38 | 804 uint16_t tempWinY0; |
413 | 805 uint16_t tempWinY1; |
38 | 806 |
807 tempWinX0 = tXc1->WindowX0; | |
413 | 808 tempWinX1 = tXc1->WindowX1; |
38 | 809 tempWinY0 = tXc1->WindowY0; |
413 | 810 tempWinY1 = tXc1->WindowY1; |
38 | 811 |
812 tXc1->WindowX0 = 440; // rechte Seite | |
813 | |
814 switch(tX_selection_customview) | |
815 { | |
816 case CVIEW_T3_Temperature: | |
817 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
818 GFX_write_string(&FontT42,tXc1,text,0); | |
819 | |
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
820 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 821 textpointer = snprintf(text,TEXTSIZE,"\020\003\016%01.0f\016\016\140",temperature); // "\016\016%01.1f `" + C or F |
822 if(settingsGetPointer()->nonMetricalSystem == 0) | |
823 text[textpointer++] = 'C'; | |
824 else | |
825 text[textpointer++] = 'F'; | |
826 text[textpointer++] = 0; | |
827 t3_basics_colorscheme_mod(text); | |
828 GFX_write_string(&FontT105,tXc1,text,1); | |
829 break; | |
830 | |
831 case CVIEW_T3_ApnoeSurfaceInfo: | |
832 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Divetime); | |
833 GFX_write_string(&FontT42,tXc1,text,0); | |
834 | |
835 TotalDivetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; | |
836 TotalDivetime.Minutes = TotalDivetime.Total / 60; | |
837 TotalDivetime.Seconds = TotalDivetime.Total - ( TotalDivetime.Minutes * 60 ); | |
838 | |
839 LastDivetime.Total = stateUsed->lifeData.apnea_last_dive_time_seconds; | |
840 LastDivetime.Minutes = LastDivetime.Total / 60; | |
841 LastDivetime.Seconds = LastDivetime.Total - ( LastDivetime.Minutes * 60 ); | |
842 | |
413 | 843 // tXc1->WindowY0 = 100; // obere Zeile |
844 if(!pSettings->FlipDisplay) | |
845 { | |
846 tXc1->WindowY0 = 100; | |
847 } | |
848 else | |
849 { | |
850 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ | |
851 } | |
38 | 852 |
853 snprintf(text,TEXTSIZE,"\020\016%u:%02u",LastDivetime.Minutes, LastDivetime.Seconds); | |
854 t3_basics_colorscheme_mod(text); | |
855 GFX_write_string(&FontT105,tXc1,text,0); | |
856 | |
413 | 857 if(pSettings->FlipDisplay) |
858 { | |
859 tXc1->WindowX0 = 0; | |
860 | |
861 } | |
38 | 862 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaLast); |
863 GFX_write_string(&FontT42,tXc1,text,0); | |
864 | |
413 | 865 if(!pSettings->FlipDisplay) |
866 { | |
867 tXc1->WindowY0 = tempWinY0; | |
868 } | |
869 else | |
870 { | |
871 tXc1->WindowX1 = tempWinX1; | |
872 tXc1->WindowY1 = tempWinY1; /* jump to upper of two lines */ | |
873 } | |
38 | 874 |
875 snprintf(text,TEXTSIZE,"\020\016%u:%02u",TotalDivetime.Minutes, TotalDivetime.Seconds); | |
876 t3_basics_colorscheme_mod(text); | |
877 GFX_write_string(&FontT105,tXc1,text,0); | |
878 | |
879 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaTotal); | |
413 | 880 if(pSettings->FlipDisplay) |
881 { | |
882 tXc1->WindowX0 = 0; | |
883 | |
884 } | |
38 | 885 GFX_write_string(&FontT42,tXc1,text,0); |
886 break; | |
887 } | |
888 | |
889 tXc1->WindowX0 = tempWinX0; | |
413 | 890 tXc1->WindowX1 = tempWinX1; |
38 | 891 tXc1->WindowY0 = tempWinY0; |
892 | |
893 } | |
894 | |
895 | |
896 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
897 { | |
837 | 898 static uint8_t last_customview = CVIEW_T3_END; |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
899 |
722 | 900 char text[30]; |
38 | 901 uint16_t textpointer = 0; |
902 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
903 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
904 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
905 |
38 | 906 // CVIEW_T3_Decostop and CVIEW_T3_TTS |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
758
diff
changeset
|
907 const SDecoinfo * pDecoinfo = getDecoInfo(); |
38 | 908 |
909 // CVIEW_T3_Decostop | |
910 uint16_t nextstopLengthSeconds = 0; | |
911 uint8_t nextstopDepthMeter = 0; | |
912 SDivetime SafetyStopTime = {0,0,0,0}; | |
913 | |
914 // CVIEW_T3_ppO2andGas | |
915 uint8_t oxygen_percentage = 0; | |
916 | |
917 // CVIEW_T3_Temperature | |
918 float temperature; | |
919 | |
920 // CVIEW_T3_GasList | |
921 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; | |
922 const SGasLine * pGasLine; | |
923 uint8_t oxygen, helium; | |
924 uint8_t lineNumber; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
925 uint8_t gasPosIdx; |
38 | 926 |
496 | 927 /* compass position */ |
928 point_t center; | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
929 uint16_t heading; |
496 | 930 |
38 | 931 // CVIEW_T3_StopWatch |
932 SDivetime Stopwatch = {0,0,0,0}; | |
933 float fAverageDepth, fAverageDepthAbsolute; | |
934 | |
662 | 935 #ifdef ENABLE_PSCR_MODE |
936 uint8_t showSimPPO2 = 1; | |
937 #endif | |
38 | 938 uint16_t tempWinX0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
939 uint16_t tempWinX1; |
38 | 940 uint16_t tempWinY0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
941 uint16_t tempWinY1; |
38 | 942 uint16_t tempWinC2X0; |
413 | 943 uint16_t tempWinC2Y0; |
944 uint16_t tempWinC2X1; | |
945 uint16_t tempWinC2Y1; | |
38 | 946 uint16_t tempWinC2Tab; |
947 | |
948 tempWinX0 = tXc1->WindowX0; | |
949 tempWinY0 = tXc1->WindowY0; | |
496 | 950 tempWinX1 = tXc1->WindowX1; |
951 tempWinY1 = tXc1->WindowY1; | |
413 | 952 |
38 | 953 tempWinC2X0 = tXc2->WindowX0; |
413 | 954 tempWinC2Y0 = tXc2->WindowY0; |
955 tempWinC2X1 = tXc2->WindowX1; | |
956 tempWinC2Y1 = tXc2->WindowY1; | |
38 | 957 tempWinC2Tab = tXc2->WindowTab; |
958 | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
959 if(settingsGetPointer()->compassInertia) |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
960 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
961 heading = (uint16_t)compass_getCompensated(); |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
962 } |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
963 else |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
964 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
965 heading = (uint16_t)stateUsed->lifeData.compass_heading; |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
966 } |
837 | 967 if((last_customview != tX_selection_customview) && (settingsGetPointer()->design == 3)) /* check if current selection is disabled and should be skipped */ |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
968 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
969 if(t3_customview_disabled(tX_selection_customview)) |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
970 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
971 tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER); |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
972 } |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
973 last_customview = tX_selection_customview; |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
974 } |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
975 |
38 | 976 switch(tX_selection_customview) |
977 { | |
978 case CVIEW_T3_ApnoeSurfaceInfo: | |
979 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
980 | |
413 | 981 if(!pSettings->FlipDisplay) |
982 { | |
983 GFX_write_string(&FontT42,tXc1,text,0); | |
984 tXc1->WindowY0 = 100; | |
985 } | |
986 else | |
987 { | |
988 GFX_write_string(&FontT42,tXc2,text,0); | |
989 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
990 } | |
38 | 991 |
992 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_last_max_depth_meter)); | |
993 t3_basics_colorscheme_mod(text); | |
413 | 994 |
995 if(!pSettings->FlipDisplay) | |
996 { | |
997 GFX_write_string(&FontT105,tXc1,text,0); | |
998 tXc1->WindowY0 = tempWinY0; | |
999 } | |
1000 else | |
1001 { | |
1002 GFX_write_string(&FontT105,tXc2,text,0); | |
1003 tXc2->WindowY1 = tempWinC2Y1; /* jump to upper of two lines */ | |
1004 } | |
38 | 1005 |
1006 | |
1007 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_total_max_depth_meter)); | |
1008 t3_basics_colorscheme_mod(text); | |
413 | 1009 if(!pSettings->FlipDisplay) |
1010 { | |
1011 GFX_write_string(&FontT105,tXc1,text,0); | |
1012 } | |
1013 else | |
1014 { | |
1015 GFX_write_string(&FontT105,tXc2,text,0); | |
1016 } | |
38 | 1017 break; |
1018 | |
1019 case CVIEW_T3_StopWatch: | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1020 |
38 | 1021 Stopwatch.Total = timer_Stopwatch_GetTime(); |
1022 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1023 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1024 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1025 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1026 | |
1027 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); | |
1028 GFX_write_string(&FontT42,tXc1,text,0); | |
1029 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); | |
1030 GFX_write_string(&FontT105,tXc1,text,0); | |
1031 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1032 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1033 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1034 tXc1->WindowX0 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1035 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1036 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1037 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1038 tXc1->WindowX1 = 320; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1039 tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1040 } |
38 | 1041 // snprintf(text,TEXTSIZE,"\032\f%c%c - %c",TXT_2BYTE, TXT2BYTE_Clock, TXT_AvgDepth); |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1042 |
38 | 1043 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch); |
1044 GFX_write_string(&FontT42,tXc1,text,0); | |
1045 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); | |
1046 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1047 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1048 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1049 tXc1->WindowY0 = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1050 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1051 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1052 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1053 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1054 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1055 |
38 | 1056 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); |
1057 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
1058 |
496 | 1059 break; |
38 | 1060 |
1061 case CVIEW_T3_GasList: | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1062 gasPosIdx = 0; |
38 | 1063 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); |
1064 GFX_write_string(&FontT42,tXc1,text,0); | |
1065 | |
1066 textpointer = 0; | |
1067 tXc2->WindowX0 = 0; | |
518 | 1068 tXc2->WindowTab = 800/3; // /2 |
38 | 1069 |
413 | 1070 if(pSettings->FlipDisplay) |
1071 { | |
1072 tXc2->WindowY1 = 0; | |
1073 } | |
1074 | |
38 | 1075 pGasLine = settingsGetPointer()->gas; |
1076 if(actualLeftMaxDepth(stateUsed)) | |
1077 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
1078 else | |
1079 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
1080 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
1081 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
1082 { | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1083 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1084 if(!pGasLine[gasId].note.ub.off) |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1085 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1086 #endif |
38 | 1087 textpointer = 0; |
518 | 1088 text[textpointer++] = '\003'; |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1089 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1090 lineNumber = 1; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1091 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1092 switch(gasPosIdx) |
38 | 1093 { |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1094 case 0: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1095 case 1: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1096 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1097 case 4: text[textpointer++] = '\001'; /* display centered */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1098 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1099 case 2: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1100 case 3: text[textpointer++] = '\002'; /* display right aligned */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1101 default: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1102 break; |
38 | 1103 } |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1104 gasPosIdx++; |
518 | 1105 |
38 | 1106 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; |
1107 if(pGasLine[gasId].note.ub.active == 0) | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1108 strcpy(&text[textpointer++],"\031"); |
518 | 1109 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ |
1110 { | |
1111 strcpy(&text[textpointer++],"\030"); | |
1112 } | |
38 | 1113 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) |
1114 strcpy(&text[textpointer++],"\025"); | |
518 | 1115 else if(actualBetterGasId() == gasId) |
1116 { | |
1117 strcpy(&text[textpointer++],"\026"); /* Highlight better gas */ | |
1118 } | |
38 | 1119 else |
518 | 1120 strcpy(&text[textpointer++],"\023"); /* Blue for travel or deco without special state */ |
38 | 1121 |
1122 text[textpointer++] = ' '; | |
1123 oxygen = pGasLine[gasId].oxygen_percentage; | |
1124 helium = pGasLine[gasId].helium_percentage; | |
1125 textpointer += write_gas(&text[textpointer], oxygen, helium); | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1126 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1127 if((pGasLine[gasId].depth_meter) && (gasPosIdx < 5)) /* do not show for potential last gas because of formating issues */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1128 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1129 textpointer += snprintf(&text[textpointer],7,"\016\016%u%c%c",unit_depth_integer(pGasLine[gasId].depth_meter), unit_depth_char1(), unit_depth_char2()); |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1130 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1131 text[textpointer++] = 0; |
518 | 1132 GFX_write_string(&FontT42, tXc1, text, lineNumber); |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1133 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1134 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1135 #endif |
38 | 1136 } |
1137 break; | |
1138 | |
1139 case CVIEW_T3_Temperature: | |
1140 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
1141 GFX_write_string(&FontT42,tXc1,text,0); | |
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
1142 |
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
1143 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 1144 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F |
1145 if(settingsGetPointer()->nonMetricalSystem == 0) | |
1146 text[textpointer++] = 'C'; | |
1147 else | |
1148 text[textpointer++] = 'F'; | |
1149 text[textpointer++] = 0; | |
1150 GFX_write_string(&FontT105,tXc1,text,0); | |
1151 break; | |
1152 | |
1153 case CVIEW_Compass: | |
496 | 1154 center.x = 600; |
1155 center.y = 116; | |
38 | 1156 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); |
1157 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1158 snprintf(text,100,"\030\003%03i`",heading); |
38 | 1159 GFX_write_string(&FontT105,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1160 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
38 | 1161 break; |
601 | 1162 #ifdef ENABLE_T3_PROFILE_VIEW |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1163 case CVIEW_T3_Profile: |
599 | 1164 snprintf(text,100,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_Profile); |
592
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1165 GFX_write_string(&FontT42,tXc1,text,0); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1166 t3_miniLiveLogProfile(); |
f52bc70e380f
MotionCtrl - Sectorview Map sectors directly to custom views:
Ideenmodellierer
parents:
582
diff
changeset
|
1167 break; |
601 | 1168 #endif |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1169 case CVIEW_T3_DecoTTS: |
38 | 1170 case CVIEW_T3_Decostop: |
1171 default: | |
1172 // decostop | |
1173 if(pDecoinfo->output_time_to_surface_seconds) | |
1174 { | |
1175 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
1176 } | |
1177 else | |
1178 { | |
1179 nextstopDepthMeter = 0; | |
1180 nextstopLengthSeconds = 0; | |
1181 } | |
1182 | |
1183 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
1184 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
1185 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
1186 | |
1187 if(nextstopDepthMeter) | |
1188 { | |
1189 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Decostop); | |
1190 GFX_write_string(&FontT42,tXc1,text,0); | |
1191 | |
1192 textpointer = 0; | |
1193 snprintf(&text[textpointer],TEXTSIZE,"\020\003%u%c%c %u'" | |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1194 , unit_depth_integer(nextstopDepthMeter) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1195 , unit_depth_char1_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1196 , unit_depth_char2_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1197 , (nextstopLengthSeconds+59)/60); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1198 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1199 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1200 } |
1201 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
1202 { | |
1203 textpointer = 0; | |
1204 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
1205 GFX_write_string(&FontT42,tXc1,text,0); | |
1206 | |
1207 textpointer = 0; | |
1208 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
1209 t3_basics_colorscheme_mod(text); | |
496 | 1210 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1211 } |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
1212 else if(pDecoinfo->output_ndl_seconds) // NDL |
38 | 1213 { |
1214 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit); | |
1215 GFX_write_string(&FontT42,tXc1,text,0); | |
1216 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
1217 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60); | |
1218 else | |
1219 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600); | |
1220 t3_basics_colorscheme_mod(text); | |
496 | 1221 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1222 } |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1223 |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1224 if(tX_selection_customview == CVIEW_T3_DecoTTS) /* add tts data on right side of screen */ |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1225 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1226 if(pDecoinfo->output_time_to_surface_seconds) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1227 { |
722 | 1228 snprintf(text,TEXTSIZE,"\002\032\f%c",TXT_TTS); |
1229 GFX_write_string(&FontT42,tXc1,text,0); | |
1230 if(pDecoinfo->output_time_to_surface_seconds) | |
1231 { | |
1232 if(pDecoinfo->output_time_to_surface_seconds < 100 * 60) | |
1233 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); | |
1234 else | |
1235 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); | |
1236 t3_basics_colorscheme_mod(text); | |
1237 GFX_write_string(&FontT105,tXc1,text,0); | |
1238 } | |
1239 } | |
1240 else if(pDecoinfo->super_saturation > 0.1) | |
1241 { | |
1242 snprintf(text,TEXTSIZE,"\002\032\f%c",TXT_ActualGradient); | |
1243 GFX_write_string(&FontT42,tXc1,text,0); | |
1244 snprintf(text,TEXTSIZE,"\020\003\002%.0f\016\016%%\017",100 * pDecoinfo->super_saturation); | |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1245 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1246 GFX_write_string(&FontT105,tXc1,text,0); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1247 } |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1248 } |
38 | 1249 break; |
1250 | |
837 | 1251 case CVIEW_T3_sensors: |
38 | 1252 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); |
1253 GFX_write_string(&FontT42,tXc1,text,0); | |
1254 | |
1255 for(int i=0;i<3;i++) | |
1256 { | |
1257 textpointer = 0; | |
1258 text[textpointer++] = '\030'; | |
1259 if(i==1) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1260 text[textpointer++] = '\001'; /* center */ |
38 | 1261 else if(i==2) |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1262 text[textpointer++] = '\002'; /* right */ |
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1263 |
577
9bb9a52d6ae5
Handle o2 voltage values < 0.5mV as invalid:
Ideenmodellierer
parents:
564
diff
changeset
|
1264 if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0)) |
38 | 1265 { |
662 | 1266 #ifdef ENABLE_PSCR_MODE |
1267 if((stateUsed->diveSettings.diveMode == DIVEMODE_PSCR) && (showSimPPO2) && (stateUsed->mode == MODE_DIVE)) /* display ppo2 sim in blue letters in case a slot is not used in the ppo2 custom view */ | |
1268 { | |
1269 text[textpointer++] = '\023'; | |
1270 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppo2Simulated_bar); | |
1271 showSimPPO2 = 0; | |
1272 } | |
1273 else | |
1274 #endif | |
1275 { | |
1276 text[textpointer++] = '\031'; | |
1277 text[textpointer++] = ' '; | |
1278 text[textpointer++] = '-'; | |
1279 text[textpointer++] = ' '; | |
1280 text[textpointer++] = 0; | |
1281 } | |
38 | 1282 } |
1283 else | |
1284 { | |
1285 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1286 text[textpointer++] = '\025'; | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1287 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppO2Sensor_bar[i]); |
38 | 1288 } |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1289 GFX_write_string(&FontT105,tXc1,text,0); |
656 | 1290 |
828 | 1291 if((pSettings->co2_sensor_active) && isLoopMode(pSettings->dive_mode)) |
1292 { | |
1293 snprintf(text,TEXTSIZE,"\032\001\f%c",TXT_CO2Sensor); | |
1294 GFX_write_string(&FontT42,tXc1,text,0); | |
1295 textpointer = 0; | |
1296 if(stateUsed->lifeData.CO2_data.CO2_ppm < CO2_WARNING_LEVEL_PPM) | |
1297 { | |
1298 text[textpointer++] = '\020'; | |
1299 } | |
1300 else if(stateUsed->lifeData.CO2_data.CO2_ppm < CO2_ALARM_LEVEL_PPM) | |
1301 { | |
1302 text[textpointer++] = '\024'; /* yellow */ | |
1303 } | |
1304 else | |
1305 { | |
1306 text[textpointer++] = '\025'; /* red */ | |
1307 } | |
1308 snprintf(&text[textpointer],TEXTSIZE,"\001%5ld",stateUsed->lifeData.CO2_data.CO2_ppm); | |
1309 GFX_write_string(&FontT105,tXc1,text,1); | |
1310 } | |
656 | 1311 |
662 | 1312 if((pSettings->scrubTimerMode != SCRUB_TIMER_OFF) && isLoopMode(pSettings->dive_mode)) |
656 | 1313 { |
1314 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_ScrubTime); | |
1315 GFX_write_string(&FontT42,tXc1,text,0); | |
1316 | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1317 textpointer = 0; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1318 text[textpointer++] = '\002'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1319 textpointer += printScrubberText(&text[textpointer], 10, pSettings); |
656 | 1320 GFX_write_string(&FontT105,tXc1,text,1); |
1321 } | |
38 | 1322 } |
1323 break; | |
1324 | |
1325 case CVIEW_T3_MaxDepth: | |
1326 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
413 | 1327 if(pSettings->FlipDisplay) |
1328 { | |
1329 if(mode == DIVEMODE_Apnea) | |
1330 { | |
1331 GFX_write_string(&FontT42,tXc2,text,0); | |
1332 } | |
1333 else | |
1334 { | |
1335 GFX_write_string(&FontT42,tXc1,text,0); | |
1336 } | |
1337 } | |
1338 else | |
1339 { | |
1340 GFX_write_string(&FontT42,tXc1,text,0); | |
1341 } | |
38 | 1342 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); |
1343 t3_basics_colorscheme_mod(text); | |
413 | 1344 if(pSettings->FlipDisplay) |
1345 { | |
1346 if(mode == DIVEMODE_Apnea) | |
1347 { | |
1348 GFX_write_string(&FontT105,tXc2,text,0); | |
1349 } | |
1350 else | |
1351 { | |
1352 GFX_write_string(&FontT105,tXc1,text,0); | |
1353 } | |
1354 } | |
1355 else | |
1356 { | |
496 | 1357 GFX_write_string(&FontT105,tXc1,text,0); |
413 | 1358 } |
38 | 1359 break; |
1360 | |
1361 case CVIEW_T3_TTS: | |
1362 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); | |
1363 GFX_write_string(&FontT42,tXc1,text,0); | |
1364 if(pDecoinfo->output_time_to_surface_seconds) | |
1365 { | |
1366 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1367 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
38 | 1368 else |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1369 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
38 | 1370 t3_basics_colorscheme_mod(text); |
496 | 1371 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1372 } |
1373 break; | |
1374 | |
1375 case CVIEW_T3_ppO2andGas: | |
1376 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); | |
1377 GFX_write_string(&FontT42,tXc1,text,0); | |
1378 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); | |
1379 t3_basics_colorscheme_mod(text); | |
496 | 1380 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1381 |
1382 textpointer = 0; | |
1383 text[textpointer++] = '\020'; | |
1384 text[textpointer++] = '\003'; | |
1385 oxygen_percentage = 100; | |
1386 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
1387 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
1388 text[textpointer++] = '\002'; | |
1389 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); | |
1390 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); | |
1391 t3_basics_colorscheme_mod(text); | |
496 | 1392 GFX_write_string(&FontT48,tXc1,text,0); |
38 | 1393 break; |
496 | 1394 |
1395 case CVIEW_T3_Navigation: | |
1396 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
1397 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1398 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1399 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1400 | |
1401 if(!pSettings->FlipDisplay) | |
1402 { | |
1403 tXc2->WindowX0 = 550; | |
1404 } | |
1405 else | |
1406 { | |
1407 tXc2->WindowX1 = 800; | |
1408 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ | |
1409 } | |
1410 | |
1411 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); | |
511 | 1412 GFX_write_string(&FontT42,tXc1,text,0); |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1413 snprintf(text,TEXTSIZE,"\030\002\016%01.1f",unit_depth_float(fAverageDepth)); |
511 | 1414 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1415 if(!pSettings->FlipDisplay) |
1416 { | |
1417 tXc2->WindowY0 = 100; | |
1418 } | |
1419 else | |
1420 { | |
1421 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
1422 } | |
1423 | |
1424 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); | |
511 | 1425 GFX_write_string(&FontT105,tXc1,text,1); |
496 | 1426 |
1427 | |
1428 center.x = 400; | |
1429 center.y = 116; | |
1430 | |
1431 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1432 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1433 snprintf(text,100,"\030%03i`",heading); |
496 | 1434 GFX_write_string(&FontT144,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1435 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
496 | 1436 |
1437 break; | |
1438 | |
1439 case CVIEW_T3_DepthData: | |
1440 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
1441 if(pSettings->FlipDisplay) | |
1442 { | |
1443 if(mode == DIVEMODE_Apnea) | |
1444 { | |
1445 GFX_write_string(&FontT42,tXc2,text,0); | |
1446 } | |
1447 else | |
1448 { | |
1449 GFX_write_string(&FontT42,tXc1,text,0); | |
1450 } | |
1451 } | |
1452 else | |
1453 { | |
1454 GFX_write_string(&FontT42,tXc1,text,0); | |
1455 } | |
1456 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
1457 t3_basics_colorscheme_mod(text); | |
1458 if(pSettings->FlipDisplay) | |
1459 { | |
1460 if(mode == DIVEMODE_Apnea) | |
1461 { | |
1462 GFX_write_string(&FontT105,tXc2,text,0); | |
1463 } | |
1464 else | |
1465 { | |
1466 GFX_write_string(&FontT105,tXc1,text,0); | |
1467 } | |
1468 } | |
1469 else | |
1470 { | |
1471 GFX_write_string(&FontT105,tXc1,text,0); | |
1472 } | |
1473 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1474 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); | |
511 | 1475 GFX_write_string(&FontT42,tXc1,text,0); |
496 | 1476 |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1477 snprintf(text,TEXTSIZE,"\020\003\002\016\%01.1f",unit_depth_float(fAverageDepthAbsolute)); |
511 | 1478 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1479 break; |
38 | 1480 } |
496 | 1481 |
1482 | |
1483 | |
38 | 1484 tXc1->WindowX0 = tempWinX0; |
1485 tXc1->WindowY0 = tempWinY0; | |
496 | 1486 tXc1->WindowX1 = tempWinX1; |
1487 tXc1->WindowY1 = tempWinY1; | |
413 | 1488 |
38 | 1489 tXc2->WindowX0 = tempWinC2X0; |
413 | 1490 tXc2->WindowY0 = tempWinC2Y0; |
1491 tXc2->WindowX1 = tempWinC2X1; | |
1492 tXc2->WindowY1 = tempWinC2Y1; | |
38 | 1493 tXc2->WindowTab = tempWinC2Tab; |
1494 } | |
1495 | |
1496 | |
1497 uint8_t t3_test_customview_warnings(void) | |
1498 { | |
1499 uint8_t count = 0; | |
1500 | |
1501 count = 0; | |
1502 count += stateUsed->warnings.decoMissed; | |
1503 count += stateUsed->warnings.ppO2Low; | |
1504 count += stateUsed->warnings.ppO2High; | |
1505 //count += stateUsed->warnings.lowBattery; | |
1506 count += stateUsed->warnings.sensorLinkLost; | |
1507 count += stateUsed->warnings.fallback; | |
1508 | |
1509 return count; | |
1510 } | |
1511 | |
1512 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
1513 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1) | |
1514 { | |
1515 char text[256], textMain[256]; | |
1516 uint8_t textpointer, textpointerMain, lineFree, more; | |
857 | 1517 uint8_t index = 0; |
38 | 1518 |
1519 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); | |
1520 GFX_write_string(&FontT42,&t3c1,text,0); | |
1521 | |
1522 lineFree = 1; | |
1523 more = 0; | |
1524 | |
1525 textpointerMain = 0; | |
511 | 1526 textMain[textpointerMain++] = '\025'; /* red */ |
1527 textMain[textpointerMain++] = '\003'; /* doublesize */ | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1528 textMain[textpointerMain++] = TXT_2BYTE; /* There is only one Main warning to be displayed */ |
38 | 1529 |
1530 textpointer = 0; | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1531 text[textpointer++] = '\025'; /* red */ |
38 | 1532 |
1533 if(stateUsed->warnings.decoMissed) | |
1534 { | |
1535 if(lineFree) | |
1536 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1537 textMain[textpointerMain++] = TXT2BYTE_WarnDecoMissed; |
38 | 1538 lineFree--; |
1539 } | |
1540 else | |
1541 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1542 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1543 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1544 text[textpointer++] = TXT2BYTE_WarnDecoMissed; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1545 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1546 text[textpointer++] = '\n'; |
38 | 1547 more++; |
1548 } | |
1549 } | |
1550 | |
1551 if(stateUsed->warnings.ppO2Low) | |
1552 { | |
1553 if(lineFree) | |
1554 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1555 textMain[textpointerMain++] = TXT2BYTE_WarnPPO2Low; |
38 | 1556 lineFree--; |
1557 } | |
1558 else | |
1559 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1560 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1561 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1562 text[textpointer++] = TXT2BYTE_WarnPPO2Low; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1563 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1564 text[textpointer++] = '\n'; |
38 | 1565 more++; |
1566 } | |
1567 } | |
1568 | |
1569 if(stateUsed->warnings.ppO2High) | |
1570 { | |
1571 if(lineFree) | |
1572 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1573 textMain[textpointerMain++] = TXT2BYTE_WarnPPO2High; |
38 | 1574 lineFree--; |
1575 } | |
1576 else | |
1577 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1578 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1579 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1580 text[textpointer++] = TXT2BYTE_WarnPPO2High; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1581 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1582 text[textpointer++] = '\n'; |
38 | 1583 more++; |
1584 } | |
1585 } | |
1586 | |
1587 if(stateUsed->warnings.fallback) | |
1588 { | |
1589 if(lineFree) | |
1590 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1591 textMain[textpointerMain++] = TXT2BYTE_WarnFallback; |
38 | 1592 lineFree--; |
1593 } | |
1594 else | |
1595 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1596 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1597 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1598 text[textpointer++] = TXT2BYTE_WarnFallback; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1599 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1600 text[textpointer++] = '\n'; |
38 | 1601 more++; |
1602 } | |
1603 } | |
1604 | |
1605 if(stateUsed->warnings.sensorLinkLost) | |
1606 { | |
1607 if(lineFree) | |
1608 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1609 textMain[textpointerMain++] = TXT2BYTE_WarnSensorLinkLost; |
38 | 1610 lineFree--; |
1611 } | |
1612 else | |
1613 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1614 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1615 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1616 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1617 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1618 text[textpointer++] = '\n'; |
38 | 1619 more++; |
1620 } | |
1621 } | |
1622 | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1623 if(stateUsed->warnings.co2High) |
38 | 1624 { |
1625 if(lineFree) | |
1626 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1627 textMain[textpointerMain++] = TXT2BYTE_WarnCO2High; |
38 | 1628 } |
1629 else | |
1630 { | |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1631 text[textpointer++] = '\002'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1632 text[textpointer++] = TXT_2BYTE; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1633 text[textpointer++] = TXT2BYTE_WarnCO2High; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1634 text[textpointer++] = '\r'; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1635 text[textpointer++] = '\n'; |
38 | 1636 more++; |
1637 } | |
1638 } | |
857 | 1639 #ifdef HAVE_DEBUG_WARNINGS |
1640 if(lineFree && stateUsed->warnings.debug) | |
1641 { | |
1642 for(index=0; index<3; index++) | |
1643 { | |
1644 if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR))) | |
1645 { | |
1646 textpointer += snprintf(&text[textpointer],32,"\001Debug: %lx\n",((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status); | |
1647 } | |
1648 } | |
1649 lineFree--; | |
1650 } | |
1651 #endif | |
38 | 1652 text[textpointer] = 0; |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1653 textMain[textpointerMain] = 0; |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1654 |
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1655 if(lineFree == 0) |
38 | 1656 { |
755
92bf7bf9fb8a
Cleanup display of multiple warnings in T3 (Big font) view:
Ideenmodellierer
parents:
739
diff
changeset
|
1657 GFX_write_string(&FontT48,&t3c1,textMain,0); |
38 | 1658 } |
1659 if(more) | |
1660 { | |
511 | 1661 GFX_write_string(&FontT48,&t3c2,text,0); |
38 | 1662 } |
1663 } | |
1664 | |
496 | 1665 uint8_t t3_customview_disabled(uint8_t view) |
1666 { | |
1667 uint8_t i = 0; | |
1668 uint8_t cv_disabled = 0; | |
1669 const uint8_t *pcv_changelist; | |
1670 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; | |
1671 | |
511 | 1672 pcv_changelist = cv_changelist_BS; |
496 | 1673 |
1674 while(pcv_changelist[i] != CVIEW_T3_END) | |
1675 { | |
1676 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i])) | |
1677 { | |
1678 cv_disabled = 1; | |
1679 break; | |
1680 } | |
1681 i++; | |
1682 } | |
1683 | |
837 | 1684 if ((view == CVIEW_T3_sensors) && |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1685 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback)) |
496 | 1686 { |
1687 cv_disabled = 1; | |
1688 } | |
1689 | |
1690 return cv_disabled; | |
1691 } | |
38 | 1692 |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1693 uint8_t t3_change_customview(uint8_t action) |
38 | 1694 { |
511 | 1695 |
837 | 1696 t3_basics_change_customview(&t3_selection_customview, cv_changelist_BS, action); |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1697 return t3_selection_customview; |
38 | 1698 } |
1699 | |
1700 | |
511 | 1701 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) |
38 | 1702 { |
511 | 1703 uint8_t curViewIdx = 0xff; |
1704 uint8_t index = 0; | |
599 | 1705 uint8_t indexOverrun = 0; |
511 | 1706 uint8_t lastViewIdx = 0; |
599 | 1707 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ |
1708 uint8_t useFallback = 0; /* is set if the current view is disabled */ | |
1709 uint8_t fallbackSelection = CVIEW_noneOrDebug; /* show "None" view per default */ | |
38 | 1710 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1711 /* set pointer to currently selected view and count number of entries */ |
511 | 1712 while((tX_customviews[index] != CVIEW_T3_END)) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1713 { |
511 | 1714 if (tX_customviews[index] == *tX_selection_customview) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1715 { |
511 | 1716 curViewIdx = index; |
837 | 1717 break; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1718 } |
511 | 1719 index++; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1720 } |
511 | 1721 if(curViewIdx == 0xff) /* called with unknown view */ |
496 | 1722 { |
511 | 1723 curViewIdx = 0; |
599 | 1724 *tX_selection_customview = CVIEW_noneOrDebug; /* show "None" view per default */ |
496 | 1725 } |
511 | 1726 lastViewIdx = index; |
1727 index = curViewIdx; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1728 do |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1729 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1730 iterate = 0; |
496 | 1731 switch(action) |
1732 { | |
1733 case ACTION_BUTTON_ENTER: | |
1734 case ACTION_PITCH_POS: | |
1735 | |
511 | 1736 if(tX_customviews[index] != CVIEW_T3_END) |
496 | 1737 { |
511 | 1738 index++; |
1739 } | |
1740 if(tX_customviews[index] == CVIEW_T3_END) | |
1741 { | |
1742 index = 0; | |
599 | 1743 indexOverrun = 1; |
496 | 1744 } |
1745 break; | |
1746 case ACTION_PITCH_NEG: | |
511 | 1747 if(index == 0) |
496 | 1748 { |
511 | 1749 index = lastViewIdx - 1; |
599 | 1750 indexOverrun = 1; |
496 | 1751 } |
1752 else | |
1753 { | |
511 | 1754 index--; |
496 | 1755 } |
1756 break; | |
1757 default: | |
1758 break; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1759 } |
496 | 1760 |
837 | 1761 if((tX_customviews == cv_changelist_BS) && (t3_customview_disabled(tX_customviews[index]))) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1762 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1763 iterate = 1; |
599 | 1764 if(*tX_selection_customview == tX_customviews[index]) |
1765 { | |
1766 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1767 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1768 } |
599 | 1769 else /* special case which are enabled but not to be displayed at the moment */ |
1770 { | |
1771 if(settingsGetPointer()->MotionDetection != MOTION_DETECT_SECTOR) /* no hiding in case of active sector view option (fixed mapping would change during dive) */ | |
1772 { | |
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
758
diff
changeset
|
1773 const SDecoinfo * pDecoinfo = getDecoInfo(); |
601 | 1774 /* Skip TTS if value is 0 */ |
1775 if((tX_customviews[index] == CVIEW_T3_TTS) && (!pDecoinfo->output_time_to_surface_seconds)) | |
599 | 1776 { |
601 | 1777 if(*tX_selection_customview == tX_customviews[index]) |
1778 { | |
1779 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1780 } | |
599 | 1781 iterate = 1; |
601 | 1782 if(fallbackSelection == CVIEW_noneOrDebug) |
1783 { | |
1784 fallbackSelection = CVIEW_T3_TTS; | |
1785 } | |
599 | 1786 } |
601 | 1787 /* Skip Deco if NDL is not set */ |
1788 if((tX_customviews[index] == CVIEW_T3_Decostop) && ((!pDecoinfo->output_ndl_seconds) && (!pDecoinfo->output_time_to_surface_seconds) && (timer_Safetystop_GetCountDown() == 0))) | |
599 | 1789 { |
601 | 1790 if(*tX_selection_customview == tX_customviews[index]) |
1791 { | |
1792 useFallback = 1; /* the provided view is disabled => use fallback */ | |
1793 } | |
1794 fallbackSelection = CVIEW_T3_Decostop; | |
599 | 1795 iterate = 1; |
1796 } | |
1797 } | |
1798 } | |
1799 if((iterate) && (action == ACTION_END)) /* ACTION_END is used to check the enable state of the provided view. If it is enable the function will return without change */ | |
496 | 1800 { |
1801 action = ACTION_BUTTON_ENTER; | |
1802 } | |
599 | 1803 }while ((iterate == 1) && (!((indexOverrun == 1) && (*tX_selection_customview == tX_customviews[index])))); /* no other available view found => use fallback */ |
38 | 1804 |
599 | 1805 if(*tX_selection_customview == tX_customviews[index]) |
1806 { | |
1807 if(useFallback) | |
1808 { | |
1809 *tX_selection_customview = fallbackSelection; /* no active view found => keep actual view or change to fallback if actual view is deactivated */ | |
1810 } | |
1811 } | |
1812 else | |
1813 { | |
1814 *tX_selection_customview = tX_customviews[index]; | |
1815 } | |
38 | 1816 } |
1817 | |
1818 | |
1819 void t3_basics_colorscheme_mod(char *text) | |
1820 { | |
1821 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
1822 { | |
1823 text[0] = '\027'; | |
1824 } | |
1825 } | |
1826 | |
1827 | |
496 | 1828 point_t t3_compass_circle(uint8_t id, uint16_t degree, point_t center) |
38 | 1829 { |
1830 float fCos, fSin; | |
1831 const float piMult = ((2 * 3.14159) / 360); | |
1832 // const int radius[4] = {95,105,115,60}; | |
1833 const int radius[4] = {85,95,105,90}; | |
496 | 1834 static point_t forcenter = {.x = 900, .y = 500}; /* used to identify change of circle position */ |
38 | 1835 static point_t r[4][360] = { 0 }; |
1836 | |
496 | 1837 if((r[0][0].y == 0) || (forcenter.x != center.x) || (forcenter.y != center.y)) /* calculate values only once during first call or if center position changed */ |
38 | 1838 { |
1839 for(int i=0;i<360;i++) | |
1840 { | |
1841 fCos = cos(i * piMult); | |
1842 fSin = sin(i * piMult); | |
1843 for(int j=0;j<4;j++) | |
1844 { | |
496 | 1845 r[j][i].x = center.x + (int)(fSin * radius[j]); |
1846 r[j][i].y = center.y + (int)(fCos * radius[j]); | |
38 | 1847 } |
1848 } | |
496 | 1849 forcenter.x = center.x; |
1850 forcenter.y = center.y; | |
38 | 1851 } |
1852 if(id > 3) id = 0; | |
1853 if(degree > 359) degree = 0; | |
1854 return r[id][degree]; | |
1855 } | |
1856 | |
1857 | |
496 | 1858 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading) |
38 | 1859 { |
496 | 1860 uint8_t loop = 0; |
38 | 1861 uint16_t LineHeading; |
496 | 1862 |
38 | 1863 static int32_t LastHeading = 0; |
1864 int32_t newHeading = 0; | |
1865 int32_t diff = 0; | |
1866 int32_t diff2 = 0; | |
1867 | |
1868 int32_t diffAbs = 0; | |
1869 int32_t diffAbs2 = 0; | |
1870 | |
1871 newHeading = ActualHeading; | |
1872 | |
1873 diff = newHeading - LastHeading; | |
1874 | |
1875 if(newHeading < LastHeading) | |
1876 diff2 = newHeading + 360 - LastHeading; | |
1877 else | |
1878 diff2 = newHeading - 360 - LastHeading; | |
1879 | |
1880 diffAbs = diff; | |
1881 if(diffAbs < 0) | |
1882 diffAbs *= -1; | |
1883 | |
1884 diffAbs2 = diff2; | |
1885 if(diffAbs2 < 0) | |
1886 diffAbs2 *= -1; | |
1887 | |
1888 if(diffAbs <= diffAbs2) | |
1889 newHeading = LastHeading + (diff / 2); | |
1890 else | |
1891 newHeading = LastHeading + (diff2 / 2); | |
1892 | |
1893 if(newHeading < 0) | |
1894 newHeading += 360; | |
1895 else | |
1896 if(newHeading >= 360) | |
1897 newHeading -= 360; | |
1898 | |
1899 LastHeading = newHeading; | |
1900 ActualHeading = newHeading; | |
1901 | |
1902 if (ActualHeading < 90) | |
1903 ActualHeading += 360; | |
1904 | |
1905 while(ActualHeading > 359) ActualHeading -= 360; | |
1906 | |
1907 LineHeading = 360 - ActualHeading; | |
496 | 1908 |
1909 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font030); // North | |
38 | 1910 LineHeading += 90; |
496 | 1911 |
1912 for (loop = 0; loop < 3; loop++) | |
1913 { | |
1914 if(LineHeading > 359) LineHeading -= 360; | |
1915 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Main Ticks | |
1916 LineHeading += 90; | |
1917 } | |
38 | 1918 |
1919 LineHeading = 360 - ActualHeading; | |
1920 LineHeading += 45; | |
496 | 1921 |
1922 for (loop = 0; loop < 4; loop++) | |
1923 { | |
1924 if(LineHeading > 359) LineHeading -= 360; | |
1925 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1926 LineHeading += 90; | |
1927 } | |
38 | 1928 |
1929 LineHeading = 360 - ActualHeading; | |
1930 LineHeading += 22; | |
496 | 1931 for (loop = 0; loop < 8; loop++) |
1932 { | |
1933 if(LineHeading > 359) LineHeading -= 360; | |
1934 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1935 LineHeading += 45; | |
1936 } | |
38 | 1937 if(UserSetHeading) |
1938 { | |
1939 LineHeading = UserSetHeading + 360 - ActualHeading; | |
1940 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1941 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserHeadingTick); |
38 | 1942 |
1943 // R�ckpeilung, User Back Heading | |
1944 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
1945 if(LineHeading > 359) LineHeading -= 360; | |
1946 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1947 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserBackHeadingTick); |
38 | 1948 } |
1949 | |
1950 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); | |
1951 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); | |
1952 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); | |
1953 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1954 |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1955 uint8_t t3_GetEnabled_customviews() |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1956 { |
496 | 1957 uint8_t *pViews; |
1958 uint8_t increment = 1; | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1959 uint8_t enabledViewCnt = 0; |
496 | 1960 |
837 | 1961 pViews = (uint8_t*)cv_changelist_BS; |
496 | 1962 while((*pViews != CVIEW_T3_END)) |
1963 { | |
1964 increment = 1; | |
1965 /* check if view is enabled */ | |
1966 if(t3_customview_disabled(*pViews)) | |
1967 { | |
1968 increment = 0; | |
1969 } | |
1970 pViews++; | |
1971 enabledViewCnt += increment; | |
1972 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1973 return enabledViewCnt; |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1974 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1975 |
518 | 1976 uint8_t t3_getCustomView(void) |
1977 { | |
1978 return t3_selection_customview; | |
1979 } | |
758
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1980 |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1981 int printScrubberText(char *text, size_t size, SSettings *settings) |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1982 { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1983 int16_t currentTimerMinutes = settings->scrubberData[settings->scubberActiveId].TimerCur; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1984 char colour = '\020'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1985 if (currentTimerMinutes <= 0) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1986 colour = '\025'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1987 } else if (currentTimerMinutes <= 30) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1988 colour = '\024'; |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1989 } |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1990 |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1991 if (settings->scrubTimerMode == SCRUB_TIMER_MINUTES || currentTimerMinutes < 0) { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1992 return snprintf(text, size, "%c%3i'", colour, currentTimerMinutes); |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1993 } else { |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1994 return snprintf(text, size, "%c%u\016\016%%\017", colour, currentTimerMinutes * 100 / settingsGetPointer()->scrubberData[settings->scubberActiveId].TimerMax); |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1995 } |
b6d8a6fbf4fd
- Colours for scrubber display when time remaining falls below a threshold value
heinrichsweikamp
parents:
755
diff
changeset
|
1996 } |
838 | 1997 |
841 | 1998 void t3_AF_updateBorderConditions() |
1999 { | |
2000 uint16_t nextstopLengthSeconds = 0; | |
2001 uint8_t nextstopDepthMeter = 0; | |
2002 | |
2003 tHome_findNextStop(getDecoInfo()->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
2004 AF_lastDecoDepth = nextstopDepthMeter; | |
2005 AF_lastTTS = (getDecoInfo()->output_time_to_surface_seconds / 60) / 10; | |
2006 } | |
2007 | |
2008 uint8_t t3_CheckAfCondition(uint8_t T3CView) | |
838 | 2009 { |
841 | 2010 uint8_t retVal = 0; |
2011 | |
2012 float pitch = stateRealGetPointer()->lifeData.compass_pitch; | |
2013 float roll = stateRealGetPointer()->lifeData.compass_roll; | |
2014 | |
2015 uint16_t nextstopLengthSeconds = 0; | |
2016 uint8_t nextstopDepthMeter = 0; | |
2017 | |
2018 switch (T3CView) | |
2019 { | |
2020 case CVIEW_T3_GasList: retVal = (stateUsed->warnings.betterGas) /* switch if better gas is available or depending on ppo2 if in OC mode */ | |
2021 || ((stateUsed->diveSettings.diveMode == DIVEMODE_OC) && ((stateUsed->warnings.ppO2Low) || (stateUsed->warnings.ppO2High))); | |
2022 | |
2023 break; | |
2024 case CVIEW_T3_Navigation: retVal = (pitch > -AF_COMPASS_ACTIVATION_ANGLE) && (pitch < AF_COMPASS_ACTIVATION_ANGLE) | |
2025 && (roll > -AF_COMPASS_ACTIVATION_ANGLE) && (roll < AF_COMPASS_ACTIVATION_ANGLE); | |
2026 | |
2027 break; | |
2028 case CVIEW_T3_DecoTTS: tHome_findNextStop(getDecoInfo()->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
2029 /* A new deco step is added to the plan */ | |
2030 if(nextstopDepthMeter > AF_lastDecoDepth) | |
2031 { | |
2032 retVal = 1; | |
2033 } | |
838 | 2034 |
841 | 2035 /* Close to the next deco step or missed deco step */ |
2036 if((abs(stateUsed->lifeData.depth_meter - nextstopDepthMeter) < 2) || (stateUsed->warnings.decoMissed)) | |
2037 { | |
2038 retVal = 1; | |
2039 } | |
2040 /* Another 10 minutes to surface */ | |
2041 if((getDecoInfo()->output_time_to_surface_seconds) && ((uint16_t)((getDecoInfo()->output_time_to_surface_seconds / 60) / 10) > AF_lastTTS)) | |
2042 { | |
2043 retVal = 1; | |
2044 } | |
2045 break; | |
2046 default: break; | |
2047 } | |
2048 | |
2049 return retVal; | |
2050 } | |
2051 | |
2052 uint8_t t3_EvaluateAFCondition(uint8_t T3CView) | |
2053 { | |
2054 static uint8_t debounce[CVIEW_T3_END]; | |
2055 static uint8_t lastState[CVIEW_T3_END]; | |
2056 uint8_t detectionState = AF_VIEW_NOCHANGE; | |
2057 uint8_t cnt = 0; | |
2058 | |
2059 if(T3CView <= CVIEW_T3_END) | |
838 | 2060 { |
841 | 2061 if(T3CView == CVIEW_T3_END) |
838 | 2062 { |
841 | 2063 for(cnt = 0; cnt < CVIEW_T3_END; cnt++) |
2064 { | |
2065 debounce[cnt] = 0; | |
2066 lastState[cnt] = AF_VIEW_NOCHANGE; | |
2067 } | |
2068 } | |
2069 if(t3_CheckAfCondition(T3CView)) | |
2070 { | |
2071 if(debounce[T3CView] < 10) | |
2072 { | |
2073 debounce[T3CView]++; | |
2074 } | |
2075 else | |
2076 { | |
2077 detectionState = AF_VIEW_ACTIVATED; | |
2078 } | |
838 | 2079 } |
2080 else | |
2081 { | |
841 | 2082 if(debounce[T3CView] > 0) |
2083 { | |
2084 debounce[T3CView]--; | |
2085 } | |
2086 else | |
2087 { | |
2088 detectionState = AF_VIEW_DEACTIVATED; | |
2089 } | |
2090 } | |
2091 if(detectionState) /* no state change => return 0 */ | |
2092 { | |
2093 if((detectionState == lastState[T3CView])) | |
2094 { | |
2095 detectionState = AF_VIEW_NOCHANGE; | |
2096 } | |
2097 else | |
2098 { | |
2099 lastState[T3CView] = detectionState; | |
2100 } | |
838 | 2101 } |
2102 } | |
2103 return detectionState; | |
2104 } | |
2105 | |
835 | 2106 void t3_handleAutofocus(void) |
2107 { | |
2108 static uint8_t returnView = CVIEW_T3_END; | |
2109 | |
841 | 2110 uint8_t runningT3CView = 0; |
835 | 2111 |
841 | 2112 for (runningT3CView = 0; runningT3CView < CVIEW_T3_END; runningT3CView++) |
838 | 2113 { |
841 | 2114 if(stateUsed->diveSettings.activeAFViews & (1 << runningT3CView)) |
838 | 2115 { |
841 | 2116 switch(t3_EvaluateAFCondition(runningT3CView)) |
2117 { | |
2118 case AF_VIEW_ACTIVATED: returnView = t3_selection_customview; | |
2119 t3_select_customview(runningT3CView); | |
2120 t3_AF_updateBorderConditions(); | |
2121 break; | |
2122 case AF_VIEW_DEACTIVATED: if((returnView != CVIEW_T3_END) && (t3_selection_customview == runningT3CView)) | |
2123 { | |
2124 if(runningT3CView != CVIEW_T3_DecoTTS) /* some view does not switch back */ | |
2125 { | |
2126 t3_select_customview(returnView); | |
2127 } | |
2128 returnView = CVIEW_T3_END; | |
2129 } | |
2130 break; | |
2131 default: | |
2132 break; | |
2133 } | |
838 | 2134 } |
2135 } | |
835 | 2136 } |