Mercurial > public > ostc4
annotate Discovery/Src/t3.c @ 558:66aef216828b
Changed operation mode of RecoverSampleIndex:
In previous implementation the check was only done for the first 16 sector to be able to display status using a string. This may not be done by an OSTC companion function externally => changed function to handle all 192 sector used for log samples. The lastSampleIdx will now be stored immediatly (dive was necessary in previous version)
author | Ideenmodellierer |
---|---|
date | Thu, 12 Nov 2020 20:06:04 +0100 |
parents | 43a2dd4ba30f |
children | 5e0a75e2f00b |
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 | |
461 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); | |
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) | |
473 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
474 else | |
475 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes); | |
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) | |
512 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
513 else | |
514 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes); | |
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) | |
1028 text[textpointer++] = '\001'; | |
1029 else if(i==2) | |
1030 text[textpointer++] = '\002'; | |
1031 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
1032 { | |
1033 text[textpointer++] = '\031'; | |
1034 text[textpointer++] = ' '; | |
1035 text[textpointer++] = '-'; | |
1036 text[textpointer++] = ' '; | |
1037 } | |
1038 else | |
1039 { | |
1040 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
1041 text[textpointer++] = '\025'; | |
1042 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.1f",stateUsed->lifeData.ppO2Sensor_bar[i]); | |
1043 } | |
496 | 1044 GFX_write_string(&FontT144,tXc1,text,0); |
38 | 1045 } |
1046 break; | |
1047 | |
1048 case CVIEW_T3_MaxDepth: | |
1049 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
413 | 1050 if(pSettings->FlipDisplay) |
1051 { | |
1052 if(mode == DIVEMODE_Apnea) | |
1053 { | |
1054 GFX_write_string(&FontT42,tXc2,text,0); | |
1055 } | |
1056 else | |
1057 { | |
1058 GFX_write_string(&FontT42,tXc1,text,0); | |
1059 } | |
1060 } | |
1061 else | |
1062 { | |
1063 GFX_write_string(&FontT42,tXc1,text,0); | |
1064 } | |
38 | 1065 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); |
1066 t3_basics_colorscheme_mod(text); | |
413 | 1067 if(pSettings->FlipDisplay) |
1068 { | |
1069 if(mode == DIVEMODE_Apnea) | |
1070 { | |
1071 GFX_write_string(&FontT105,tXc2,text,0); | |
1072 } | |
1073 else | |
1074 { | |
1075 GFX_write_string(&FontT105,tXc1,text,0); | |
1076 } | |
1077 } | |
1078 else | |
1079 { | |
496 | 1080 GFX_write_string(&FontT105,tXc1,text,0); |
413 | 1081 } |
38 | 1082 break; |
1083 | |
1084 case CVIEW_T3_TTS: | |
1085 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); | |
1086 GFX_write_string(&FontT42,tXc1,text,0); | |
1087 if(pDecoinfo->output_time_to_surface_seconds) | |
1088 { | |
1089 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
|
1090 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); |
38 | 1091 else |
214
51a3aeffc6b3
Bugfix: handle rounding of TTS and future TTS consistently
Jan Mulder <jlmulder@xs4all.nl>
parents:
189
diff
changeset
|
1092 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); |
38 | 1093 t3_basics_colorscheme_mod(text); |
496 | 1094 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1095 } |
1096 break; | |
1097 | |
1098 case CVIEW_T3_ppO2andGas: | |
1099 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); | |
1100 GFX_write_string(&FontT42,tXc1,text,0); | |
1101 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); | |
1102 t3_basics_colorscheme_mod(text); | |
496 | 1103 GFX_write_string(&FontT105,tXc1,text,0); |
38 | 1104 |
1105 textpointer = 0; | |
1106 text[textpointer++] = '\020'; | |
1107 text[textpointer++] = '\003'; | |
1108 oxygen_percentage = 100; | |
1109 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
1110 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
1111 text[textpointer++] = '\002'; | |
1112 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); | |
1113 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); | |
1114 t3_basics_colorscheme_mod(text); | |
496 | 1115 GFX_write_string(&FontT48,tXc1,text,0); |
38 | 1116 break; |
496 | 1117 |
1118 case CVIEW_T3_Navigation: | |
1119 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
1120 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1121 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1122 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1123 | |
1124 if(!pSettings->FlipDisplay) | |
1125 { | |
1126 tXc2->WindowX0 = 550; | |
1127 } | |
1128 else | |
1129 { | |
1130 tXc2->WindowX1 = 800; | |
1131 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ | |
1132 } | |
1133 | |
1134 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); | |
511 | 1135 GFX_write_string(&FontT42,tXc1,text,0); |
496 | 1136 snprintf(text,TEXTSIZE,"\030\016\002%01.1f",unit_depth_float(fAverageDepth)); |
511 | 1137 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1138 if(!pSettings->FlipDisplay) |
1139 { | |
1140 tXc2->WindowY0 = 100; | |
1141 } | |
1142 else | |
1143 { | |
1144 tXc2->WindowY1 -= 100; /* jump to upper of two lines */ | |
1145 } | |
1146 | |
1147 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); | |
511 | 1148 GFX_write_string(&FontT105,tXc1,text,1); |
496 | 1149 |
1150 | |
1151 center.x = 400; | |
1152 center.y = 116; | |
1153 | |
1154 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
1155 GFX_write_string(&FontT42,tXc1,text,0); | |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1156 snprintf(text,100,"\030%03i`",heading); |
496 | 1157 GFX_write_string(&FontT144,tXc1,text,0); |
539
d784f281833a
Added inertia simulation for compass heading:
Ideenmodellierer
parents:
529
diff
changeset
|
1158 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading); |
496 | 1159 |
1160 break; | |
1161 | |
1162 case CVIEW_T3_DepthData: | |
1163 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
1164 if(pSettings->FlipDisplay) | |
1165 { | |
1166 if(mode == DIVEMODE_Apnea) | |
1167 { | |
1168 GFX_write_string(&FontT42,tXc2,text,0); | |
1169 } | |
1170 else | |
1171 { | |
1172 GFX_write_string(&FontT42,tXc1,text,0); | |
1173 } | |
1174 } | |
1175 else | |
1176 { | |
1177 GFX_write_string(&FontT42,tXc1,text,0); | |
1178 } | |
1179 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
1180 t3_basics_colorscheme_mod(text); | |
1181 if(pSettings->FlipDisplay) | |
1182 { | |
1183 if(mode == DIVEMODE_Apnea) | |
1184 { | |
1185 GFX_write_string(&FontT105,tXc2,text,0); | |
1186 } | |
1187 else | |
1188 { | |
1189 GFX_write_string(&FontT105,tXc1,text,0); | |
1190 } | |
1191 } | |
1192 else | |
1193 { | |
1194 GFX_write_string(&FontT105,tXc1,text,0); | |
1195 } | |
1196 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1197 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); | |
511 | 1198 GFX_write_string(&FontT42,tXc1,text,0); |
496 | 1199 |
1200 snprintf(text,TEXTSIZE,"\020\003\016\002\%01.1f",unit_depth_float(fAverageDepthAbsolute)); | |
511 | 1201 GFX_write_string(&FontT105,tXc1,text,0); |
496 | 1202 break; |
38 | 1203 } |
496 | 1204 |
1205 | |
1206 | |
38 | 1207 tXc1->WindowX0 = tempWinX0; |
1208 tXc1->WindowY0 = tempWinY0; | |
496 | 1209 tXc1->WindowX1 = tempWinX1; |
1210 tXc1->WindowY1 = tempWinY1; | |
413 | 1211 |
38 | 1212 tXc2->WindowX0 = tempWinC2X0; |
413 | 1213 tXc2->WindowY0 = tempWinC2Y0; |
1214 tXc2->WindowX1 = tempWinC2X1; | |
1215 tXc2->WindowY1 = tempWinC2Y1; | |
38 | 1216 tXc2->WindowTab = tempWinC2Tab; |
1217 } | |
1218 | |
1219 | |
1220 uint8_t t3_test_customview_warnings(void) | |
1221 { | |
1222 uint8_t count = 0; | |
1223 | |
1224 count = 0; | |
1225 count += stateUsed->warnings.decoMissed; | |
1226 count += stateUsed->warnings.ppO2Low; | |
1227 count += stateUsed->warnings.ppO2High; | |
1228 //count += stateUsed->warnings.lowBattery; | |
1229 count += stateUsed->warnings.sensorLinkLost; | |
1230 count += stateUsed->warnings.fallback; | |
1231 | |
1232 return count; | |
1233 } | |
1234 | |
1235 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode) | |
1236 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1) | |
1237 { | |
1238 char text[256], textMain[256]; | |
1239 uint8_t textpointer, textpointerMain, lineFree, more; | |
1240 | |
1241 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); | |
1242 GFX_write_string(&FontT42,&t3c1,text,0); | |
1243 | |
1244 lineFree = 1; | |
1245 more = 0; | |
1246 | |
1247 textpointerMain = 0; | |
511 | 1248 textMain[textpointerMain++] = '\025'; /* red */ |
1249 textMain[textpointerMain++] = '\003'; /* doublesize */ | |
38 | 1250 |
1251 textpointer = 0; | |
1252 | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1253 text[textpointer++] = '\031'; |
38 | 1254 text[textpointer++] = TXT_2BYTE; |
1255 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
1256 if(stateUsed->warnings.decoMissed) | |
1257 { | |
1258 text[textpointer - 3] = '\025'; | |
1259 if(lineFree) | |
1260 { | |
1261 textMain[textpointerMain++] = TXT_2BYTE; | |
1262 textMain[textpointerMain++] = text[textpointer - 1]; | |
1263 textMain[textpointerMain] = 0; | |
1264 lineFree--; | |
1265 } | |
1266 else | |
1267 { | |
1268 more++; | |
1269 } | |
1270 } | |
1271 | |
1272 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1273 text[textpointer++] = '\031'; |
38 | 1274 text[textpointer++] = TXT_2BYTE; |
1275 text[textpointer++] = TXT2BYTE_WarnPPO2Low; | |
1276 if(stateUsed->warnings.ppO2Low) | |
1277 { | |
1278 text[textpointer - 3] = '\025'; | |
1279 if(lineFree) | |
1280 { | |
1281 textMain[textpointerMain++] = TXT_2BYTE; | |
1282 textMain[textpointerMain++] = text[textpointer - 1]; | |
1283 textMain[textpointerMain] = 0; | |
1284 lineFree--; | |
1285 } | |
1286 else | |
1287 { | |
1288 more++; | |
1289 } | |
1290 } | |
1291 | |
1292 text[textpointer++] = '\n'; | |
1293 text[textpointer++] = '\r'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1294 text[textpointer++] = '\031'; |
38 | 1295 text[textpointer++] = TXT_2BYTE; |
1296 text[textpointer++] = TXT2BYTE_WarnPPO2High; | |
1297 if(stateUsed->warnings.ppO2High) | |
1298 { | |
1299 text[textpointer - 3] = '\025'; | |
1300 if(lineFree) | |
1301 { | |
1302 textMain[textpointerMain++] = TXT_2BYTE; | |
1303 textMain[textpointerMain++] = text[textpointer - 1]; | |
1304 textMain[textpointerMain] = 0; | |
1305 lineFree--; | |
1306 } | |
1307 else | |
1308 { | |
1309 more++; | |
1310 } | |
1311 } | |
1312 | |
1313 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1314 text[textpointer++] = '\031'; |
38 | 1315 text[textpointer++] = TXT_2BYTE; |
1316 text[textpointer++] = TXT2BYTE_WarnFallback; | |
1317 if(stateUsed->warnings.fallback) | |
1318 { | |
1319 text[textpointer - 3] = '\025'; | |
1320 if(lineFree) | |
1321 { | |
1322 textMain[textpointerMain++] = TXT_2BYTE; | |
1323 textMain[textpointerMain++] = text[textpointer - 1]; | |
1324 textMain[textpointerMain] = 0; | |
1325 lineFree--; | |
1326 } | |
1327 else | |
1328 { | |
1329 more++; | |
1330 } | |
1331 } | |
1332 | |
1333 text[textpointer++] = '\n'; | |
1334 text[textpointer++] = '\r'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1335 text[textpointer++] = '\031'; |
38 | 1336 text[textpointer++] = TXT_2BYTE; |
1337 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; | |
1338 if(stateUsed->warnings.sensorLinkLost) | |
1339 { | |
1340 text[textpointer - 3] = '\025'; | |
1341 if(lineFree) | |
1342 { | |
1343 textMain[textpointerMain++] = TXT_2BYTE; | |
1344 textMain[textpointerMain++] = text[textpointer - 1]; | |
1345 textMain[textpointerMain] = 0; | |
1346 lineFree--; | |
1347 } | |
1348 else | |
1349 { | |
1350 more++; | |
1351 } | |
1352 } | |
1353 | |
1354 /* | |
1355 text[textpointer++] = '\t'; | |
527
962d7b2c18c6
Do not show gases in "Off" state in custom gas list:
Ideenmodellierer
parents:
518
diff
changeset
|
1356 text[textpointer++] = '\031'; |
38 | 1357 text[textpointer++] = TXT_2BYTE; |
1358 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | |
1359 if(stateUsed->warnings.lowBattery) | |
1360 { | |
1361 text[textpointer - 3] = '\025'; | |
1362 if(lineFree) | |
1363 { | |
1364 textMain[textpointerMain++] = TXT_2BYTE; | |
1365 textMain[textpointerMain++] = text[textpointer - 1]; | |
1366 textMain[textpointerMain] = 0; | |
1367 lineFree--; | |
1368 } | |
1369 else | |
1370 { | |
1371 more++; | |
1372 } | |
1373 } | |
1374 */ | |
1375 text[textpointer] = 0; | |
1376 /* | |
1377 if(more) | |
1378 { | |
1379 text[textpointer++] = '\002'; | |
1380 text[textpointer++] = '+'; | |
1381 if(more < 10) | |
1382 text[textpointer++] = '0' + more; | |
1383 else | |
1384 text[textpointer++] = 'X'; | |
1385 text[textpointer] = 0; | |
1386 } | |
1387 */ | |
511 | 1388 GFX_write_string(&FontT48,&t3c1,textMain,0); |
38 | 1389 if(more) |
1390 { | |
511 | 1391 GFX_write_string(&FontT48,&t3c2,text,0); |
38 | 1392 } |
1393 } | |
1394 | |
496 | 1395 uint8_t t3_customview_disabled(uint8_t view) |
1396 { | |
1397 uint8_t i = 0; | |
1398 uint8_t cv_disabled = 0; | |
1399 const uint8_t *pcv_changelist; | |
1400 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen; | |
1401 | |
511 | 1402 pcv_changelist = cv_changelist_BS; |
496 | 1403 |
1404 while(pcv_changelist[i] != CVIEW_T3_END) | |
1405 { | |
1406 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i])) | |
1407 { | |
1408 cv_disabled = 1; | |
1409 break; | |
1410 } | |
1411 i++; | |
1412 } | |
1413 | |
1414 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && | |
1415 ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0))) | |
1416 { | |
1417 cv_disabled = 1; | |
1418 } | |
1419 | |
1420 return cv_disabled; | |
1421 } | |
38 | 1422 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1423 void t3_change_customview(uint8_t action) |
38 | 1424 { |
511 | 1425 |
496 | 1426 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); |
38 | 1427 } |
1428 | |
1429 | |
511 | 1430 void t3_basics_change_customview(uint8_t *tX_selection_customview,const uint8_t *tX_customviews, uint8_t action) |
38 | 1431 { |
1432 const SDecoinfo * pDecoinfo; | |
1433 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1434 pDecoinfo = &stateUsed->decolistBuehlmann; | |
1435 else | |
1436 pDecoinfo = &stateUsed->decolistVPM; | |
1437 | |
511 | 1438 uint8_t curViewIdx = 0xff; |
1439 uint8_t index = 0; | |
1440 uint8_t lastViewIdx = 0; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1441 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ |
38 | 1442 |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1443 /* set pointer to currently selected view and count number of entries */ |
511 | 1444 while((tX_customviews[index] != CVIEW_T3_END)) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1445 { |
511 | 1446 if (tX_customviews[index] == *tX_selection_customview) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1447 { |
511 | 1448 curViewIdx = index; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1449 } |
511 | 1450 index++; |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1451 } |
511 | 1452 if(curViewIdx == 0xff) /* called with unknown view */ |
496 | 1453 { |
511 | 1454 curViewIdx = 0; |
1455 *tX_selection_customview = tX_customviews[index]; | |
496 | 1456 } |
511 | 1457 lastViewIdx = index; |
1458 index = curViewIdx; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1459 do |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1460 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1461 iterate = 0; |
496 | 1462 switch(action) |
1463 { | |
1464 case ACTION_BUTTON_ENTER: | |
1465 case ACTION_PITCH_POS: | |
1466 | |
511 | 1467 if(tX_customviews[index] != CVIEW_T3_END) |
496 | 1468 { |
511 | 1469 index++; |
1470 } | |
1471 if(tX_customviews[index] == CVIEW_T3_END) | |
1472 { | |
1473 index = 0; | |
496 | 1474 } |
1475 break; | |
1476 case ACTION_PITCH_NEG: | |
511 | 1477 if(index == 0) |
496 | 1478 { |
511 | 1479 index = lastViewIdx - 1; |
496 | 1480 } |
1481 else | |
1482 { | |
511 | 1483 index--; |
496 | 1484 } |
1485 break; | |
1486 default: | |
1487 break; | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1488 } |
496 | 1489 |
511 | 1490 if(t3_customview_disabled(tX_customviews[index])) |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1491 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1492 iterate = 1; |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1493 } |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1494 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
|
1495 { |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1496 iterate = 1; |
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1497 } |
529
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1498 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
|
1499 { |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1500 iterate = 1; |
0e1db77b2aca
Added skip condition in custom view selection:
Ideenmodellierer
parents:
527
diff
changeset
|
1501 } |
496 | 1502 if((iterate) && (action == ACTION_END)) |
1503 { | |
1504 action = ACTION_BUTTON_ENTER; | |
1505 } | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
1506 }while (iterate == 1); |
38 | 1507 |
511 | 1508 *tX_selection_customview = tX_customviews[index]; |
38 | 1509 } |
1510 | |
1511 | |
1512 void t3_basics_colorscheme_mod(char *text) | |
1513 { | |
1514 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
1515 { | |
1516 text[0] = '\027'; | |
1517 } | |
1518 } | |
1519 | |
1520 | |
496 | 1521 point_t t3_compass_circle(uint8_t id, uint16_t degree, point_t center) |
38 | 1522 { |
1523 float fCos, fSin; | |
1524 const float piMult = ((2 * 3.14159) / 360); | |
1525 // const int radius[4] = {95,105,115,60}; | |
1526 const int radius[4] = {85,95,105,90}; | |
496 | 1527 static point_t forcenter = {.x = 900, .y = 500}; /* used to identify change of circle position */ |
38 | 1528 static point_t r[4][360] = { 0 }; |
1529 | |
496 | 1530 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 | 1531 { |
1532 for(int i=0;i<360;i++) | |
1533 { | |
1534 fCos = cos(i * piMult); | |
1535 fSin = sin(i * piMult); | |
1536 for(int j=0;j<4;j++) | |
1537 { | |
496 | 1538 r[j][i].x = center.x + (int)(fSin * radius[j]); |
1539 r[j][i].y = center.y + (int)(fCos * radius[j]); | |
38 | 1540 } |
1541 } | |
496 | 1542 forcenter.x = center.x; |
1543 forcenter.y = center.y; | |
38 | 1544 } |
1545 if(id > 3) id = 0; | |
1546 if(degree > 359) degree = 0; | |
1547 return r[id][degree]; | |
1548 } | |
1549 | |
1550 | |
496 | 1551 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading) |
38 | 1552 { |
496 | 1553 uint8_t loop = 0; |
38 | 1554 uint16_t LineHeading; |
496 | 1555 |
38 | 1556 static int32_t LastHeading = 0; |
1557 int32_t newHeading = 0; | |
1558 int32_t diff = 0; | |
1559 int32_t diff2 = 0; | |
1560 | |
1561 int32_t diffAbs = 0; | |
1562 int32_t diffAbs2 = 0; | |
1563 | |
1564 newHeading = ActualHeading; | |
1565 | |
1566 diff = newHeading - LastHeading; | |
1567 | |
1568 if(newHeading < LastHeading) | |
1569 diff2 = newHeading + 360 - LastHeading; | |
1570 else | |
1571 diff2 = newHeading - 360 - LastHeading; | |
1572 | |
1573 diffAbs = diff; | |
1574 if(diffAbs < 0) | |
1575 diffAbs *= -1; | |
1576 | |
1577 diffAbs2 = diff2; | |
1578 if(diffAbs2 < 0) | |
1579 diffAbs2 *= -1; | |
1580 | |
1581 if(diffAbs <= diffAbs2) | |
1582 newHeading = LastHeading + (diff / 2); | |
1583 else | |
1584 newHeading = LastHeading + (diff2 / 2); | |
1585 | |
1586 if(newHeading < 0) | |
1587 newHeading += 360; | |
1588 else | |
1589 if(newHeading >= 360) | |
1590 newHeading -= 360; | |
1591 | |
1592 LastHeading = newHeading; | |
1593 ActualHeading = newHeading; | |
1594 | |
1595 if (ActualHeading < 90) | |
1596 ActualHeading += 360; | |
1597 | |
1598 while(ActualHeading > 359) ActualHeading -= 360; | |
1599 | |
1600 LineHeading = 360 - ActualHeading; | |
496 | 1601 |
1602 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font030); // North | |
38 | 1603 LineHeading += 90; |
496 | 1604 |
1605 for (loop = 0; loop < 3; loop++) | |
1606 { | |
1607 if(LineHeading > 359) LineHeading -= 360; | |
1608 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Main Ticks | |
1609 LineHeading += 90; | |
1610 } | |
38 | 1611 |
1612 LineHeading = 360 - ActualHeading; | |
1613 LineHeading += 45; | |
496 | 1614 |
1615 for (loop = 0; loop < 4; loop++) | |
1616 { | |
1617 if(LineHeading > 359) LineHeading -= 360; | |
1618 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1619 LineHeading += 90; | |
1620 } | |
38 | 1621 |
1622 LineHeading = 360 - ActualHeading; | |
1623 LineHeading += 22; | |
496 | 1624 for (loop = 0; loop < 8; loop++) |
1625 { | |
1626 if(LineHeading > 359) LineHeading -= 360; | |
1627 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick | |
1628 LineHeading += 45; | |
1629 } | |
38 | 1630 if(UserSetHeading) |
1631 { | |
1632 LineHeading = UserSetHeading + 360 - ActualHeading; | |
1633 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1634 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserHeadingTick); |
38 | 1635 |
1636 // R�ckpeilung, User Back Heading | |
1637 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
1638 if(LineHeading > 359) LineHeading -= 360; | |
1639 if(LineHeading > 359) LineHeading -= 360; | |
496 | 1640 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserBackHeadingTick); |
38 | 1641 } |
1642 | |
1643 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); | |
1644 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); | |
1645 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); | |
1646 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1647 |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1648 uint8_t t3_GetEnabled_customviews() |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1649 { |
496 | 1650 uint8_t *pViews; |
1651 uint8_t increment = 1; | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1652 uint8_t enabledViewCnt = 0; |
496 | 1653 |
511 | 1654 pViews = (uint8_t*)t3_customviewsStandard; |
496 | 1655 while((*pViews != CVIEW_T3_END)) |
1656 { | |
1657 increment = 1; | |
1658 /* check if view is enabled */ | |
1659 if(t3_customview_disabled(*pViews)) | |
1660 { | |
1661 increment = 0; | |
1662 } | |
1663 pViews++; | |
1664 enabledViewCnt += increment; | |
1665 } | |
384
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1666 return enabledViewCnt; |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1667 } |
427ae9f8e28e
Consider number of available t3 views in sector handling:
ideenmodellierer
parents:
272
diff
changeset
|
1668 |
518 | 1669 uint8_t t3_getCustomView(void) |
1670 { | |
1671 return t3_selection_customview; | |
1672 } |