Mercurial > public > ostc4
annotate Discovery/Src/t3.c @ 574:01ee21dd311f
Improved focus detection:
In previous version th calibration window was turned into the current one. At all two translations were used causing a jitter. Now the current view is translated into the calibration windows by one step increasing the quality of the prediction.
Reworked detection of pitch/sector/scroll events:
Sector and scroll uses pitch angles to calculate the view to show. Movment detection uses movment, which may also be out of focus for a short time. To improve all detections these two use cases are now handled individual. Sector and scroll have increased action angle in case yaw and roll stay stable.
author | Ideenmodellierer |
---|---|
date | Wed, 25 Nov 2020 20:26:01 +0100 |
parents | 5e0a75e2f00b |
children | 9bb9a52d6ae5 |
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 ------------------------------------------------------------------*/ | |
30 #include "t3.h" | |
31 | |
32 #include "data_exchange_main.h" | |
33 #include "decom.h" | |
34 #include "gfx_fonts.h" | |
35 #include "math.h" | |
36 #include "tHome.h" | |
37 #include "timer.h" | |
38 #include "unit.h" | |
553 | 39 #include "motion.h" |
38 | 40 |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
41 //* Imported function prototypes ---------------------------------------------*/ |
38 | 42 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); |
43 | |
44 /* Exported variables --------------------------------------------------------*/ | |
45 | |
46 const uint16_t BigFontSeperationLeftRight = 399; | |
47 const uint16_t BigFontSeperationTopBottom = 240; | |
48 | |
49 /* Private variables ---------------------------------------------------------*/ | |
50 GFX_DrawCfgScreen t3screen; | |
51 GFX_DrawCfgWindow t3l1; | |
52 GFX_DrawCfgWindow t3r1; | |
53 GFX_DrawCfgWindow t3c1; | |
54 GFX_DrawCfgWindow t3c2; | |
55 | |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
56 uint8_t t3_selection_customview = CVIEW_noneOrDebug; |
38 | 57 |
58 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/ | |
59 | |
60 /* Private types -------------------------------------------------------------*/ | |
61 #define TEXTSIZE 16 | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
62 #define NUMBER_OF_VIEWS 7 /* number of views defined in the array below */ |
38 | 63 |
64 const uint8_t t3_customviewsStandard[] = | |
65 { | |
66 CVIEW_T3_Decostop, | |
67 CVIEW_sensors, | |
68 CVIEW_Compass, | |
69 CVIEW_T3_MaxDepth, | |
70 CVIEW_T3_StopWatch, | |
71 CVIEW_T3_TTS, | |
72 CVIEW_T3_ppO2andGas, | |
518 | 73 CVIEW_T3_GasList, |
511 | 74 CVIEW_T3_Navigation, |
75 CVIEW_T3_DepthData, | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
76 CVIEW_noneOrDebug, |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
77 CVIEW_T3_DecoTTS, |
38 | 78 CVIEW_T3_END |
79 }; | |
80 | |
81 /* Private function prototypes -----------------------------------------------*/ | |
82 void t3_refresh_divemode(void); | |
83 | |
84 uint8_t t3_test_customview_warnings(void); | |
85 void t3_refresh_customview(float depth); | |
496 | 86 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading); |
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 |
496 | 95 t3_selection_customview = t3_customviewsStandard[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; |
166 } | |
167 | |
168 | |
169 void t3_refresh(void) | |
170 { | |
496 | 171 static uint8_t last_mode = MODE_SURFACE; |
172 | |
38 | 173 SStateList status; |
174 get_globalStateList(&status); | |
175 | |
176 if(stateUsed->mode != MODE_DIVE) | |
177 { | |
178 settingsGetPointer()->design = 7; | |
179 return; | |
180 } | |
181 | |
182 if(status.base != BaseHome) | |
183 return; | |
184 | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
185 if(last_mode != MODE_DIVE) /* Select custom view */ |
496 | 186 { |
187 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
188 { | |
189 t3_selection_customview = CVIEW_noneOrDebug; | |
190 } | |
191 else | |
192 { | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
193 t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF; |
496 | 194 } |
195 t3_change_customview(ACTION_END); | |
196 } | |
38 | 197 t3screen.FBStartAdress = getFrame(24); |
198 t3_refresh_divemode(); | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
138
diff
changeset
|
199 GFX_SetFramesTopBottom(t3screen.FBStartAdress, 0,480); |
38 | 200 releaseAllFramesExcept(24,t3screen.FBStartAdress); |
496 | 201 last_mode = stateUsed->mode; |
38 | 202 } |
203 | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
204 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
|
205 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
206 if(stateUsed->mode == MODE_DIVE) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
207 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
208 t3_selection_customview = settingsGetPointer()->tX_customViewPrimaryBF; |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
209 } |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
539
diff
changeset
|
210 } |
38 | 211 |
212 /* Private functions ---------------------------------------------------------*/ | |
213 | |
214 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
215 { | |
518 | 216 char text[256]; |
217 uint8_t textPointer; | |
38 | 218 uint8_t color; |
219 uint8_t depthChangeRate; | |
220 uint8_t depthChangeAscent; | |
221 point_t start, stop, startZeroLine; | |
518 | 222 SDivetime Divetime = {0,0,0,0}; |
38 | 223 |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
224 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
225 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
226 |
38 | 227 start.x = 0; |
228 stop.x = 799; | |
229 stop.y = start.y = BigFontSeperationTopBottom; | |
553 | 230 if(viewInFocus()) |
231 { | |
232 GFX_draw_line(tXscreen, start, stop, CLUT_Font023); | |
233 } | |
234 else | |
235 { | |
236 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
237 } | |
238 | |
38 | 239 |
240 start.y = BigFontSeperationTopBottom; | |
241 stop.y = 479; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
242 |
38 | 243 stop.x = start.x = BigFontSeperationLeftRight; |
553 | 244 if(viewInFocus()) |
245 { | |
246 GFX_draw_line(tXscreen, start, stop, CLUT_Font023); | |
247 } | |
248 else | |
249 { | |
250 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); | |
251 } | |
38 | 252 |
253 /* depth */ | |
174
ecb71521d004
Bugfix: make max depth move with current depth (part 2)
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
254 float depth = unit_depth_float(stateUsed->lifeData.depth_meter); |
38 | 255 |
256 if(depth <= 0.3f) | |
257 depth = 0; | |
258 | |
259 if(settingsGetPointer()->nonMetricalSystem) | |
260 snprintf(text,TEXTSIZE,"\032\f[feet]"); | |
261 else | |
262 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Depth); | |
263 GFX_write_string(&FontT42,tXl1,text,0); | |
264 | |
265 if( ((mode == DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4 ))) | |
266 || ((mode != DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10))) | |
267 ) | |
268 { | |
269 snprintf(text,TEXTSIZE,"\f\002%.0f %c%c/min " | |
270 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min) | |
271 , unit_depth_char1() | |
272 , unit_depth_char2() | |
273 ); | |
274 GFX_write_string(&FontT42,tXl1,text,0); | |
275 } | |
276 | |
277 if( depth < 100) | |
278 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",depth); | |
279 else | |
280 snprintf(text,TEXTSIZE,"\020\003\016%01.0f",depth); | |
281 | |
282 t3_basics_colorscheme_mod(text); | |
283 GFX_write_string(&FontT105,tXl1,text,1); | |
284 | |
285 | |
286 /* ascentrate graph */ | |
287 if(mode == DIVEMODE_Apnea) | |
288 { | |
289 /* ascentrate graph - apnea mode */ | |
290 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
291 { | |
292 depthChangeAscent = 1; | |
293 if(stateUsed->lifeData.ascent_rate_meter_per_min < 200) | |
294 depthChangeRate = (uint8_t)stateUsed->lifeData.ascent_rate_meter_per_min; | |
295 else | |
296 depthChangeRate = 200; | |
297 } | |
298 else | |
299 { | |
300 depthChangeAscent = 0; | |
301 if(stateUsed->lifeData.ascent_rate_meter_per_min > -200) | |
302 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min); | |
303 else | |
304 depthChangeRate = 200; | |
305 } | |
413 | 306 |
307 if(!pSettings->FlipDisplay) | |
308 { | |
309 start.y = tXl1->WindowY0 - 1; | |
310 } | |
311 else | |
312 { | |
313 start.y = tXl1->WindowY1 + 1; | |
314 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
315 startZeroLine.y = start.y; |
38 | 316 for(int i = 0; i<5;i++) |
317 { | |
318 start.y += 40; | |
319 stop.y = start.y; | |
413 | 320 if(!pSettings->FlipDisplay) |
321 { | |
322 start.x = tXl1->WindowX1 - 1; | |
323 } | |
324 else | |
325 { | |
326 start.x = tXr1->WindowX1 - 1; | |
327 } | |
38 | 328 stop.x = start.x - 17; |
329 | |
330 if(depthChangeRate <= 6) | |
331 { | |
332 if(i == 2) | |
333 { | |
334 startZeroLine.y = start.y; | |
335 stop.x = start.x - 34; | |
336 } | |
337 } | |
338 else | |
339 { | |
340 if(((i == 1) && depthChangeAscent) || ((i == 3) && !depthChangeAscent)) | |
341 { | |
342 startZeroLine.y = start.y; | |
343 stop.x = start.x - 34; | |
344 } | |
345 } | |
346 GFX_draw_line(tXscreen, start, stop, 0); | |
347 } | |
348 // new thick bar design Sept. 2015 | |
349 if((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4)) | |
350 { | |
351 start.y = startZeroLine.y; | |
352 if(depthChangeAscent) | |
353 { | |
354 color = CLUT_EverythingOkayGreen; | |
355 start.y += 7; // starte etwas weiter oben | |
356 stop.y = start.y + (uint16_t)(depthChangeRate * 4) - 9; // - x; // wegen der Liniendicke | |
357 if(stop.y > 475) | |
358 stop.y = 475; | |
359 } | |
360 else | |
361 { | |
362 color = CLUT_Font023; | |
363 start.y -= 7; | |
364 stop.y = start.y - (uint16_t)(depthChangeRate * 4) + 9; | |
365 if(stop.y <= tXl1->WindowY0) | |
366 stop.y = tXl1->WindowY0 + 1; | |
367 } | |
413 | 368 if(!pSettings->FlipDisplay) |
369 { | |
370 start.x = tXl1->WindowX1 - 3 - 5; | |
371 } | |
372 else | |
373 { | |
374 start.x = tXr1->WindowX1 - 3 - 5; | |
375 } | |
376 | |
377 stop.x = start.x; | |
38 | 378 GFX_draw_thick_line(12,tXscreen, start, stop, color); |
379 } | |
380 } | |
381 else | |
382 { | |
383 /* ascentrate graph -standard mode */ | |
384 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
385 { | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
386 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
387 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
388 start.y = tXl1->WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
389 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
390 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
391 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
392 start.y = tXl1->WindowY1 + 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
393 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
394 |
38 | 395 for(int i = 0; i<4;i++) |
396 { | |
397 start.y += 5*8; | |
398 stop.y = start.y; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
399 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
400 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
401 start.x = tXl1->WindowX1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
402 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
403 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
404 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
405 start.x = tXr1->WindowX1 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
406 } |
38 | 407 stop.x = start.x - 17; |
408 GFX_draw_line(tXscreen, start, stop, 0); | |
409 } | |
410 // new thick bar design Sept. 2015 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
411 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
412 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
413 start.x = tXl1->WindowX1 - 3 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
414 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
415 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
416 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
417 start.x = tXr1->WindowX1 - 3 - 5; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
418 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
419 |
38 | 420 stop.x = start.x; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
421 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
422 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
423 start.y = tXl1->WindowY0 - 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
424 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
425 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
426 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
427 start.y = tXl1->WindowY1 + 1; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
428 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
429 |
38 | 430 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8); |
431 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
432 if(stop.y >= 470) | |
433 stop.y = 470; | |
434 start.y += 7; // starte etwas weiter oben | |
435 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
436 color = CLUT_EverythingOkayGreen; | |
437 else | |
438 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
439 color = CLUT_WarningYellow; | |
440 else | |
441 color = CLUT_WarningRed; | |
442 | |
443 GFX_draw_thick_line(12,tXscreen, start, stop, color); | |
444 } | |
445 } | |
446 | |
447 // divetime | |
448 if(mode == DIVEMODE_Apnea) | |
449 { | |
450 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
451 { | |
452 SDivetime SurfaceBreakTime = {0,0,0,0}; | |
453 | |
454 SurfaceBreakTime.Total = stateUsed->lifeData.counterSecondsShallowDepth; | |
455 SurfaceBreakTime.Minutes = SurfaceBreakTime.Total / 60; | |
456 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60); | |
457 | |
458 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface); | |
459 GFX_write_string(&FontT42,tXr1,text,0); | |
460 | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
461 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); |
38 | 462 } |
463 else | |
464 { | |
465 Divetime.Total = stateUsed->lifeData.dive_time_seconds; | |
466 Divetime.Minutes = Divetime.Total / 60; | |
467 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
468 | |
469 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
470 GFX_write_string(&FontT42,tXr1,text,0); | |
471 | |
472 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
473 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
38 | 474 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
475 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
38 | 476 } |
518 | 477 t3_basics_colorscheme_mod(text); |
478 GFX_write_string(&FontT105,tXr1,text,1); | |
38 | 479 } |
480 else | |
481 { | |
518 | 482 switch(get_globalState()) |
483 { | |
484 case StDBEAR: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveBearingQ); | |
485 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
486 break; | |
487 case StDRAVG: snprintf(text,TEXTSIZE,"\a\003\001%c%c", TXT_2BYTE, TXT2BYTE_DiveResetAvgQ); | |
488 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
489 break; | |
38 | 490 |
518 | 491 case StDMGAS: |
492 textPointer = 0; | |
493 text[textPointer++] = '\a'; | |
494 text[textPointer++] = '\001'; | |
495 text[textPointer++] = ' '; | |
496 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&text[textPointer]); | |
497 text[textPointer++] = '?'; | |
498 text[textPointer++] = ' '; | |
499 text[textPointer++] = 0; | |
500 GFX_write_string_color(&FontT42,tXr1,text,1,CLUT_WarningYellow); | |
501 break; | |
502 default: /* show divetime */ | |
38 | 503 |
518 | 504 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; |
505 Divetime.Minutes = Divetime.Total / 60; | |
506 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
507 | |
508 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
509 GFX_write_string(&FontT42,tXr1,text,0); | |
510 | |
511 if(Divetime.Minutes < 100) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
512 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds); |
518 | 513 else |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
514 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes); |
518 | 515 |
516 t3_basics_colorscheme_mod(text); | |
517 GFX_write_string(&FontT105,tXr1,text,1); | |
518 break; | |
519 } | |
38 | 520 } |
521 | |
522 return depth; | |
523 } | |
524 | |
525 | |
526 void t3_refresh_divemode(void) | |
527 { | |
528 uint8_t customview_warnings = 0; | |
529 float depth_meter = 0.0; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
530 |
38 | 531 // everything like lines, depth, ascent graph and divetime |
532 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials | |
533 | |
534 // customview | |
535 if(stateUsed->warnings.numWarnings) | |
536 customview_warnings = t3_test_customview_warnings(); | |
537 | |
538 if(customview_warnings && warning_count_high_time) | |
539 t3_basics_show_customview_warnings(&t3c1); | |
540 else | |
541 t3_refresh_customview(depth_meter); | |
542 | |
543 if(stateUsed->warnings.lowBattery) | |
496 | 544 t3_basics_battery_low_customview_extra(&t3r1); //t3c1); |
38 | 545 } |
546 | |
547 | |
548 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1) | |
549 { | |
550 char TextC1[256]; | |
551 | |
496 | 552 TextC1[0] = ' ';//'\002'; |
38 | 553 TextC1[1] = '\f'; |
554 TextC1[2] = '\025'; | |
555 TextC1[3] = '3'; | |
556 TextC1[4] = '1'; | |
557 TextC1[5] = '1'; | |
558 TextC1[6] = '1'; | |
559 TextC1[7] = '1'; | |
560 TextC1[8] = '1'; | |
561 TextC1[9] = '1'; | |
562 TextC1[10] = '1'; | |
563 TextC1[11] = '1'; | |
564 TextC1[12] = '1'; | |
565 TextC1[13] = '1'; | |
566 TextC1[14] = '0'; | |
567 TextC1[15] = 0; | |
568 | |
569 if(!warning_count_high_time) | |
570 TextC1[4] = '2'; | |
571 | |
572 GFX_write_string(&Batt24,tXc1,TextC1,0); | |
573 } | |
574 | |
575 | |
576 | |
577 void t3_refresh_customview(float depth) | |
578 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
237
diff
changeset
|
579 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, stateUsedWrite->diveSettings.diveMode); |
38 | 580 } |
581 | |
582 | |
583 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
584 { | |
585 char text[512]; | |
586 uint16_t textpointer = 0; | |
587 | |
588 // CVIEW_T3_Temperature | |
589 float temperature; | |
413 | 590 SSettings* pSettings; |
591 pSettings = settingsGetPointer(); | |
38 | 592 |
593 SDivetime TotalDivetime = {0,0,0,0}; | |
594 SDivetime LastDivetime = {0,0,0,0}; | |
595 | |
596 uint16_t tempWinX0; | |
413 | 597 uint16_t tempWinX1; |
38 | 598 uint16_t tempWinY0; |
413 | 599 uint16_t tempWinY1; |
38 | 600 |
601 tempWinX0 = tXc1->WindowX0; | |
413 | 602 tempWinX1 = tXc1->WindowX1; |
38 | 603 tempWinY0 = tXc1->WindowY0; |
413 | 604 tempWinY1 = tXc1->WindowY1; |
38 | 605 |
606 tXc1->WindowX0 = 440; // rechte Seite | |
607 | |
608 switch(tX_selection_customview) | |
609 { | |
610 case CVIEW_T3_Temperature: | |
611 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
612 GFX_write_string(&FontT42,tXc1,text,0); | |
613 | |
189
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
614 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 615 textpointer = snprintf(text,TEXTSIZE,"\020\003\016%01.0f\016\016\140",temperature); // "\016\016%01.1f `" + C or F |
616 if(settingsGetPointer()->nonMetricalSystem == 0) | |
617 text[textpointer++] = 'C'; | |
618 else | |
619 text[textpointer++] = 'F'; | |
620 text[textpointer++] = 0; | |
621 t3_basics_colorscheme_mod(text); | |
622 GFX_write_string(&FontT105,tXc1,text,1); | |
623 break; | |
624 | |
625 case CVIEW_T3_ApnoeSurfaceInfo: | |
626 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Divetime); | |
627 GFX_write_string(&FontT42,tXc1,text,0); | |
628 | |
629 TotalDivetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; | |
630 TotalDivetime.Minutes = TotalDivetime.Total / 60; | |
631 TotalDivetime.Seconds = TotalDivetime.Total - ( TotalDivetime.Minutes * 60 ); | |
632 | |
633 LastDivetime.Total = stateUsed->lifeData.apnea_last_dive_time_seconds; | |
634 LastDivetime.Minutes = LastDivetime.Total / 60; | |
635 LastDivetime.Seconds = LastDivetime.Total - ( LastDivetime.Minutes * 60 ); | |
636 | |
413 | 637 // tXc1->WindowY0 = 100; // obere Zeile |
638 if(!pSettings->FlipDisplay) | |
639 { | |
640 tXc1->WindowY0 = 100; | |
641 } | |
642 else | |
643 { | |
644 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ | |
645 } | |
38 | 646 |
647 snprintf(text,TEXTSIZE,"\020\016%u:%02u",LastDivetime.Minutes, LastDivetime.Seconds); | |
648 t3_basics_colorscheme_mod(text); | |
649 GFX_write_string(&FontT105,tXc1,text,0); | |
650 | |
413 | 651 if(pSettings->FlipDisplay) |
652 { | |
653 tXc1->WindowX0 = 0; | |
654 | |
655 } | |
38 | 656 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaLast); |
657 GFX_write_string(&FontT42,tXc1,text,0); | |
658 | |
413 | 659 if(!pSettings->FlipDisplay) |
660 { | |
661 tXc1->WindowY0 = tempWinY0; | |
662 } | |
663 else | |
664 { | |
665 tXc1->WindowX1 = tempWinX1; | |
666 tXc1->WindowY1 = tempWinY1; /* jump to upper of two lines */ | |
667 } | |
38 | 668 |
669 snprintf(text,TEXTSIZE,"\020\016%u:%02u",TotalDivetime.Minutes, TotalDivetime.Seconds); | |
670 t3_basics_colorscheme_mod(text); | |
671 GFX_write_string(&FontT105,tXc1,text,0); | |
672 | |
673 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaTotal); | |
413 | 674 if(pSettings->FlipDisplay) |
675 { | |
676 tXc1->WindowX0 = 0; | |
677 | |
678 } | |
38 | 679 GFX_write_string(&FontT42,tXc1,text,0); |
680 break; | |
681 } | |
682 | |
683 tXc1->WindowX0 = tempWinX0; | |
413 | 684 tXc1->WindowX1 = tempWinX1; |
38 | 685 tXc1->WindowY0 = tempWinY0; |
686 | |
687 } | |
688 | |
689 | |
690 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) | |
691 { | |
692 char text[512]; | |
693 uint16_t textpointer = 0; | |
694 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
695 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
696 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
697 |
38 | 698 // CVIEW_T3_Decostop and CVIEW_T3_TTS |
699 const SDecoinfo * pDecoinfo; | |
700 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
701 pDecoinfo = &stateUsed->decolistBuehlmann; | |
702 else | |
703 pDecoinfo = &stateUsed->decolistVPM; | |
704 | |
705 // CVIEW_T3_Decostop | |
706 uint16_t nextstopLengthSeconds = 0; | |
707 uint8_t nextstopDepthMeter = 0; | |
708 SDivetime SafetyStopTime = {0,0,0,0}; | |
709 | |
710 // CVIEW_T3_ppO2andGas | |
711 uint8_t oxygen_percentage = 0; | |
712 | |
713 // CVIEW_T3_Temperature | |
714 float temperature; | |
715 | |
716 // CVIEW_T3_GasList | |
717 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; | |
718 const SGasLine * pGasLine; | |
719 uint8_t oxygen, helium; | |
720 uint8_t lineNumber; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
721 uint8_t gasPosIdx; |
38 | 722 |
496 | 723 /* compass position */ |
724 point_t center; | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
725 uint16_t heading; |
496 | 726 |
38 | 727 // CVIEW_T3_StopWatch |
728 SDivetime Stopwatch = {0,0,0,0}; | |
729 float fAverageDepth, fAverageDepthAbsolute; | |
730 | |
731 uint16_t tempWinX0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
732 uint16_t tempWinX1; |
38 | 733 uint16_t tempWinY0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
734 uint16_t tempWinY1; |
38 | 735 uint16_t tempWinC2X0; |
413 | 736 uint16_t tempWinC2Y0; |
737 uint16_t tempWinC2X1; | |
738 uint16_t tempWinC2Y1; | |
38 | 739 uint16_t tempWinC2Tab; |
740 | |
741 tempWinX0 = tXc1->WindowX0; | |
742 tempWinY0 = tXc1->WindowY0; | |
496 | 743 tempWinX1 = tXc1->WindowX1; |
744 tempWinY1 = tXc1->WindowY1; | |
413 | 745 |
38 | 746 tempWinC2X0 = tXc2->WindowX0; |
413 | 747 tempWinC2Y0 = tXc2->WindowY0; |
748 tempWinC2X1 = tXc2->WindowX1; | |
749 tempWinC2Y1 = tXc2->WindowY1; | |
38 | 750 tempWinC2Tab = tXc2->WindowTab; |
751 | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
752 if(settingsGetPointer()->compassInertia) |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
753 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
754 heading = (uint16_t)compass_getCompensated(); |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
755 } |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
756 else |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
757 { |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
758 heading = (uint16_t)stateUsed->lifeData.compass_heading; |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
759 } |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
760 |
38 | 761 switch(tX_selection_customview) |
762 { | |
763 case CVIEW_T3_ApnoeSurfaceInfo: | |
764 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
765 | |
413 | 766 if(!pSettings->FlipDisplay) |
767 { | |
768 GFX_write_string(&FontT42,tXc1,text,0); | |
769 tXc1->WindowY0 = 100; | |
770 } | |
771 else | |
772 { | |
773 GFX_write_string(&FontT42,tXc2,text,0); | |
774 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
775 } | |
38 | 776 |
777 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_last_max_depth_meter)); | |
778 t3_basics_colorscheme_mod(text); | |
413 | 779 |
780 if(!pSettings->FlipDisplay) | |
781 { | |
782 GFX_write_string(&FontT105,tXc1,text,0); | |
783 tXc1->WindowY0 = tempWinY0; | |
784 } | |
785 else | |
786 { | |
787 GFX_write_string(&FontT105,tXc2,text,0); | |
788 tXc2->WindowY1 = tempWinC2Y1; /* jump to upper of two lines */ | |
789 } | |
38 | 790 |
791 | |
792 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_total_max_depth_meter)); | |
793 t3_basics_colorscheme_mod(text); | |
413 | 794 if(!pSettings->FlipDisplay) |
795 { | |
796 GFX_write_string(&FontT105,tXc1,text,0); | |
797 } | |
798 else | |
799 { | |
800 GFX_write_string(&FontT105,tXc2,text,0); | |
801 } | |
38 | 802 break; |
803 | |
804 case CVIEW_T3_StopWatch: | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
805 |
38 | 806 Stopwatch.Total = timer_Stopwatch_GetTime(); |
807 Stopwatch.Minutes = Stopwatch.Total / 60; | |
808 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
809 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
810 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
811 | |
812 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); | |
813 GFX_write_string(&FontT42,tXc1,text,0); | |
814 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); | |
815 GFX_write_string(&FontT105,tXc1,text,0); | |
816 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
817 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
818 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
819 tXc1->WindowX0 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
820 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
821 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
822 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
823 tXc1->WindowX1 = 320; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
824 tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
825 } |
38 | 826 // 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
|
827 |
38 | 828 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch); |
829 GFX_write_string(&FontT42,tXc1,text,0); | |
830 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); | |
831 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
832 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
833 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
834 tXc1->WindowY0 = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
835 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
836 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
837 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
838 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
839 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
840 |
38 | 841 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); |
842 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
843 |
496 | 844 break; |
38 | 845 |
846 case CVIEW_T3_GasList: | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
847 gasPosIdx = 0; |
38 | 848 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); |
849 GFX_write_string(&FontT42,tXc1,text,0); | |
850 | |
851 textpointer = 0; | |
852 tXc2->WindowX0 = 0; | |
518 | 853 tXc2->WindowTab = 800/3; // /2 |
38 | 854 |
413 | 855 if(pSettings->FlipDisplay) |
856 { | |
857 tXc2->WindowY1 = 0; | |
858 } | |
859 | |
38 | 860 pGasLine = settingsGetPointer()->gas; |
861 if(actualLeftMaxDepth(stateUsed)) | |
862 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
863 else | |
864 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
865 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
866 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
867 { | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
868 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
869 if(!pGasLine[gasId].note.ub.off) |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
870 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
871 #endif |
38 | 872 textpointer = 0; |
518 | 873 text[textpointer++] = '\003'; |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
874 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
875 lineNumber = 1; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
876 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
877 switch(gasPosIdx) |
38 | 878 { |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
879 case 0: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
880 case 1: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
881 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
882 case 4: text[textpointer++] = '\001'; /* display centered */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
883 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
884 case 2: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
885 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
|
886 default: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
887 break; |
38 | 888 } |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
889 gasPosIdx++; |
518 | 890 |
38 | 891 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; |
892 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
|
893 strcpy(&text[textpointer++],"\031"); |
518 | 894 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ |
895 { | |
896 strcpy(&text[textpointer++],"\030"); | |
897 } | |
38 | 898 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) |
899 strcpy(&text[textpointer++],"\025"); | |
518 | 900 else if(actualBetterGasId() == gasId) |
901 { | |
902 strcpy(&text[textpointer++],"\026"); /* Highlight better gas */ | |
903 } | |
38 | 904 else |
518 | 905 strcpy(&text[textpointer++],"\023"); /* Blue for travel or deco without special state */ |
38 | 906 |
907 text[textpointer++] = ' '; | |
908 oxygen = pGasLine[gasId].oxygen_percentage; | |
909 helium = pGasLine[gasId].helium_percentage; | |
910 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
|
911 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
912 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
|
913 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
914 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
|
915 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
916 text[textpointer++] = 0; |
518 | 917 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
|
918 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
919 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
920 #endif |
38 | 921 } |
922 break; | |
923 | |
924 case CVIEW_T3_Temperature: | |
925 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
926 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
|
927 |
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
928 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 929 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F |
930 if(settingsGetPointer()->nonMetricalSystem == 0) | |
931 text[textpointer++] = 'C'; | |
932 else | |
933 text[textpointer++] = 'F'; | |
934 text[textpointer++] = 0; | |
935 GFX_write_string(&FontT105,tXc1,text,0); | |
936 break; | |
937 | |
938 case CVIEW_Compass: | |
496 | 939 center.x = 600; |
940 center.y = 116; | |
38 | 941 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); |
942 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
943 snprintf(text,100,"\030\003%03i`",heading); |
38 | 944 GFX_write_string(&FontT105,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
945 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
38 | 946 break; |
947 | |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
948 case CVIEW_T3_DecoTTS: |
38 | 949 case CVIEW_T3_Decostop: |
950 default: | |
951 // decostop | |
952 if(pDecoinfo->output_time_to_surface_seconds) | |
953 { | |
954 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
955 } | |
956 else | |
957 { | |
958 nextstopDepthMeter = 0; | |
959 nextstopLengthSeconds = 0; | |
960 } | |
961 | |
962 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
963 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
964 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
965 | |
966 if(nextstopDepthMeter) | |
967 { | |
968 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Decostop); | |
969 GFX_write_string(&FontT42,tXc1,text,0); | |
970 | |
971 textpointer = 0; | |
972 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
|
973 , unit_depth_integer(nextstopDepthMeter) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
974 , unit_depth_char1_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
975 , unit_depth_char2_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
976 , (nextstopLengthSeconds+59)/60); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
977 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
978 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 979 } |
980 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
981 { | |
982 textpointer = 0; | |
983 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
984 GFX_write_string(&FontT42,tXc1,text,0); | |
985 | |
986 textpointer = 0; | |
987 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
988 t3_basics_colorscheme_mod(text); | |
496 | 989 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 990 } |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
991 else if(pDecoinfo->output_ndl_seconds) // NDL |
38 | 992 { |
993 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit); | |
994 GFX_write_string(&FontT42,tXc1,text,0); | |
995 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
996 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60); | |
997 else | |
998 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600); | |
999 t3_basics_colorscheme_mod(text); | |
496 | 1000 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1001 } |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1002 |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1003 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
|
1004 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1005 snprintf(text,TEXTSIZE,"\002\032\f%c",TXT_TTS); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1006 GFX_write_string(&FontT42,tXc1,text,0); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1007 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
|
1008 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1009 if(pDecoinfo->output_time_to_surface_seconds < 100 * 60) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1010 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1011 else |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1012 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1013 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1014 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
|
1015 } |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1016 } |
38 | 1017 break; |
1018 | |
1019 case CVIEW_sensors: | |
1020 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); | |
1021 GFX_write_string(&FontT42,tXc1,text,0); | |
1022 | |
1023 for(int i=0;i<3;i++) | |
1024 { | |
1025 textpointer = 0; | |
1026 text[textpointer++] = '\030'; | |
1027 if(i==1) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1028 text[textpointer++] = '\001'; /* center */ |
38 | 1029 else if(i==2) |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1030 text[textpointer++] = '\002'; /* right */ |
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1031 |
38 | 1032 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) |
1033 { | |
1034 text[textpointer++] = '\031'; | |
1035 text[textpointer++] = ' '; | |
1036 text[textpointer++] = '-'; | |
1037 text[textpointer++] = ' '; | |
1038 } | |
1039 else | |
1040 { | |
1041 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1042 text[textpointer++] = '\025'; | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1043 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppO2Sensor_bar[i]); |
38 | 1044 } |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1045 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1046 } |
1047 break; | |
1048 | |
1049 case CVIEW_T3_MaxDepth: | |
1050 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
413 | 1051 if(pSettings->FlipDisplay) |
1052 { | |
1053 if(mode == DIVEMODE_Apnea) | |
1054 { | |
1055 GFX_write_string(&FontT42,tXc2,text,0); | |
1056 } | |
1057 else | |
1058 { | |
1059 GFX_write_string(&FontT42,tXc1,text,0); | |
1060 } | |
1061 } | |
1062 else | |
1063 { | |
1064 GFX_write_string(&FontT42,tXc1,text,0); | |
1065 } | |
38 | 1066 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); |
1067 t3_basics_colorscheme_mod(text); | |
413 | 1068 if(pSettings->FlipDisplay) |
1069 { | |
1070 if(mode == DIVEMODE_Apnea) | |
1071 { | |
1072 GFX_write_string(&FontT105,tXc2,text,0); | |
1073 } | |
1074 else | |
1075 { | |
1076 GFX_write_string(&FontT105,tXc1,text,0); | |
1077 } | |
1078 } | |
1079 else | |
1080 { | |
496 | 1081 GFX_write_string(&FontT105,tXc1,text,0); |
413 | 1082 } |
38 | 1083 break; |
1084 | |
1085 case CVIEW_T3_TTS: | |
1086 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); | |
1087 GFX_write_string(&FontT42,tXc1,text,0); | |
1088 if(pDecoinfo->output_time_to_surface_seconds) | |
1089 { | |
1090 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
|
1091 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
38 | 1092 else |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1093 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
38 | 1094 t3_basics_colorscheme_mod(text); |
496 | 1095 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1096 } |
1097 break; | |
1098 | |
1099 case CVIEW_T3_ppO2andGas: | |
1100 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); | |
1101 GFX_write_string(&FontT42,tXc1,text,0); | |
1102 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); | |
1103 t3_basics_colorscheme_mod(text); | |
496 | 1104 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1105 |
1106 textpointer = 0; | |
1107 text[textpointer++] = '\020'; | |
1108 text[textpointer++] = '\003'; | |
1109 oxygen_percentage = 100; | |
1110 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
1111 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
1112 text[textpointer++] = '\002'; | |
1113 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); | |
1114 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); | |
1115 t3_basics_colorscheme_mod(text); | |
496 | 1116 GFX_write_string(&FontT48,tXc1,text,0); |
38 | 1117 break; |
496 | 1118 |
1119 case CVIEW_T3_Navigation: | |
1120 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
1121 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1122 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1123 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1124 | |
1125 if(!pSettings->FlipDisplay) | |
1126 { | |
1127 tXc2->WindowX0 = 550; | |
1128 } | |
1129 else | |
1130 { | |
1131 tXc2->WindowX1 = 800; | |
1132 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ | |
1133 } | |
1134 | |
1135 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); | |
511 | 1136 GFX_write_string(&FontT42,tXc1,text,0); |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1137 snprintf(text,TEXTSIZE,"\030\002\016%01.1f",unit_depth_float(fAverageDepth)); |
511 | 1138 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1139 if(!pSettings->FlipDisplay) |
1140 { | |
1141 tXc2->WindowY0 = 100; | |
1142 } | |
1143 else | |
1144 { | |
1145 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
1146 } | |
1147 | |
1148 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); | |
511 | 1149 GFX_write_string(&FontT105,tXc1,text,1); |
496 | 1150 |
1151 | |
1152 center.x = 400; | |
1153 center.y = 116; | |
1154 | |
1155 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1156 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1157 snprintf(text,100,"\030%03i`",heading); |
496 | 1158 GFX_write_string(&FontT144,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1159 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
496 | 1160 |
1161 break; | |
1162 | |
1163 case CVIEW_T3_DepthData: | |
1164 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
1165 if(pSettings->FlipDisplay) | |
1166 { | |
1167 if(mode == DIVEMODE_Apnea) | |
1168 { | |
1169 GFX_write_string(&FontT42,tXc2,text,0); | |
1170 } | |
1171 else | |
1172 { | |
1173 GFX_write_string(&FontT42,tXc1,text,0); | |
1174 } | |
1175 } | |
1176 else | |
1177 { | |
1178 GFX_write_string(&FontT42,tXc1,text,0); | |
1179 } | |
1180 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
1181 t3_basics_colorscheme_mod(text); | |
1182 if(pSettings->FlipDisplay) | |
1183 { | |
1184 if(mode == DIVEMODE_Apnea) | |
1185 { | |
1186 GFX_write_string(&FontT105,tXc2,text,0); | |
1187 } | |
1188 else | |
1189 { | |
1190 GFX_write_string(&FontT105,tXc1,text,0); | |
1191 } | |
1192 } | |
1193 else | |
1194 { | |
1195 GFX_write_string(&FontT105,tXc1,text,0); | |
1196 } | |
1197 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1198 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); | |
511 | 1199 GFX_write_string(&FontT42,tXc1,text,0); |
496 | 1200 |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1201 snprintf(text,TEXTSIZE,"\020\003\002\016\%01.1f",unit_depth_float(fAverageDepthAbsolute)); |
511 | 1202 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1203 break; |
38 | 1204 } |
496 | 1205 |
1206 | |
1207 | |
38 | 1208 tXc1->WindowX0 = tempWinX0; |
1209 tXc1->WindowY0 = tempWinY0; | |
496 | 1210 tXc1->WindowX1 = tempWinX1; |
1211 tXc1->WindowY1 = tempWinY1; | |
413 | 1212 |
38 | 1213 tXc2->WindowX0 = tempWinC2X0; |
413 | 1214 tXc2->WindowY0 = tempWinC2Y0; |
1215 tXc2->WindowX1 = tempWinC2X1; | |
1216 tXc2->WindowY1 = tempWinC2Y1; | |
38 | 1217 tXc2->WindowTab = tempWinC2Tab; |
1218 } | |
1219 | |
1220 | |
1221 uint8_t t3_test_customview_warnings(void) | |
1222 { | |
1223 uint8_t count = 0; | |
1224 | |
1225 count = 0; | |
1226 count += stateUsed->warnings.decoMissed; | |
1227 count += stateUsed->warnings.ppO2Low; | |
1228 count += stateUsed->warnings.ppO2High; | |
1229 //count += stateUsed->warnings.lowBattery; | |
1230 count += stateUsed->warnings.sensorLinkLost; | |
1231 count += stateUsed->warnings.fallback; | |
1232 | |
1233 return count; | |
1234 } | |
1235 | |
1236 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
1237 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1) | |
1238 { | |
1239 char text[256], textMain[256]; | |
1240 uint8_t textpointer, textpointerMain, lineFree, more; | |
1241 | |
1242 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); | |
1243 GFX_write_string(&FontT42,&t3c1,text,0); | |
1244 | |
1245 lineFree = 1; | |
1246 more = 0; | |
1247 | |
1248 textpointerMain = 0; | |
511 | 1249 textMain[textpointerMain++] = '\025'; /* red */ |
1250 textMain[textpointerMain++] = '\003'; /* doublesize */ | |
38 | 1251 |
1252 textpointer = 0; | |
1253 | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1254 text[textpointer++] = '\031'; |
38 | 1255 text[textpointer++] = TXT_2BYTE; |
1256 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
1257 if(stateUsed->warnings.decoMissed) | |
1258 { | |
1259 text[textpointer - 3] = '\025'; | |
1260 if(lineFree) | |
1261 { | |
1262 textMain[textpointerMain++] = TXT_2BYTE; | |
1263 textMain[textpointerMain++] = text[textpointer - 1]; | |
1264 textMain[textpointerMain] = 0; | |
1265 lineFree--; | |
1266 } | |
1267 else | |
1268 { | |
1269 more++; | |
1270 } | |
1271 } | |
1272 | |
1273 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1274 text[textpointer++] = '\031'; |
38 | 1275 text[textpointer++] = TXT_2BYTE; |
1276 text[textpointer++] = TXT2BYTE_WarnPPO2Low; | |
1277 if(stateUsed->warnings.ppO2Low) | |
1278 { | |
1279 text[textpointer - 3] = '\025'; | |
1280 if(lineFree) | |
1281 { | |
1282 textMain[textpointerMain++] = TXT_2BYTE; | |
1283 textMain[textpointerMain++] = text[textpointer - 1]; | |
1284 textMain[textpointerMain] = 0; | |
1285 lineFree--; | |
1286 } | |
1287 else | |
1288 { | |
1289 more++; | |
1290 } | |
1291 } | |
1292 | |
1293 text[textpointer++] = '\n'; | |
1294 text[textpointer++] = '\r'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1295 text[textpointer++] = '\031'; |
38 | 1296 text[textpointer++] = TXT_2BYTE; |
1297 text[textpointer++] = TXT2BYTE_WarnPPO2High; | |
1298 if(stateUsed->warnings.ppO2High) | |
1299 { | |
1300 text[textpointer - 3] = '\025'; | |
1301 if(lineFree) | |
1302 { | |
1303 textMain[textpointerMain++] = TXT_2BYTE; | |
1304 textMain[textpointerMain++] = text[textpointer - 1]; | |
1305 textMain[textpointerMain] = 0; | |
1306 lineFree--; | |
1307 } | |
1308 else | |
1309 { | |
1310 more++; | |
1311 } | |
1312 } | |
1313 | |
1314 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1315 text[textpointer++] = '\031'; |
38 | 1316 text[textpointer++] = TXT_2BYTE; |
1317 text[textpointer++] = TXT2BYTE_WarnFallback; | |
1318 if(stateUsed->warnings.fallback) | |
1319 { | |
1320 text[textpointer - 3] = '\025'; | |
1321 if(lineFree) | |
1322 { | |
1323 textMain[textpointerMain++] = TXT_2BYTE; | |
1324 textMain[textpointerMain++] = text[textpointer - 1]; | |
1325 textMain[textpointerMain] = 0; | |
1326 lineFree--; | |
1327 } | |
1328 else | |
1329 { | |
1330 more++; | |
1331 } | |
1332 } | |
1333 | |
1334 text[textpointer++] = '\n'; | |
1335 text[textpointer++] = '\r'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1336 text[textpointer++] = '\031'; |
38 | 1337 text[textpointer++] = TXT_2BYTE; |
1338 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; | |
1339 if(stateUsed->warnings.sensorLinkLost) | |
1340 { | |
1341 text[textpointer - 3] = '\025'; | |
1342 if(lineFree) | |
1343 { | |
1344 textMain[textpointerMain++] = TXT_2BYTE; | |
1345 textMain[textpointerMain++] = text[textpointer - 1]; | |
1346 textMain[textpointerMain] = 0; | |
1347 lineFree--; | |
1348 } | |
1349 else | |
1350 { | |
1351 more++; | |
1352 } | |
1353 } | |
1354 | |
1355 /* | |
1356 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1357 text[textpointer++] = '\031'; |
38 | 1358 text[textpointer++] = TXT_2BYTE; |
1359 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | |
1360 if(stateUsed->warnings.lowBattery) | |
1361 { | |
1362 text[textpointer - 3] = '\025'; | |
1363 if(lineFree) | |
1364 { | |
1365 textMain[textpointerMain++] = TXT_2BYTE; | |
1366 textMain[textpointerMain++] = text[textpointer - 1]; | |
1367 textMain[textpointerMain] = 0; | |
1368 lineFree--; | |
1369 } | |
1370 else | |
1371 { | |
1372 more++; | |
1373 } | |
1374 } | |
1375 */ | |
1376 text[textpointer] = 0; | |
1377 /* | |
1378 if(more) | |
1379 { | |
1380 text[textpointer++] = '\002'; | |
1381 text[textpointer++] = '+'; | |
1382 if(more < 10) | |
1383 text[textpointer++] = '0' + more; | |
1384 else | |
1385 text[textpointer++] = 'X'; | |
1386 text[textpointer] = 0; | |
1387 } | |
1388 */ | |
511 | 1389 GFX_write_string(&FontT48,&t3c1,textMain,0); |
38 | 1390 if(more) |
1391 { | |
511 | 1392 GFX_write_string(&FontT48,&t3c2,text,0); |
38 | 1393 } |
1394 } | |
1395 | |
496 | 1396 uint8_t t3_customview_disabled(uint8_t view) |
1397 { | |
1398 uint8_t i = 0; | |
1399 uint8_t cv_disabled = 0; | |
1400 const uint8_t *pcv_changelist; | |
1401 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; | |
1402 | |
511 | 1403 pcv_changelist = cv_changelist_BS; |
496 | 1404 |
1405 while(pcv_changelist[i] != CVIEW_T3_END) | |
1406 { | |
1407 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i])) | |
1408 { | |
1409 cv_disabled = 1; | |
1410 break; | |
1411 } | |
1412 i++; | |
1413 } | |
1414 | |
1415 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1416 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0))) |
496 | 1417 { |
1418 cv_disabled = 1; | |
1419 } | |
1420 | |
1421 return cv_disabled; | |
1422 } | |
38 | 1423 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1424 void t3_change_customview(uint8_t action) |
38 | 1425 { |
511 | 1426 |
496 | 1427 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); |
38 | 1428 } |
1429 | |
1430 | |
511 | 1431 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) |
38 | 1432 { |
1433 const SDecoinfo * pDecoinfo; | |
1434 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1435 pDecoinfo = &stateUsed->decolistBuehlmann; | |
1436 else | |
1437 pDecoinfo = &stateUsed->decolistVPM; | |
1438 | |
511 | 1439 uint8_t curViewIdx = 0xff; |
1440 uint8_t index = 0; | |
1441 uint8_t lastViewIdx = 0; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1442 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ |
38 | 1443 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1444 /* set pointer to currently selected view and count number of entries */ |
511 | 1445 while((tX_customviews[index] != CVIEW_T3_END)) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1446 { |
511 | 1447 if (tX_customviews[index] == *tX_selection_customview) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1448 { |
511 | 1449 curViewIdx = index; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1450 } |
511 | 1451 index++; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1452 } |
511 | 1453 if(curViewIdx == 0xff) /* called with unknown view */ |
496 | 1454 { |
511 | 1455 curViewIdx = 0; |
1456 *tX_selection_customview = tX_customviews[index]; | |
496 | 1457 } |
511 | 1458 lastViewIdx = index; |
1459 index = curViewIdx; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1460 do |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1461 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1462 iterate = 0; |
496 | 1463 switch(action) |
1464 { | |
1465 case ACTION_BUTTON_ENTER: | |
1466 case ACTION_PITCH_POS: | |
1467 | |
511 | 1468 if(tX_customviews[index] != CVIEW_T3_END) |
496 | 1469 { |
511 | 1470 index++; |
1471 } | |
1472 if(tX_customviews[index] == CVIEW_T3_END) | |
1473 { | |
1474 index = 0; | |
496 | 1475 } |
1476 break; | |
1477 case ACTION_PITCH_NEG: | |
511 | 1478 if(index == 0) |
496 | 1479 { |
511 | 1480 index = lastViewIdx - 1; |
496 | 1481 } |
1482 else | |
1483 { | |
511 | 1484 index--; |
496 | 1485 } |
1486 break; | |
1487 default: | |
1488 break; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1489 } |
496 | 1490 |
511 | 1491 if(t3_customview_disabled(tX_customviews[index])) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1492 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1493 iterate = 1; |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1494 } |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1495 if((tX_customviews[index] == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) /* Skip TTS if value is 0 */ |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1496 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1497 iterate = 1; |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1498 } |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1499 if((tX_customviews[index] == CVIEW_T3_Decostop) && ((!pDecoinfo->output_ndl_seconds) && (!pDecoinfo->output_time_to_surface_seconds) && (timer_Safetystop_GetCountDown() == 0))) /* Skip Deco if NDL is not set */ |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1500 { |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1501 iterate = 1; |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1502 } |
496 | 1503 if((iterate) && (action == ACTION_END)) |
1504 { | |
1505 action = ACTION_BUTTON_ENTER; | |
1506 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1507 }while (iterate == 1); |
38 | 1508 |
511 | 1509 *tX_selection_customview = tX_customviews[index]; |
38 | 1510 } |
1511 | |
1512 | |
1513 void t3_basics_colorscheme_mod(char *text) | |
1514 { | |
1515 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
1516 { | |
1517 text[0] = '\027'; | |
1518 } | |
1519 } | |
1520 | |
1521 | |
496 | 1522 point_t t3_compass_circle(uint8_t id, uint16_t degree, point_t center) |
38 | 1523 { |
1524 float fCos, fSin; | |
1525 const float piMult = ((2 * 3.14159) / 360); | |
1526 // const int radius[4] = {95,105,115,60}; | |
1527 const int radius[4] = {85,95,105,90}; | |
496 | 1528 static point_t forcenter = {.x = 900, .y = 500}; /* used to identify change of circle position */ |
38 | 1529 static point_t r[4][360] = { 0 }; |
1530 | |
496 | 1531 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 | 1532 { |
1533 for(int i=0;i<360;i++) | |
1534 { | |
1535 fCos = cos(i * piMult); | |
1536 fSin = sin(i * piMult); | |
1537 for(int j=0;j<4;j++) | |
1538 { | |
496 | 1539 r[j][i].x = center.x + (int)(fSin * radius[j]); |
1540 r[j][i].y = center.y + (int)(fCos * radius[j]); | |
38 | 1541 } |
1542 } | |
496 | 1543 forcenter.x = center.x; |
1544 forcenter.y = center.y; | |
38 | 1545 } |
1546 if(id > 3) id = 0; | |
1547 if(degree > 359) degree = 0; | |
1548 return r[id][degree]; | |
1549 } | |
1550 | |
1551 | |
496 | 1552 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading) |
38 | 1553 { |
496 | 1554 uint8_t loop = 0; |
38 | 1555 uint16_t LineHeading; |
496 | 1556 |
38 | 1557 static int32_t LastHeading = 0; |
1558 int32_t newHeading = 0; | |
1559 int32_t diff = 0; | |
1560 int32_t diff2 = 0; | |
1561 | |
1562 int32_t diffAbs = 0; | |
1563 int32_t diffAbs2 = 0; | |
1564 | |
1565 newHeading = ActualHeading; | |
1566 | |
1567 diff = newHeading - LastHeading; | |
1568 | |
1569 if(newHeading < LastHeading) | |
1570 diff2 = newHeading + 360 - LastHeading; | |
1571 else | |
1572 diff2 = newHeading - 360 - LastHeading; | |
1573 | |
1574 diffAbs = diff; | |
1575 if(diffAbs < 0) | |
1576 diffAbs *= -1; | |
1577 | |
1578 diffAbs2 = diff2; | |
1579 if(diffAbs2 < 0) | |
1580 diffAbs2 *= -1; | |
1581 | |
1582 if(diffAbs <= diffAbs2) | |
1583 newHeading = LastHeading + (diff / 2); | |
1584 else | |
1585 newHeading = LastHeading + (diff2 / 2); | |
1586 | |
1587 if(newHeading < 0) | |
1588 newHeading += 360; | |
1589 else | |
1590 if(newHeading >= 360) | |
1591 newHeading -= 360; | |
1592 | |
1593 LastHeading = newHeading; | |
1594 ActualHeading = newHeading; | |
1595 | |
1596 if (ActualHeading < 90) | |
1597 ActualHeading += 360; | |
1598 | |
1599 while(ActualHeading > 359) ActualHeading -= 360; | |
1600 | |
1601 LineHeading = 360 - ActualHeading; | |
496 | 1602 |
1603 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font030); // North | |
38 | 1604 LineHeading += 90; |
496 | 1605 |
1606 for (loop = 0; loop < 3; loop++) | |
1607 { | |
1608 if(LineHeading > 359) LineHeading -= 360; | |
1609 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Main Ticks | |
1610 LineHeading += 90; | |
1611 } | |
38 | 1612 |
1613 LineHeading = 360 - ActualHeading; | |
1614 LineHeading += 45; | |
496 | 1615 |
1616 for (loop = 0; loop < 4; loop++) | |
1617 { | |
1618 if(LineHeading > 359) LineHeading -= 360; | |
1619 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1620 LineHeading += 90; | |
1621 } | |
38 | 1622 |
1623 LineHeading = 360 - ActualHeading; | |
1624 LineHeading += 22; | |
496 | 1625 for (loop = 0; loop < 8; loop++) |
1626 { | |
1627 if(LineHeading > 359) LineHeading -= 360; | |
1628 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1629 LineHeading += 45; | |
1630 } | |
38 | 1631 if(UserSetHeading) |
1632 { | |
1633 LineHeading = UserSetHeading + 360 - ActualHeading; | |
1634 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1635 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserHeadingTick); |
38 | 1636 |
1637 // R�ckpeilung, User Back Heading | |
1638 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
1639 if(LineHeading > 359) LineHeading -= 360; | |
1640 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1641 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserBackHeadingTick); |
38 | 1642 } |
1643 | |
1644 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); | |
1645 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); | |
1646 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); | |
1647 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1648 |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1649 uint8_t t3_GetEnabled_customviews() |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1650 { |
496 | 1651 uint8_t *pViews; |
1652 uint8_t increment = 1; | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1653 uint8_t enabledViewCnt = 0; |
496 | 1654 |
511 | 1655 pViews = (uint8_t*)t3_customviewsStandard; |
496 | 1656 while((*pViews != CVIEW_T3_END)) |
1657 { | |
1658 increment = 1; | |
1659 /* check if view is enabled */ | |
1660 if(t3_customview_disabled(*pViews)) | |
1661 { | |
1662 increment = 0; | |
1663 } | |
1664 pViews++; | |
1665 enabledViewCnt += increment; | |
1666 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1667 return enabledViewCnt; |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1668 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1669 |
518 | 1670 uint8_t t3_getCustomView(void) |
1671 { | |
1672 return t3_selection_customview; | |
1673 } |