Mercurial > public > ostc4
annotate Discovery/Src/t3.c @ 588:b1c489b503b9
Update current build, "RTErequired" value and release date
author | heinrichsweikamp |
---|---|
date | Thu, 17 Dec 2020 09:52:12 +0100 |
parents | 64bf41faab83 |
children | f52bc70e380f |
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 { | |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
692 static uint8_t last_customview = CVIEW_END; |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
693 |
38 | 694 char text[512]; |
695 uint16_t textpointer = 0; | |
696 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
697 SSettings* pSettings; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
698 pSettings = settingsGetPointer(); |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
699 |
38 | 700 // CVIEW_T3_Decostop and CVIEW_T3_TTS |
701 const SDecoinfo * pDecoinfo; | |
702 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
703 pDecoinfo = &stateUsed->decolistBuehlmann; | |
704 else | |
705 pDecoinfo = &stateUsed->decolistVPM; | |
706 | |
707 // CVIEW_T3_Decostop | |
708 uint16_t nextstopLengthSeconds = 0; | |
709 uint8_t nextstopDepthMeter = 0; | |
710 SDivetime SafetyStopTime = {0,0,0,0}; | |
711 | |
712 // CVIEW_T3_ppO2andGas | |
713 uint8_t oxygen_percentage = 0; | |
714 | |
715 // CVIEW_T3_Temperature | |
716 float temperature; | |
717 | |
718 // CVIEW_T3_GasList | |
719 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; | |
720 const SGasLine * pGasLine; | |
721 uint8_t oxygen, helium; | |
722 uint8_t lineNumber; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
723 uint8_t gasPosIdx; |
38 | 724 |
496 | 725 /* compass position */ |
726 point_t center; | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
727 uint16_t heading; |
496 | 728 |
38 | 729 // CVIEW_T3_StopWatch |
730 SDivetime Stopwatch = {0,0,0,0}; | |
731 float fAverageDepth, fAverageDepthAbsolute; | |
732 | |
733 uint16_t tempWinX0; | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
734 uint16_t tempWinX1; |
38 | 735 uint16_t tempWinY0; |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
736 uint16_t tempWinY1; |
38 | 737 uint16_t tempWinC2X0; |
413 | 738 uint16_t tempWinC2Y0; |
739 uint16_t tempWinC2X1; | |
740 uint16_t tempWinC2Y1; | |
38 | 741 uint16_t tempWinC2Tab; |
742 | |
743 tempWinX0 = tXc1->WindowX0; | |
744 tempWinY0 = tXc1->WindowY0; | |
496 | 745 tempWinX1 = tXc1->WindowX1; |
746 tempWinY1 = tXc1->WindowY1; | |
413 | 747 |
38 | 748 tempWinC2X0 = tXc2->WindowX0; |
413 | 749 tempWinC2Y0 = tXc2->WindowY0; |
750 tempWinC2X1 = tXc2->WindowX1; | |
751 tempWinC2Y1 = tXc2->WindowY1; | |
38 | 752 tempWinC2Tab = tXc2->WindowTab; |
753 | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
754 if(settingsGetPointer()->compassInertia) |
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 heading = (uint16_t)compass_getCompensated(); |
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 else |
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 heading = (uint16_t)stateUsed->lifeData.compass_heading; |
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
761 } |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
762 if(last_customview != tX_selection_customview) /* check if current selection is disabled and should be skipped */ |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
763 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
764 if(t3_customview_disabled(tX_selection_customview)) |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
765 { |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
766 tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER); |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
767 } |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
768 last_customview = tX_selection_customview; |
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
769 } |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
770 |
38 | 771 switch(tX_selection_customview) |
772 { | |
773 case CVIEW_T3_ApnoeSurfaceInfo: | |
774 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
775 | |
413 | 776 if(!pSettings->FlipDisplay) |
777 { | |
778 GFX_write_string(&FontT42,tXc1,text,0); | |
779 tXc1->WindowY0 = 100; | |
780 } | |
781 else | |
782 { | |
783 GFX_write_string(&FontT42,tXc2,text,0); | |
784 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
785 } | |
38 | 786 |
787 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_last_max_depth_meter)); | |
788 t3_basics_colorscheme_mod(text); | |
413 | 789 |
790 if(!pSettings->FlipDisplay) | |
791 { | |
792 GFX_write_string(&FontT105,tXc1,text,0); | |
793 tXc1->WindowY0 = tempWinY0; | |
794 } | |
795 else | |
796 { | |
797 GFX_write_string(&FontT105,tXc2,text,0); | |
798 tXc2->WindowY1 = tempWinC2Y1; /* jump to upper of two lines */ | |
799 } | |
38 | 800 |
801 | |
802 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_total_max_depth_meter)); | |
803 t3_basics_colorscheme_mod(text); | |
413 | 804 if(!pSettings->FlipDisplay) |
805 { | |
806 GFX_write_string(&FontT105,tXc1,text,0); | |
807 } | |
808 else | |
809 { | |
810 GFX_write_string(&FontT105,tXc2,text,0); | |
811 } | |
38 | 812 break; |
813 | |
814 case CVIEW_T3_StopWatch: | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
815 |
38 | 816 Stopwatch.Total = timer_Stopwatch_GetTime(); |
817 Stopwatch.Minutes = Stopwatch.Total / 60; | |
818 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
819 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
820 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
821 | |
822 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); | |
823 GFX_write_string(&FontT42,tXc1,text,0); | |
824 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); | |
825 GFX_write_string(&FontT105,tXc1,text,0); | |
826 | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
827 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
828 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
829 tXc1->WindowX0 = 480; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
830 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
831 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
832 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
833 tXc1->WindowX1 = 320; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
834 tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
835 } |
38 | 836 // 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
|
837 |
38 | 838 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch); |
839 GFX_write_string(&FontT42,tXc1,text,0); | |
840 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); | |
841 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
842 if(!pSettings->FlipDisplay) |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
843 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
844 tXc1->WindowY0 = 100; |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
845 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
846 else |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
847 { |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
848 tXc1->WindowY1 -= 100; /* jump to upper of two lines */ |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
849 } |
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
850 |
38 | 851 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); |
852 GFX_write_string(&FontT105,tXc1,text,0); | |
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
38
diff
changeset
|
853 |
496 | 854 break; |
38 | 855 |
856 case CVIEW_T3_GasList: | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
857 gasPosIdx = 0; |
38 | 858 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); |
859 GFX_write_string(&FontT42,tXc1,text,0); | |
860 | |
861 textpointer = 0; | |
862 tXc2->WindowX0 = 0; | |
518 | 863 tXc2->WindowTab = 800/3; // /2 |
38 | 864 |
413 | 865 if(pSettings->FlipDisplay) |
866 { | |
867 tXc2->WindowY1 = 0; | |
868 } | |
869 | |
38 | 870 pGasLine = settingsGetPointer()->gas; |
871 if(actualLeftMaxDepth(stateUsed)) | |
872 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
873 else | |
874 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
875 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
876 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
877 { | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
878 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
879 if(!pGasLine[gasId].note.ub.off) |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
880 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
881 #endif |
38 | 882 textpointer = 0; |
518 | 883 text[textpointer++] = '\003'; |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
884 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
885 lineNumber = 1; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
886 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
887 switch(gasPosIdx) |
38 | 888 { |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
889 case 0: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
890 case 1: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
891 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
892 case 4: text[textpointer++] = '\001'; /* display centered */ |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
893 break; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
894 case 2: lineNumber = 0; |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
895 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
|
896 default: |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
897 break; |
38 | 898 } |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
899 gasPosIdx++; |
518 | 900 |
38 | 901 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; |
902 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
|
903 strcpy(&text[textpointer++],"\031"); |
518 | 904 else if(stateUsed->lifeData.actualGas.GasIdInSettings == gasId) /* actual selected gas */ |
905 { | |
906 strcpy(&text[textpointer++],"\030"); | |
907 } | |
38 | 908 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) |
909 strcpy(&text[textpointer++],"\025"); | |
518 | 910 else if(actualBetterGasId() == gasId) |
911 { | |
912 strcpy(&text[textpointer++],"\026"); /* Highlight better gas */ | |
913 } | |
38 | 914 else |
518 | 915 strcpy(&text[textpointer++],"\023"); /* Blue for travel or deco without special state */ |
38 | 916 |
917 text[textpointer++] = ' '; | |
918 oxygen = pGasLine[gasId].oxygen_percentage; | |
919 helium = pGasLine[gasId].helium_percentage; | |
920 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
|
921 |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
922 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
|
923 { |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
924 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
|
925 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
926 text[textpointer++] = 0; |
518 | 927 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
|
928 #ifdef ENABLE_UNUSED_GAS_HIDING |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
929 } |
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
930 #endif |
38 | 931 } |
932 break; | |
933 | |
934 case CVIEW_T3_Temperature: | |
935 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature); | |
936 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
|
937 |
8b8074080d7b
Bugfix: average temperature on arrival from RTE instead of display time
Jan Mulder <jlmulder@xs4all.nl>
parents:
174
diff
changeset
|
938 temperature = unit_temperature_float(stateUsed->lifeData.temperature_celsius); |
38 | 939 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F |
940 if(settingsGetPointer()->nonMetricalSystem == 0) | |
941 text[textpointer++] = 'C'; | |
942 else | |
943 text[textpointer++] = 'F'; | |
944 text[textpointer++] = 0; | |
945 GFX_write_string(&FontT105,tXc1,text,0); | |
946 break; | |
947 | |
948 case CVIEW_Compass: | |
496 | 949 center.x = 600; |
950 center.y = 116; | |
38 | 951 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); |
952 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
953 snprintf(text,100,"\030\003%03i`",heading); |
38 | 954 GFX_write_string(&FontT105,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
955 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
38 | 956 break; |
957 | |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
958 case CVIEW_T3_DecoTTS: |
38 | 959 case CVIEW_T3_Decostop: |
960 default: | |
961 // decostop | |
962 if(pDecoinfo->output_time_to_surface_seconds) | |
963 { | |
964 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
965 } | |
966 else | |
967 { | |
968 nextstopDepthMeter = 0; | |
969 nextstopLengthSeconds = 0; | |
970 } | |
971 | |
972 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
973 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
974 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
975 | |
976 if(nextstopDepthMeter) | |
977 { | |
978 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Decostop); | |
979 GFX_write_string(&FontT42,tXc1,text,0); | |
980 | |
981 textpointer = 0; | |
982 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
|
983 , unit_depth_integer(nextstopDepthMeter) |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
984 , unit_depth_char1_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
985 , unit_depth_char2_T105() |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
986 , (nextstopLengthSeconds+59)/60); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
987 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
988 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 989 } |
990 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
991 { | |
992 textpointer = 0; | |
993 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
994 GFX_write_string(&FontT42,tXc1,text,0); | |
995 | |
996 textpointer = 0; | |
997 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
998 t3_basics_colorscheme_mod(text); | |
496 | 999 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1000 } |
237
ec16fd26e280
Bugfix: do not show NDL in bigscreen mode when zero
Jan Mulder <jlmulder@xs4all.nl>
parents:
214
diff
changeset
|
1001 else if(pDecoinfo->output_ndl_seconds) // NDL |
38 | 1002 { |
1003 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit); | |
1004 GFX_write_string(&FontT42,tXc1,text,0); | |
1005 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
1006 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60); | |
1007 else | |
1008 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600); | |
1009 t3_basics_colorscheme_mod(text); | |
496 | 1010 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1011 } |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1012 |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1013 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
|
1014 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1015 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
|
1016 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
|
1017 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
|
1018 { |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1019 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
|
1020 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
|
1021 else |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1022 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
|
1023 t3_basics_colorscheme_mod(text); |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1024 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
|
1025 } |
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
1026 } |
38 | 1027 break; |
1028 | |
1029 case CVIEW_sensors: | |
1030 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); | |
1031 GFX_write_string(&FontT42,tXc1,text,0); | |
1032 | |
1033 for(int i=0;i<3;i++) | |
1034 { | |
1035 textpointer = 0; | |
1036 text[textpointer++] = '\030'; | |
1037 if(i==1) | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1038 text[textpointer++] = '\001'; /* center */ |
38 | 1039 else if(i==2) |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1040 text[textpointer++] = '\002'; /* right */ |
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1041 |
577
9bb9a52d6ae5
Handle o2 voltage values < 0.5mV as invalid:
Ideenmodellierer
parents:
564
diff
changeset
|
1042 if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0)) |
38 | 1043 { |
1044 text[textpointer++] = '\031'; | |
1045 text[textpointer++] = ' '; | |
1046 text[textpointer++] = '-'; | |
1047 text[textpointer++] = ' '; | |
1048 } | |
1049 else | |
1050 { | |
1051 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1052 text[textpointer++] = '\025'; | |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1053 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppO2Sensor_bar[i]); |
38 | 1054 } |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1055 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1056 } |
1057 break; | |
1058 | |
1059 case CVIEW_T3_MaxDepth: | |
1060 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
413 | 1061 if(pSettings->FlipDisplay) |
1062 { | |
1063 if(mode == DIVEMODE_Apnea) | |
1064 { | |
1065 GFX_write_string(&FontT42,tXc2,text,0); | |
1066 } | |
1067 else | |
1068 { | |
1069 GFX_write_string(&FontT42,tXc1,text,0); | |
1070 } | |
1071 } | |
1072 else | |
1073 { | |
1074 GFX_write_string(&FontT42,tXc1,text,0); | |
1075 } | |
38 | 1076 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); |
1077 t3_basics_colorscheme_mod(text); | |
413 | 1078 if(pSettings->FlipDisplay) |
1079 { | |
1080 if(mode == DIVEMODE_Apnea) | |
1081 { | |
1082 GFX_write_string(&FontT105,tXc2,text,0); | |
1083 } | |
1084 else | |
1085 { | |
1086 GFX_write_string(&FontT105,tXc1,text,0); | |
1087 } | |
1088 } | |
1089 else | |
1090 { | |
496 | 1091 GFX_write_string(&FontT105,tXc1,text,0); |
413 | 1092 } |
38 | 1093 break; |
1094 | |
1095 case CVIEW_T3_TTS: | |
1096 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); | |
1097 GFX_write_string(&FontT42,tXc1,text,0); | |
1098 if(pDecoinfo->output_time_to_surface_seconds) | |
1099 { | |
1100 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
|
1101 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
38 | 1102 else |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1103 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
38 | 1104 t3_basics_colorscheme_mod(text); |
496 | 1105 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1106 } |
1107 break; | |
1108 | |
1109 case CVIEW_T3_ppO2andGas: | |
1110 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); | |
1111 GFX_write_string(&FontT42,tXc1,text,0); | |
1112 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); | |
1113 t3_basics_colorscheme_mod(text); | |
496 | 1114 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1115 |
1116 textpointer = 0; | |
1117 text[textpointer++] = '\020'; | |
1118 text[textpointer++] = '\003'; | |
1119 oxygen_percentage = 100; | |
1120 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
1121 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
1122 text[textpointer++] = '\002'; | |
1123 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); | |
1124 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); | |
1125 t3_basics_colorscheme_mod(text); | |
496 | 1126 GFX_write_string(&FontT48,tXc1,text,0); |
38 | 1127 break; |
496 | 1128 |
1129 case CVIEW_T3_Navigation: | |
1130 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
1131 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1132 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1133 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1134 | |
1135 if(!pSettings->FlipDisplay) | |
1136 { | |
1137 tXc2->WindowX0 = 550; | |
1138 } | |
1139 else | |
1140 { | |
1141 tXc2->WindowX1 = 800; | |
1142 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ | |
1143 } | |
1144 | |
1145 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); | |
511 | 1146 GFX_write_string(&FontT42,tXc1,text,0); |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1147 snprintf(text,TEXTSIZE,"\030\002\016%01.1f",unit_depth_float(fAverageDepth)); |
511 | 1148 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1149 if(!pSettings->FlipDisplay) |
1150 { | |
1151 tXc2->WindowY0 = 100; | |
1152 } | |
1153 else | |
1154 { | |
1155 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
1156 } | |
1157 | |
1158 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); | |
511 | 1159 GFX_write_string(&FontT105,tXc1,text,1); |
496 | 1160 |
1161 | |
1162 center.x = 400; | |
1163 center.y = 116; | |
1164 | |
1165 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1166 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1167 snprintf(text,100,"\030%03i`",heading); |
496 | 1168 GFX_write_string(&FontT144,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1169 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
496 | 1170 |
1171 break; | |
1172 | |
1173 case CVIEW_T3_DepthData: | |
1174 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
1175 if(pSettings->FlipDisplay) | |
1176 { | |
1177 if(mode == DIVEMODE_Apnea) | |
1178 { | |
1179 GFX_write_string(&FontT42,tXc2,text,0); | |
1180 } | |
1181 else | |
1182 { | |
1183 GFX_write_string(&FontT42,tXc1,text,0); | |
1184 } | |
1185 } | |
1186 else | |
1187 { | |
1188 GFX_write_string(&FontT42,tXc1,text,0); | |
1189 } | |
1190 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
1191 t3_basics_colorscheme_mod(text); | |
1192 if(pSettings->FlipDisplay) | |
1193 { | |
1194 if(mode == DIVEMODE_Apnea) | |
1195 { | |
1196 GFX_write_string(&FontT105,tXc2,text,0); | |
1197 } | |
1198 else | |
1199 { | |
1200 GFX_write_string(&FontT105,tXc1,text,0); | |
1201 } | |
1202 } | |
1203 else | |
1204 { | |
1205 GFX_write_string(&FontT105,tXc1,text,0); | |
1206 } | |
1207 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1208 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); | |
511 | 1209 GFX_write_string(&FontT42,tXc1,text,0); |
496 | 1210 |
564
5e0a75e2f00b
Bugfix One or more deactivated sensors hide sensor display:
Ideenmodellierer
parents:
553
diff
changeset
|
1211 snprintf(text,TEXTSIZE,"\020\003\002\016\%01.1f",unit_depth_float(fAverageDepthAbsolute)); |
511 | 1212 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1213 break; |
38 | 1214 } |
496 | 1215 |
1216 | |
1217 | |
38 | 1218 tXc1->WindowX0 = tempWinX0; |
1219 tXc1->WindowY0 = tempWinY0; | |
496 | 1220 tXc1->WindowX1 = tempWinX1; |
1221 tXc1->WindowY1 = tempWinY1; | |
413 | 1222 |
38 | 1223 tXc2->WindowX0 = tempWinC2X0; |
413 | 1224 tXc2->WindowY0 = tempWinC2Y0; |
1225 tXc2->WindowX1 = tempWinC2X1; | |
1226 tXc2->WindowY1 = tempWinC2Y1; | |
38 | 1227 tXc2->WindowTab = tempWinC2Tab; |
1228 } | |
1229 | |
1230 | |
1231 uint8_t t3_test_customview_warnings(void) | |
1232 { | |
1233 uint8_t count = 0; | |
1234 | |
1235 count = 0; | |
1236 count += stateUsed->warnings.decoMissed; | |
1237 count += stateUsed->warnings.ppO2Low; | |
1238 count += stateUsed->warnings.ppO2High; | |
1239 //count += stateUsed->warnings.lowBattery; | |
1240 count += stateUsed->warnings.sensorLinkLost; | |
1241 count += stateUsed->warnings.fallback; | |
1242 | |
1243 return count; | |
1244 } | |
1245 | |
1246 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
1247 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1) | |
1248 { | |
1249 char text[256], textMain[256]; | |
1250 uint8_t textpointer, textpointerMain, lineFree, more; | |
1251 | |
1252 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); | |
1253 GFX_write_string(&FontT42,&t3c1,text,0); | |
1254 | |
1255 lineFree = 1; | |
1256 more = 0; | |
1257 | |
1258 textpointerMain = 0; | |
511 | 1259 textMain[textpointerMain++] = '\025'; /* red */ |
1260 textMain[textpointerMain++] = '\003'; /* doublesize */ | |
38 | 1261 |
1262 textpointer = 0; | |
1263 | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1264 text[textpointer++] = '\031'; |
38 | 1265 text[textpointer++] = TXT_2BYTE; |
1266 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
1267 if(stateUsed->warnings.decoMissed) | |
1268 { | |
1269 text[textpointer - 3] = '\025'; | |
1270 if(lineFree) | |
1271 { | |
1272 textMain[textpointerMain++] = TXT_2BYTE; | |
1273 textMain[textpointerMain++] = text[textpointer - 1]; | |
1274 textMain[textpointerMain] = 0; | |
1275 lineFree--; | |
1276 } | |
1277 else | |
1278 { | |
1279 more++; | |
1280 } | |
1281 } | |
1282 | |
1283 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1284 text[textpointer++] = '\031'; |
38 | 1285 text[textpointer++] = TXT_2BYTE; |
1286 text[textpointer++] = TXT2BYTE_WarnPPO2Low; | |
1287 if(stateUsed->warnings.ppO2Low) | |
1288 { | |
1289 text[textpointer - 3] = '\025'; | |
1290 if(lineFree) | |
1291 { | |
1292 textMain[textpointerMain++] = TXT_2BYTE; | |
1293 textMain[textpointerMain++] = text[textpointer - 1]; | |
1294 textMain[textpointerMain] = 0; | |
1295 lineFree--; | |
1296 } | |
1297 else | |
1298 { | |
1299 more++; | |
1300 } | |
1301 } | |
1302 | |
1303 text[textpointer++] = '\n'; | |
1304 text[textpointer++] = '\r'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1305 text[textpointer++] = '\031'; |
38 | 1306 text[textpointer++] = TXT_2BYTE; |
1307 text[textpointer++] = TXT2BYTE_WarnPPO2High; | |
1308 if(stateUsed->warnings.ppO2High) | |
1309 { | |
1310 text[textpointer - 3] = '\025'; | |
1311 if(lineFree) | |
1312 { | |
1313 textMain[textpointerMain++] = TXT_2BYTE; | |
1314 textMain[textpointerMain++] = text[textpointer - 1]; | |
1315 textMain[textpointerMain] = 0; | |
1316 lineFree--; | |
1317 } | |
1318 else | |
1319 { | |
1320 more++; | |
1321 } | |
1322 } | |
1323 | |
1324 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1325 text[textpointer++] = '\031'; |
38 | 1326 text[textpointer++] = TXT_2BYTE; |
1327 text[textpointer++] = TXT2BYTE_WarnFallback; | |
1328 if(stateUsed->warnings.fallback) | |
1329 { | |
1330 text[textpointer - 3] = '\025'; | |
1331 if(lineFree) | |
1332 { | |
1333 textMain[textpointerMain++] = TXT_2BYTE; | |
1334 textMain[textpointerMain++] = text[textpointer - 1]; | |
1335 textMain[textpointerMain] = 0; | |
1336 lineFree--; | |
1337 } | |
1338 else | |
1339 { | |
1340 more++; | |
1341 } | |
1342 } | |
1343 | |
1344 text[textpointer++] = '\n'; | |
1345 text[textpointer++] = '\r'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1346 text[textpointer++] = '\031'; |
38 | 1347 text[textpointer++] = TXT_2BYTE; |
1348 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; | |
1349 if(stateUsed->warnings.sensorLinkLost) | |
1350 { | |
1351 text[textpointer - 3] = '\025'; | |
1352 if(lineFree) | |
1353 { | |
1354 textMain[textpointerMain++] = TXT_2BYTE; | |
1355 textMain[textpointerMain++] = text[textpointer - 1]; | |
1356 textMain[textpointerMain] = 0; | |
1357 lineFree--; | |
1358 } | |
1359 else | |
1360 { | |
1361 more++; | |
1362 } | |
1363 } | |
1364 | |
1365 /* | |
1366 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1367 text[textpointer++] = '\031'; |
38 | 1368 text[textpointer++] = TXT_2BYTE; |
1369 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | |
1370 if(stateUsed->warnings.lowBattery) | |
1371 { | |
1372 text[textpointer - 3] = '\025'; | |
1373 if(lineFree) | |
1374 { | |
1375 textMain[textpointerMain++] = TXT_2BYTE; | |
1376 textMain[textpointerMain++] = text[textpointer - 1]; | |
1377 textMain[textpointerMain] = 0; | |
1378 lineFree--; | |
1379 } | |
1380 else | |
1381 { | |
1382 more++; | |
1383 } | |
1384 } | |
1385 */ | |
1386 text[textpointer] = 0; | |
1387 /* | |
1388 if(more) | |
1389 { | |
1390 text[textpointer++] = '\002'; | |
1391 text[textpointer++] = '+'; | |
1392 if(more < 10) | |
1393 text[textpointer++] = '0' + more; | |
1394 else | |
1395 text[textpointer++] = 'X'; | |
1396 text[textpointer] = 0; | |
1397 } | |
1398 */ | |
511 | 1399 GFX_write_string(&FontT48,&t3c1,textMain,0); |
38 | 1400 if(more) |
1401 { | |
511 | 1402 GFX_write_string(&FontT48,&t3c2,text,0); |
38 | 1403 } |
1404 } | |
1405 | |
496 | 1406 uint8_t t3_customview_disabled(uint8_t view) |
1407 { | |
1408 uint8_t i = 0; | |
1409 uint8_t cv_disabled = 0; | |
1410 const uint8_t *pcv_changelist; | |
1411 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; | |
1412 | |
511 | 1413 pcv_changelist = cv_changelist_BS; |
496 | 1414 |
1415 while(pcv_changelist[i] != CVIEW_T3_END) | |
1416 { | |
1417 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i])) | |
1418 { | |
1419 cv_disabled = 1; | |
1420 break; | |
1421 } | |
1422 i++; | |
1423 } | |
1424 | |
1425 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && | |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1426 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback)) |
496 | 1427 { |
1428 cv_disabled = 1; | |
1429 } | |
1430 | |
1431 return cv_disabled; | |
1432 } | |
38 | 1433 |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1434 uint8_t t3_change_customview(uint8_t action) |
38 | 1435 { |
511 | 1436 |
496 | 1437 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
577
diff
changeset
|
1438 return t3_selection_customview; |
38 | 1439 } |
1440 | |
1441 | |
511 | 1442 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) |
38 | 1443 { |
1444 const SDecoinfo * pDecoinfo; | |
1445 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1446 pDecoinfo = &stateUsed->decolistBuehlmann; | |
1447 else | |
1448 pDecoinfo = &stateUsed->decolistVPM; | |
1449 | |
511 | 1450 uint8_t curViewIdx = 0xff; |
1451 uint8_t index = 0; | |
1452 uint8_t lastViewIdx = 0; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1453 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ |
38 | 1454 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1455 /* set pointer to currently selected view and count number of entries */ |
511 | 1456 while((tX_customviews[index] != CVIEW_T3_END)) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1457 { |
511 | 1458 if (tX_customviews[index] == *tX_selection_customview) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1459 { |
511 | 1460 curViewIdx = index; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1461 } |
511 | 1462 index++; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1463 } |
511 | 1464 if(curViewIdx == 0xff) /* called with unknown view */ |
496 | 1465 { |
511 | 1466 curViewIdx = 0; |
1467 *tX_selection_customview = tX_customviews[index]; | |
496 | 1468 } |
511 | 1469 lastViewIdx = index; |
1470 index = curViewIdx; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1471 do |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1472 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1473 iterate = 0; |
496 | 1474 switch(action) |
1475 { | |
1476 case ACTION_BUTTON_ENTER: | |
1477 case ACTION_PITCH_POS: | |
1478 | |
511 | 1479 if(tX_customviews[index] != CVIEW_T3_END) |
496 | 1480 { |
511 | 1481 index++; |
1482 } | |
1483 if(tX_customviews[index] == CVIEW_T3_END) | |
1484 { | |
1485 index = 0; | |
496 | 1486 } |
1487 break; | |
1488 case ACTION_PITCH_NEG: | |
511 | 1489 if(index == 0) |
496 | 1490 { |
511 | 1491 index = lastViewIdx - 1; |
496 | 1492 } |
1493 else | |
1494 { | |
511 | 1495 index--; |
496 | 1496 } |
1497 break; | |
1498 default: | |
1499 break; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1500 } |
496 | 1501 |
511 | 1502 if(t3_customview_disabled(tX_customviews[index])) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1503 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1504 iterate = 1; |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1505 } |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1506 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
|
1507 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1508 iterate = 1; |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1509 } |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1510 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
|
1511 { |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1512 iterate = 1; |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1513 } |
496 | 1514 if((iterate) && (action == ACTION_END)) |
1515 { | |
1516 action = ACTION_BUTTON_ENTER; | |
1517 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1518 }while (iterate == 1); |
38 | 1519 |
511 | 1520 *tX_selection_customview = tX_customviews[index]; |
38 | 1521 } |
1522 | |
1523 | |
1524 void t3_basics_colorscheme_mod(char *text) | |
1525 { | |
1526 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
1527 { | |
1528 text[0] = '\027'; | |
1529 } | |
1530 } | |
1531 | |
1532 | |
496 | 1533 point_t t3_compass_circle(uint8_t id, uint16_t degree, point_t center) |
38 | 1534 { |
1535 float fCos, fSin; | |
1536 const float piMult = ((2 * 3.14159) / 360); | |
1537 // const int radius[4] = {95,105,115,60}; | |
1538 const int radius[4] = {85,95,105,90}; | |
496 | 1539 static point_t forcenter = {.x = 900, .y = 500}; /* used to identify change of circle position */ |
38 | 1540 static point_t r[4][360] = { 0 }; |
1541 | |
496 | 1542 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 | 1543 { |
1544 for(int i=0;i<360;i++) | |
1545 { | |
1546 fCos = cos(i * piMult); | |
1547 fSin = sin(i * piMult); | |
1548 for(int j=0;j<4;j++) | |
1549 { | |
496 | 1550 r[j][i].x = center.x + (int)(fSin * radius[j]); |
1551 r[j][i].y = center.y + (int)(fCos * radius[j]); | |
38 | 1552 } |
1553 } | |
496 | 1554 forcenter.x = center.x; |
1555 forcenter.y = center.y; | |
38 | 1556 } |
1557 if(id > 3) id = 0; | |
1558 if(degree > 359) degree = 0; | |
1559 return r[id][degree]; | |
1560 } | |
1561 | |
1562 | |
496 | 1563 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading) |
38 | 1564 { |
496 | 1565 uint8_t loop = 0; |
38 | 1566 uint16_t LineHeading; |
496 | 1567 |
38 | 1568 static int32_t LastHeading = 0; |
1569 int32_t newHeading = 0; | |
1570 int32_t diff = 0; | |
1571 int32_t diff2 = 0; | |
1572 | |
1573 int32_t diffAbs = 0; | |
1574 int32_t diffAbs2 = 0; | |
1575 | |
1576 newHeading = ActualHeading; | |
1577 | |
1578 diff = newHeading - LastHeading; | |
1579 | |
1580 if(newHeading < LastHeading) | |
1581 diff2 = newHeading + 360 - LastHeading; | |
1582 else | |
1583 diff2 = newHeading - 360 - LastHeading; | |
1584 | |
1585 diffAbs = diff; | |
1586 if(diffAbs < 0) | |
1587 diffAbs *= -1; | |
1588 | |
1589 diffAbs2 = diff2; | |
1590 if(diffAbs2 < 0) | |
1591 diffAbs2 *= -1; | |
1592 | |
1593 if(diffAbs <= diffAbs2) | |
1594 newHeading = LastHeading + (diff / 2); | |
1595 else | |
1596 newHeading = LastHeading + (diff2 / 2); | |
1597 | |
1598 if(newHeading < 0) | |
1599 newHeading += 360; | |
1600 else | |
1601 if(newHeading >= 360) | |
1602 newHeading -= 360; | |
1603 | |
1604 LastHeading = newHeading; | |
1605 ActualHeading = newHeading; | |
1606 | |
1607 if (ActualHeading < 90) | |
1608 ActualHeading += 360; | |
1609 | |
1610 while(ActualHeading > 359) ActualHeading -= 360; | |
1611 | |
1612 LineHeading = 360 - ActualHeading; | |
496 | 1613 |
1614 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font030); // North | |
38 | 1615 LineHeading += 90; |
496 | 1616 |
1617 for (loop = 0; loop < 3; loop++) | |
1618 { | |
1619 if(LineHeading > 359) LineHeading -= 360; | |
1620 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Main Ticks | |
1621 LineHeading += 90; | |
1622 } | |
38 | 1623 |
1624 LineHeading = 360 - ActualHeading; | |
1625 LineHeading += 45; | |
496 | 1626 |
1627 for (loop = 0; loop < 4; loop++) | |
1628 { | |
1629 if(LineHeading > 359) LineHeading -= 360; | |
1630 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1631 LineHeading += 90; | |
1632 } | |
38 | 1633 |
1634 LineHeading = 360 - ActualHeading; | |
1635 LineHeading += 22; | |
496 | 1636 for (loop = 0; loop < 8; loop++) |
1637 { | |
1638 if(LineHeading > 359) LineHeading -= 360; | |
1639 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1640 LineHeading += 45; | |
1641 } | |
38 | 1642 if(UserSetHeading) |
1643 { | |
1644 LineHeading = UserSetHeading + 360 - ActualHeading; | |
1645 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1646 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserHeadingTick); |
38 | 1647 |
1648 // R�ckpeilung, User Back Heading | |
1649 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
1650 if(LineHeading > 359) LineHeading -= 360; | |
1651 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1652 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserBackHeadingTick); |
38 | 1653 } |
1654 | |
1655 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); | |
1656 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); | |
1657 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); | |
1658 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1659 |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1660 uint8_t t3_GetEnabled_customviews() |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1661 { |
496 | 1662 uint8_t *pViews; |
1663 uint8_t increment = 1; | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1664 uint8_t enabledViewCnt = 0; |
496 | 1665 |
511 | 1666 pViews = (uint8_t*)t3_customviewsStandard; |
496 | 1667 while((*pViews != CVIEW_T3_END)) |
1668 { | |
1669 increment = 1; | |
1670 /* check if view is enabled */ | |
1671 if(t3_customview_disabled(*pViews)) | |
1672 { | |
1673 increment = 0; | |
1674 } | |
1675 pViews++; | |
1676 enabledViewCnt += increment; | |
1677 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1678 return enabledViewCnt; |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1679 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1680 |
518 | 1681 uint8_t t3_getCustomView(void) |
1682 { | |
1683 return t3_selection_customview; | |
1684 } |