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