Mercurial > public > ostc4
annotate Discovery/Src/t9.c @ 133:acc98f5bd8c4 FlipDisplay
Intoduced transfer abort function for data exchange recovery
author | Ideenmodellierer |
---|---|
date | Tue, 19 Feb 2019 18:15:35 +0100 |
parents | b7689d9e888a |
children |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/t9.c | |
5 /// \brief Template for screen with 4+1+4 screen layout with plugin | |
6 /// \author Heinrichs Weikamp gmbh | |
7 /// \date 23-April-2014 | |
8 /// | |
9 /// \details | |
10 /// Bonex t9 -> sp�ter auch andere Pro Anzeigen | |
11 /// Nur Tauchmodus, sonst Umschaltung t7 | |
12 /// frames used 26 for compass laufband und 23 f�r t9screen | |
13 /// | |
14 /// $Id$ | |
15 /////////////////////////////////////////////////////////////////////////////// | |
16 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
17 /// | |
18 /// This program is free software: you can redistribute it and/or modify | |
19 /// it under the terms of the GNU General Public License as published by | |
20 /// the Free Software Foundation, either version 3 of the License, or | |
21 /// (at your option) any later version. | |
22 /// | |
23 /// This program is distributed in the hope that it will be useful, | |
24 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
26 /// GNU General Public License for more details. | |
27 /// | |
28 /// You should have received a copy of the GNU General Public License | |
29 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 ////////////////////////////////////////////////////////////////////////////// | |
31 | |
32 /* Includes ------------------------------------------------------------------*/ | |
33 #include "t9.h" | |
34 | |
35 #include "data_exchange_main.h" | |
36 #include "decom.h" | |
37 #include "gfx_fonts.h" | |
38 #include "logbook_miniLive.h" | |
39 #include "math.h" | |
40 #include "tHome.h" | |
41 #include "simulation.h" | |
42 #include "timer.h" | |
43 #include "unit.h" | |
44 | |
45 /* Private function prototypes -----------------------------------------------*/ | |
46 | |
47 void t9_refresh_divemode(void); | |
48 void t9_refresh_divemode_userselected_left_lower_corner(void); | |
49 void t9_refresh_customview(void); | |
50 | |
51 void t9_draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide); | |
52 | |
53 void t9_tissues(const SDiveState * pState); | |
54 void t9_compass(uint16_t ActualHeading, uint16_t UserSetHeading); | |
55 void t9_scooter(void); | |
56 void t9_debug(void); | |
57 void t9_SummaryOfLeftCorner(void); | |
58 | |
59 void t9_miniLiveLogProfile(void); | |
60 void t9_colorscheme_mod(char *text); | |
61 | |
62 uint8_t t9_test_customview_warnings(void); | |
63 void t9_show_customview_warnings(void); | |
64 | |
65 void t9_show_customview_warnings_surface_mode(void); | |
66 | |
67 uint8_t t9_customtextPrepare(char * text); | |
68 | |
69 /* Importend function prototypes ---------------------------------------------*/ | |
70 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); | |
71 | |
72 /* Exported variables --------------------------------------------------------*/ | |
73 | |
74 /* Private variables ---------------------------------------------------------*/ | |
75 float t9_depthLastCall[9] = { 0,0,0,0,0,0,0,0,0}; | |
76 uint8_t idt9_depthLastCall = 0; | |
77 float t9_temperatureLastCall[3] = { 0,0,0}; | |
78 uint8_t idt9_temperatureLastCall = 0; | |
79 | |
80 GFX_DrawCfgScreen t9screen; | |
81 GFX_DrawCfgScreen t9screenCompass; | |
82 | |
83 /* left 3 fields | |
84 * right 3 fields | |
85 * centered one field on top of customview, one below | |
86 * customview header + customview + warning | |
87 */ | |
88 GFX_DrawCfgWindow t9l1, t9l2, t9l3, t9l4; | |
89 GFX_DrawCfgWindow t9r1, t9r2, t9r3, t9r4; | |
90 GFX_DrawCfgWindow t9c1, t9batt, t9c2, t9charge; | |
91 GFX_DrawCfgWindow t9cH, t9cC, t9cW, t9cY0free; | |
92 GFX_DrawCfgWindow t9pCompass; | |
93 GFX_DrawCfgWindow t9surfaceL, t9surfaceR; | |
94 | |
95 uint8_t t9_selection_custom_field = 0; | |
96 uint8_t t9_selection_customview = 1; | |
97 | |
98 typedef struct{ | |
99 uint32_t pointer; | |
100 uint32_t x0; | |
101 uint32_t y0; | |
102 uint32_t width; | |
103 uint32_t height; | |
104 } S9Background; | |
105 | |
106 S9Background t9_background = | |
107 { | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
108 .pointer = 0, |
38 | 109 }; |
110 | |
111 /* Private types -------------------------------------------------------------*/ | |
112 const uint8_t t9_customviewsDiveStandard[] = | |
113 { | |
114 CVIEW_sensors, | |
115 CVIEW_Compass, | |
116 CVIEW_Decolist, | |
117 CVIEW_Tissues, | |
118 CVIEW_Profile, | |
119 CVIEW_Gaslist, | |
120 CVIEW_sensors_mV, | |
121 CVIEW_EADTime, | |
122 // CVIEW_SummaryOfLeftCorner, da hier der scooter drin ist | |
123 CVIEW_noneOrDebug, | |
124 CVIEW_END, | |
125 CVIEW_END | |
126 }; | |
127 | |
128 const uint8_t t9_customviewsDiveScooter[] = | |
129 { | |
130 CVIEW_Scooter, | |
131 CVIEW_sensors, | |
132 CVIEW_Compass, | |
133 CVIEW_Decolist, | |
134 CVIEW_Tissues, | |
135 CVIEW_Profile, | |
136 CVIEW_Gaslist, | |
137 CVIEW_sensors_mV, | |
138 CVIEW_EADTime, | |
139 CVIEW_SummaryOfLeftCorner, | |
140 CVIEW_noneOrDebug, | |
141 CVIEW_END, | |
142 CVIEW_END | |
143 }; | |
144 | |
145 | |
146 const uint8_t *t9_customviewsDive = t9_customviewsDiveStandard; | |
147 | |
148 #define TEXTSIZE 16 | |
149 /* offset includes line: 2 = line +1 | |
150 * box (line) is 300 px | |
151 * inside is 296 px | |
152 * left of box are 249 px ( 0..248) | |
153 * right of box are 249 px (551 .. 799) | |
154 */ | |
155 | |
156 #define CUSTOMBOX_LINE_LEFT (250) | |
157 #define CUSTOMBOX_LINE_RIGHT (549) | |
158 #define CUSTOMBOX_INSIDE_OFFSET (2) | |
159 #define CUSTOMBOX_OUTSIDE_OFFSET (2) | |
160 #define CUSTOMBOX_SPACE_INSIDE (CUSTOMBOX_LINE_RIGHT + 1 - (CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_INSIDE_OFFSET)) | |
161 | |
162 | |
163 /* Exported functions --------------------------------------------------------*/ | |
164 | |
165 void t9_init(void) | |
166 { | |
167 if(getLicence() == LICENCEBONEX) | |
168 { | |
169 t9_customviewsDive = t9_customviewsDiveScooter; | |
170 } | |
171 | |
172 t9_selection_custom_field = 0; // 0 is the new scooter temperature | |
173 t9_selection_customview = t9_customviewsDive[0]; | |
174 | |
175 t9screen.FBStartAdress = 0; | |
176 t9screen.ImageHeight = 480; | |
177 t9screen.ImageWidth = 800; | |
178 t9screen.LayerIndex = 1; | |
179 | |
180 t9screenCompass.FBStartAdress = 0; | |
181 t9screenCompass.ImageHeight = 240; | |
182 t9screenCompass.ImageWidth = 1600; | |
183 t9screenCompass.LayerIndex = 0; | |
184 | |
185 t9l1.Image = &t9screen; | |
186 t9l1.WindowNumberOfTextLines = 2; | |
187 t9l1.WindowLineSpacing = 5; // Abstand von Y0 | |
188 t9l1.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | |
189 t9l1.WindowX0 = 0; | |
190 t9l1.WindowX1 = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET; | |
191 t9l1.WindowY1 = 479; | |
192 t9l1.WindowY0 = t9l1.WindowY1 - 119; | |
193 | |
194 t9l2.Image = &t9screen; | |
195 t9l2.WindowNumberOfTextLines = 2; | |
196 t9l2.WindowLineSpacing = 5; // Abstand von Y0 | |
197 t9l2.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | |
198 t9l2.WindowX0 = 0; | |
199 t9l2.WindowX1 = t9l1.WindowX1; | |
200 t9l2.WindowY1 = t9l1.WindowY0 - 4; | |
201 t9l2.WindowY0 = t9l2.WindowY1 - 119; | |
202 | |
203 t9l3.Image = &t9screen; | |
204 t9l3.WindowNumberOfTextLines = 2; | |
205 t9l3.WindowLineSpacing = 5; // Abstand von Y0 | |
206 t9l3.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | |
207 t9l3.WindowX0 = 0; | |
208 t9l3.WindowX1 = t9l1.WindowX1; | |
209 t9l3.WindowY1 = t9l2.WindowY0 - 4; | |
210 t9l3.WindowY0 = t9l3.WindowY1 - 119; | |
211 | |
212 t9l4.Image = &t9screen; | |
213 t9l4.WindowNumberOfTextLines = 2; | |
214 t9l4.WindowLineSpacing = 50; // Abstand von Y0 | |
215 t9l4.WindowTab = 100; // vermtl. ohne Verwendung in diesem Fenster | |
216 t9l4.WindowX0 = 0; | |
217 t9l4.WindowX1 = t9l1.WindowX1; | |
218 t9l4.WindowY1 = t9l3.WindowY0 - 4; | |
219 t9l4.WindowY0 = 0; | |
220 | |
221 t9r1.Image = &t9screen; | |
222 t9r1.WindowNumberOfTextLines = 2; | |
223 t9r1.WindowLineSpacing = t9l1.WindowLineSpacing; | |
224 t9r1.WindowTab = 100; | |
225 t9r1.WindowX0 = 550; | |
226 t9r1.WindowX1 = 799; | |
227 t9r1.WindowY0 = t9l1.WindowY0; | |
228 t9r1.WindowY1 = 479; | |
229 | |
230 t9r2.Image = &t9screen; | |
231 t9r2.WindowNumberOfTextLines = 2; | |
232 t9r2.WindowLineSpacing = t9l2.WindowLineSpacing; | |
233 t9r2.WindowTab = 100; | |
234 t9r2.WindowX0 = 550; | |
235 t9r2.WindowX1 = 799; | |
236 t9r2.WindowY0 = t9l2.WindowY0; | |
237 t9r2.WindowY1 = t9l2.WindowY1; | |
238 | |
239 t9r3.Image = &t9screen; | |
240 t9r3.WindowNumberOfTextLines = 2; | |
241 t9r3.WindowLineSpacing = t9l3.WindowLineSpacing; | |
242 t9r3.WindowTab = 100; | |
243 t9r3.WindowX0 = 550; | |
244 t9r3.WindowX1 = 799; | |
245 t9r3.WindowY0 = t9l3.WindowY0; | |
246 t9r3.WindowY1 = t9l3.WindowY1; | |
247 | |
248 t9r4.Image = &t9screen; | |
249 t9r4.WindowNumberOfTextLines = 2; | |
250 t9r4.WindowLineSpacing = t9l4.WindowLineSpacing; | |
251 t9r4.WindowTab = 100; | |
252 t9r4.WindowX0 = 550; | |
253 t9r4.WindowX1 = 799; | |
254 t9r4.WindowY0 = t9l4.WindowY0; | |
255 t9r4.WindowY1 = t9l4.WindowY1; | |
256 | |
257 | |
258 /* | |
259 t9r3.Image = &t9screen; | |
260 t9r3.WindowNumberOfTextLines = 2; | |
261 t9r3.WindowLineSpacing = 0;//t9l3.WindowLineSpacing; | |
262 t9r3.WindowTab = 100; | |
263 t9r3.WindowX0 = CUSTOMBOX_LINE_RIGHT + CUSTOMBOX_OUTSIDE_OFFSET; | |
264 t9r3.WindowX1 = 799; | |
265 t9r3.WindowY0 = t9l3.WindowY0; | |
266 t9r3.WindowY1 = t9l3.WindowY1; | |
267 */ | |
268 t9cC.Image = &t9screen; | |
269 t9cC.WindowNumberOfTextLines = 3; | |
270 t9cC.WindowLineSpacing = 95; // Abstand von Y0 | |
271 t9cC.WindowTab = 100; | |
272 t9cC.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
273 t9cC.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
274 t9cC.WindowY0 = 90; | |
275 t9cC.WindowY1 = 434 - 95; | |
276 | |
277 t9cH.Image = &t9screen; | |
278 t9cH.WindowNumberOfTextLines = 1; | |
279 t9cH.WindowLineSpacing = 95; // Abstand von Y0 | |
280 t9cH.WindowTab = 100; | |
281 t9cH.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
282 t9cH.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
283 t9cH.WindowY0 = 434 - 94; | |
284 t9cH.WindowY1 = 434; | |
285 | |
286 t9cW.Image = &t9screen; | |
287 t9cW.WindowNumberOfTextLines = 3; | |
288 t9cW.WindowLineSpacing = 95; // Abstand von Y0 | |
289 t9cW.WindowTab = 100; | |
290 t9cW.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
291 t9cW.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
292 t9cW.WindowY0 = 90; | |
293 t9cW.WindowY1 = 434 - 95; | |
294 | |
295 t9cY0free.Image = &t9screen; | |
296 t9cY0free.WindowNumberOfTextLines = 1; | |
297 t9cY0free.WindowLineSpacing = 95; | |
298 t9cY0free.WindowTab = 100; | |
299 t9cY0free.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
300 t9cY0free.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
301 t9cY0free.WindowY0 = 90; | |
302 t9cY0free.WindowY1 = 434 - 95; | |
303 | |
304 t9batt.Image = &t9screen; | |
305 t9batt.WindowNumberOfTextLines = 1; | |
306 t9batt.WindowLineSpacing = 10; | |
307 t9batt.WindowTab = 100; | |
308 t9batt.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
309 t9batt.WindowX0 = t9batt.WindowX1 - (52+52); | |
310 t9batt.WindowY1 = 479; | |
311 t9batt.WindowY0 = t9batt.WindowY1 - 25; | |
312 | |
313 t9charge.Image = &t9screen; | |
314 t9charge.WindowNumberOfTextLines = 1; | |
315 t9charge.WindowLineSpacing = 10; | |
316 t9charge.WindowTab = 100; | |
317 t9charge.WindowX1 = t9batt.WindowX1 - 18; | |
318 t9charge.WindowX0 = t9charge.WindowX1 - 14; | |
319 t9charge.WindowY1 = 479; | |
320 t9charge.WindowY0 = t9batt.WindowY1 - 25; | |
321 | |
322 t9c1.Image = &t9screen; | |
323 t9c1.WindowNumberOfTextLines = 1; | |
324 t9c1.WindowLineSpacing = 10; | |
325 t9c1.WindowTab = 100; | |
326 t9c1.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
327 t9c1.WindowX1 = t9batt.WindowX0 - 18; | |
328 t9c1.WindowY0 = 435; | |
329 t9c1.WindowY1 = 479; | |
330 | |
331 t9c2.Image = &t9screen; | |
332 t9c2.WindowNumberOfTextLines = 1; | |
333 t9c2.WindowLineSpacing = 0; // Abstand von Y0 | |
334 t9c2.WindowTab = 100; | |
335 t9c2.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
336 t9c2.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET; | |
337 t9c2.WindowY0 = 0; | |
338 t9c2.WindowY1 = 69; | |
339 | |
340 t9pCompass.Image = &t9screenCompass; | |
341 t9pCompass.WindowNumberOfTextLines = 1; | |
342 t9pCompass.WindowLineSpacing = 100; // Abstand von Y0 | |
343 t9pCompass.WindowTab = 100; | |
344 t9pCompass.WindowX0 = 0; | |
345 t9pCompass.WindowX1 = 1600-1; | |
346 t9pCompass.WindowY0 = 0; | |
347 t9pCompass.WindowY1 = 100-1; | |
348 | |
349 init_t9_compass(); | |
350 } | |
351 | |
352 uint8_t t9_test_customview_warnings(void) | |
353 { | |
354 uint8_t count = 0; | |
355 | |
356 count = 0; | |
357 count += stateUsed->warnings.decoMissed; | |
358 count += stateUsed->warnings.ppO2Low; | |
359 count += stateUsed->warnings.ppO2High; | |
360 //count += stateUsed->warnings.lowBattery; | |
361 count += stateUsed->warnings.sensorLinkLost; | |
362 count += stateUsed->warnings.fallback; | |
363 return count; | |
364 } | |
365 | |
366 void t9_refresh(void) | |
367 { | |
368 static uint8_t last_mode = MODE_SURFACE; | |
369 | |
370 SStateList status; | |
371 get_globalStateList(&status); | |
372 | |
373 if(stateUsed->mode != MODE_DIVE) | |
374 { | |
375 last_mode = MODE_SURFACE; | |
376 settingsGetPointer()->design = 7; | |
377 if(t9screen.FBStartAdress) | |
378 { | |
379 releaseFrame(23,t9screen.FBStartAdress); | |
380 t9screen.FBStartAdress = 0; | |
381 } | |
382 return; | |
383 } | |
384 | |
385 if(status.base != BaseHome) | |
386 return; | |
387 | |
388 t9screen.FBStartAdress = getFrame(23); | |
389 t9_background.pointer = 0; | |
390 | |
391 if(stateUsed->mode == MODE_DIVE) | |
392 { | |
393 if(last_mode != MODE_DIVE) | |
394 { | |
395 last_mode = MODE_DIVE; | |
396 /* lower left corner primary */ | |
397 // t9_selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
398 t9_selection_custom_field = 0; | |
399 /* custom view primary OR debug if automatic return is off */ | |
400 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
401 t9_selection_customview = CVIEW_noneOrDebug; | |
402 else | |
403 t9_selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
404 } | |
405 | |
406 if(status.page == PageSurface) | |
407 set_globalState(StD); | |
408 | |
409 t9_refresh_divemode(); | |
410 } | |
411 | |
412 if(t9_background.pointer) | |
413 { | |
414 GFX_SetFrameTop(t9screen.FBStartAdress); | |
415 GFX_SetFrameBottom(t9_background.pointer,t9_background.x0 , t9_background.y0, t9_background.width, t9_background.height); | |
416 } | |
417 else | |
418 GFX_SetFramesTopBottom(t9screen.FBStartAdress, NULL,480); | |
419 | |
420 releaseAllFramesExcept(23,t9screen.FBStartAdress); | |
421 } | |
422 | |
423 | |
424 void original_t9_refresh(void) | |
425 { | |
426 static uint8_t last_mode = MODE_SURFACE; | |
427 | |
428 // uint32_t oldScreen;//, oldPlugin; | |
429 SStateList status; | |
430 get_globalStateList(&status); | |
431 | |
432 | |
433 if(stateUsed->mode == MODE_DIVE) | |
434 { | |
435 if(last_mode != MODE_DIVE) | |
436 { | |
437 last_mode = MODE_DIVE; | |
438 /* lower left corner primary */ | |
439 t9_selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
440 /* custom view primary OR debug if automatic return is off */ | |
441 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo)) | |
442 t9_selection_customview = CVIEW_noneOrDebug; | |
443 else | |
444 t9_selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
445 } | |
446 if(status.page == PageSurface) | |
447 set_globalState(StD); | |
448 | |
449 t9_refresh_divemode(); | |
450 } | |
451 else | |
452 { | |
453 if(last_mode != MODE_SURFACE) | |
454 { | |
455 last_mode = MODE_SURFACE; | |
456 // CHANGE HERE | |
457 } | |
458 if(status.page == PageDive) | |
459 set_globalState(StS); | |
460 } | |
461 | |
462 if(status.base == BaseHome) | |
463 { | |
464 if(t9_background.pointer) | |
465 { | |
466 GFX_SetFrameTop(t9screen.FBStartAdress); | |
467 GFX_SetFrameBottom(t9_background.pointer,t9_background.x0 , t9_background.y0, t9_background.width, t9_background.height); | |
468 } | |
469 else | |
470 GFX_SetFramesTopBottom(t9screen.FBStartAdress, NULL,480); | |
471 } | |
472 | |
473 releaseAllFramesExcept(23,t9screen.FBStartAdress); | |
474 } | |
475 | |
476 /* Private functions ---------------------------------------------------------*/ | |
477 | |
478 | |
479 void t9_show_customview_warnings(void) | |
480 { | |
481 char text[256]; | |
482 uint8_t textpointer, lineFree; | |
483 | |
484 text[0] = '\025'; | |
485 text[1] = '\f'; | |
486 text[2] = '\001'; | |
487 text[3] = TXT_Warning; | |
488 text[4] = 0; | |
489 GFX_write_string(&FontT42,&t9cH,text,0); | |
490 | |
491 textpointer = 0; | |
492 lineFree = 5; | |
493 | |
494 if(lineFree && stateUsed->warnings.decoMissed) | |
495 { | |
496 text[textpointer++] = TXT_2BYTE; | |
497 text[textpointer++] = TXT2BYTE_WarnDecoMissed; | |
498 text[textpointer++] = '\n'; | |
499 text[textpointer++] = '\r'; | |
500 text[textpointer] = 0; | |
501 lineFree--; | |
502 } | |
503 | |
504 if(lineFree && stateUsed->warnings.fallback) | |
505 { | |
506 text[textpointer++] = TXT_2BYTE; | |
507 text[textpointer++] = TXT2BYTE_WarnFallback; | |
508 text[textpointer++] = '\n'; | |
509 text[textpointer++] = '\r'; | |
510 text[textpointer] = 0; | |
511 lineFree--; | |
512 } | |
513 | |
514 if(lineFree && stateUsed->warnings.ppO2Low) | |
515 { | |
516 text[textpointer++] = TXT_2BYTE; | |
517 text[textpointer++] = TXT2BYTE_WarnPPO2Low; | |
518 text[textpointer++] = '\n'; | |
519 text[textpointer++] = '\r'; | |
520 text[textpointer] = 0; | |
521 lineFree--; | |
522 } | |
523 | |
524 if(lineFree && stateUsed->warnings.ppO2High) | |
525 { | |
526 text[textpointer++] = TXT_2BYTE; | |
527 text[textpointer++] = TXT2BYTE_WarnPPO2High; | |
528 text[textpointer++] = '\n'; | |
529 text[textpointer++] = '\r'; | |
530 text[textpointer] = 0; | |
531 lineFree--; | |
532 } | |
533 | |
534 if(lineFree && stateUsed->warnings.sensorLinkLost) | |
535 { | |
536 text[textpointer++] = TXT_2BYTE; | |
537 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost; | |
538 text[textpointer++] = '\n'; | |
539 text[textpointer++] = '\r'; | |
540 text[textpointer] = 0; | |
541 lineFree--; | |
542 } | |
543 /* | |
544 if(lineFree && stateUsed->warnings.lowBattery) | |
545 { | |
546 text[textpointer++] = TXT_2BYTE; | |
547 text[textpointer++] = TXT2BYTE_WarnBatteryLow; | |
548 text[textpointer++] = '\n'; | |
549 text[textpointer++] = '\r'; | |
550 text[textpointer] = 0; | |
551 lineFree--; | |
552 } | |
553 */ | |
554 GFX_write_string(&FontT48,&t9cW,text,1); | |
555 } | |
556 | |
557 | |
558 void t9_set_customview_to_primary(void) | |
559 { | |
560 if(stateUsed->mode == MODE_DIVE) | |
561 t9_selection_customview = settingsGetPointer()->tX_customViewPrimary; | |
562 } | |
563 | |
564 | |
565 void t9_change_customview(void) | |
566 { | |
567 const uint8_t *pViews; | |
568 | |
569 if(stateUsed->mode == MODE_DIVE) | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
570 { |
38 | 571 pViews = t9_customviewsDive; |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
572 while((*pViews != CVIEW_END) && (*pViews != t9_selection_customview)) |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
573 {pViews++;} |
38 | 574 |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
575 if(*pViews < CVIEW_END) |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
576 pViews++; |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
577 else |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
578 { |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
579 if(stateUsed->mode == MODE_DIVE) |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
580 pViews = t9_customviewsDive; |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
581 } |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
582 t9_selection_customview = *pViews; |
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
583 } |
38 | 584 else |
585 { | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
586 t9_selection_customview = 0; |
38 | 587 } |
588 // if((*pViews == CVIEW_Scooter) && (getLicence() != LICENCEBONEX)) | |
589 // pViews++; | |
590 | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
100
diff
changeset
|
591 |
38 | 592 } |
593 | |
594 | |
595 uint8_t t9_get_length_of_customtext(void) | |
596 { | |
597 uint8_t i = 0; | |
598 settingsGetPointer()->customtext[60-1] = 0; | |
599 while(settingsGetPointer()->customtext[i] > 0) | |
600 i++; | |
601 return i; | |
602 } | |
603 | |
604 | |
605 void t9_refresh_customview(void) | |
606 { | |
607 if((t9_selection_customview == CVIEW_Scooter) && (getLicence() != LICENCEBONEX)) | |
608 t9_change_customview(); | |
609 if((t9_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) | |
610 t9_change_customview(); | |
611 if((t9_selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0)) | |
612 t9_change_customview(); | |
613 if((t9_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) | |
614 t9_change_customview(); | |
615 | |
616 char text[256]; | |
617 uint16_t textpointer = 0; | |
618 int16_t start; | |
619 // int16_t shiftWindowY0; | |
620 RTC_DateTypeDef Sdate; | |
621 RTC_TimeTypeDef Stime; | |
622 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; // CVIEW_Gaslist | |
623 const SGasLine * pGasLine; // CVIEW_Gaslist | |
624 uint8_t oxygen, helium; // CVIEW_Gaslist | |
625 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime | |
626 | |
627 switch(t9_selection_customview) | |
628 { | |
629 case CVIEW_noneOrDebug: | |
630 if(settingsGetPointer()->showDebugInfo) | |
631 { | |
632 // header | |
633 strcpy(text,"\032\f\001Debug"); | |
634 GFX_write_string(&FontT42,&t9cH,text,0); | |
635 // content | |
636 t9_debug(); | |
637 } | |
638 break; | |
639 case CVIEW_SummaryOfLeftCorner: | |
640 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Summary); | |
641 GFX_write_string(&FontT42,&t9cH,text,0); | |
642 // content | |
643 t9_SummaryOfLeftCorner(); | |
644 break; | |
645 case CVIEW_Scooter: | |
646 snprintf(text,100,"\032\f\001Scooter"); | |
647 GFX_write_string(&FontT42,&t9cH,text,0); | |
648 t9_scooter(); | |
649 break; | |
650 case CVIEW_Gaslist: | |
651 // a lot of code taken from tMenuGas.c | |
652 // header | |
653 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Gaslist); | |
654 GFX_write_string(&FontT42,&t9cH,text,0); | |
655 // content | |
656 textpointer = 0; | |
657 t9cY0free.WindowY0 = t9cC.WindowY0 - 10; | |
658 t9cY0free.WindowLineSpacing = 48+9; | |
659 t9cY0free.WindowNumberOfTextLines = 5; // NUM_GASES == 5 | |
660 t9cY0free.WindowTab = 420; | |
661 | |
662 pGasLine = settingsGetPointer()->gas; | |
663 if(actualLeftMaxDepth(stateUsed)) | |
664 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100; | |
665 else | |
666 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100; | |
667 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100; | |
668 for(int gasId=1;gasId<=NUM_GASES;gasId++) | |
669 { | |
670 textpointer = 0; | |
671 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100; | |
672 if(pGasLine[gasId].note.ub.active == 0) | |
673 strcpy(&text[textpointer++],"\021"); | |
674 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow)) | |
675 strcpy(&text[textpointer++],"\025"); | |
676 else | |
677 strcpy(&text[textpointer++],"\030"); | |
678 | |
679 text[textpointer++] = ' '; | |
680 oxygen = pGasLine[gasId].oxygen_percentage; | |
681 helium = pGasLine[gasId].helium_percentage; | |
682 textpointer += write_gas(&text[textpointer], oxygen, helium); | |
683 // Wechseltiefe | |
684 if(pGasLine[gasId].depth_meter) | |
685 { | |
100 | 686 |
38 | 687 } |
688 GFX_write_string(&FontT42, &t9cY0free, text, gasId); | |
689 } | |
690 break; | |
691 case CVIEW_EADTime: | |
692 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Info ); | |
693 GFX_write_string(&FontT42,&t9cH,text,0); | |
694 textpointer = 0; | |
695 | |
696 t9cY0free.WindowY0 = t9cC.WindowY0 - 10; | |
697 t9cY0free.WindowLineSpacing = 48; | |
698 t9cY0free.WindowNumberOfTextLines = 6; | |
699 | |
700 // time | |
701 snprintf(text,100,"\032\001%c%c",TXT_2BYTE,TXT2BYTE_Clock ); | |
702 GFX_write_string(&FontT42, &t9cY0free, text, 1); | |
703 | |
704 translateDate(stateRealGetPointer()->lifeData.dateBinaryFormat, &Sdate); | |
705 translateTime(stateRealGetPointer()->lifeData.timeBinaryFormat, &Stime); | |
706 if(Stime.Seconds % 2) | |
707 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d",Stime.Hours,Stime.Minutes); | |
708 else | |
709 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d",Stime.Hours,Stime.Minutes); | |
710 GFX_write_string(&FontT42, &t9cY0free, text, 2); | |
711 | |
712 // EAD / END | |
713 // The equivalent air depth can be calculated for depths in metres as follows: | |
714 // EAD = (Depth + 10) � Fraction of N2 / 0.79 - 10 (wikipedia) | |
715 // The equivalent narcotic depth can be calculated for depths in metres as follows: | |
716 // END = (Depth + 10) � (1 - Fraction of helium) - 10 (wikipedia) | |
717 decom_get_inert_gases((float)stateUsed->lifeData.pressure_ambient_bar,&(stateUsed->lifeData.actualGas),&fraction_nitrogen,&fraction_helium); | |
718 depth = stateUsed->lifeData.pressure_ambient_bar; | |
719 surface = stateUsed->lifeData.pressure_surface_bar; | |
720 ead = 10.f * ((depth * fraction_nitrogen/0.79f) - surface); | |
721 end = 10.0f * ((depth * (1.f - fraction_helium)) - surface); | |
722 if(ead < 0) | |
723 ead = 0; | |
724 if(end < 0) | |
725 end = 0; | |
726 | |
727 snprintf(text,100,"\032\001EAD"); | |
728 GFX_write_string(&FontT42, &t9cY0free, text, 3); | |
729 snprintf(text,100,"\030\001%01.1fm", ead); | |
730 GFX_write_string(&FontT42, &t9cY0free, text, 4); | |
731 | |
732 snprintf(text,100,"\032\001END"); | |
733 GFX_write_string(&FontT42, &t9cY0free, text, 5); | |
734 snprintf(text,100,"\030\001%01.1fm", end); | |
735 GFX_write_string(&FontT42, &t9cY0free, text, 6); | |
736 break; | |
737 case CVIEW_Profile: | |
738 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Profile); | |
739 GFX_write_string(&FontT42,&t9cH,text,0); | |
740 textpointer = 0; | |
741 t9_miniLiveLogProfile(); | |
742 break; | |
743 case CVIEW_Tissues: | |
744 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_Tissues); | |
745 GFX_write_string(&FontT42,&t9cH,text,0); | |
746 textpointer = 0; | |
747 t9_tissues(stateUsed); | |
748 break; | |
749 case CVIEW_sensors: | |
750 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); | |
751 GFX_write_string(&FontT42,&t9cH,text,0); | |
752 textpointer = 0; | |
753 text[textpointer++] = '\030'; // main color | |
754 for(int i=0;i<3;i++) | |
755 { | |
756 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
757 { | |
758 text[textpointer++] = '\031'; // labelcolor | |
759 text[textpointer++] = '\001'; | |
760 text[textpointer++] = '-'; | |
761 text[textpointer++] = '\n'; | |
762 text[textpointer++] = '\r'; | |
763 text[textpointer++] = '\030'; // main color | |
764 text[textpointer] = 0; | |
765 } | |
766 else | |
767 { | |
768 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
769 text[textpointer++] = '\025'; // Warning Red | |
770 textpointer += snprintf(&text[textpointer],100,"\001%01.2f\n\r\030",stateUsed->lifeData.ppO2Sensor_bar[i]); | |
771 } | |
772 } | |
773 t9cC.WindowLineSpacing = 95; | |
774 t9cC.WindowNumberOfTextLines = 3; | |
775 text[textpointer] = 0; | |
776 GFX_write_string(&FontT105,&t9cC,text,1); | |
777 break; | |
778 case CVIEW_sensors_mV: | |
779 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE,TXT2BYTE_O2voltage); | |
780 GFX_write_string(&FontT42,&t9cH,text,0); | |
781 textpointer = 0; | |
782 text[textpointer++] = '\030'; | |
783 for(int i=0;i<3;i++) | |
784 { | |
785 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) | |
786 { | |
787 text[textpointer++] = '\031'; | |
788 text[textpointer++] = '\001'; | |
789 text[textpointer++] = '-'; | |
790 text[textpointer++] = '\n'; | |
791 text[textpointer++] = '\r'; | |
792 text[textpointer++] = '\030'; | |
793 text[textpointer] = 0; | |
794 } | |
795 else | |
796 { | |
797 if(stateUsed->warnings.sensorOutOfBounds[i]) | |
798 text[textpointer++] = '\025'; | |
799 textpointer += snprintf(&text[textpointer],100,"\001%01.1f mV\n\r\030",(stateUsed->lifeData.sensorVoltage_mV[i])); | |
800 } | |
801 } | |
802 t9cC.WindowLineSpacing = 95; | |
803 t9cC.WindowNumberOfTextLines = 3; | |
804 text[textpointer] = 0; | |
805 GFX_write_string(&FontT48,&t9cC,text,1); | |
806 break; | |
807 case CVIEW_Compass: | |
808 default: | |
809 snprintf(text,100,"\032\f\001%c%c",TXT_2BYTE, TXT2BYTE_Compass); | |
810 GFX_write_string(&FontT42,&t9cH,text,0); | |
811 t9_compass((uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading); | |
812 t9cY0free.WindowY0 = 230; | |
813 t9cY0free.WindowX0 += 15; | |
814 snprintf(text,100,"\030\001%03i`",(uint16_t)stateUsed->lifeData.compass_heading); | |
815 GFX_write_string(&FontT54,&t9cY0free,text,0); | |
816 t9cY0free.WindowX0 -= 15; | |
817 break; | |
818 case CVIEW_Decolist: | |
819 snprintf(text,100,"\032\f\001%c%c", TXT_2BYTE, TXT2BYTE_Decolist); | |
820 GFX_write_string(&FontT42,&t9cH,text,0); | |
821 | |
822 const SDecoinfo * pDecoinfo; | |
823 uint8_t depthNext, depthLast, depthSecond, depthInc; | |
824 | |
825 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
826 pDecoinfo = &stateUsed->decolistBuehlmann; | |
827 else | |
828 pDecoinfo = &stateUsed->decolistVPM; | |
829 | |
830 depthLast = (uint8_t)(stateUsed->diveSettings.last_stop_depth_bar * 10); | |
831 depthSecond = (uint8_t)(stateUsed->diveSettings.input_second_to_last_stop_depth_bar * 10); | |
832 depthInc = (uint8_t)(stateUsed->diveSettings.input_next_stop_increment_depth_bar * 10); | |
833 | |
834 for(start=DECOINFO_STRUCT_MAX_STOPS-1; start>0; start--) | |
835 if(pDecoinfo->output_stop_length_seconds[start]) break; | |
836 start -= 6; | |
837 if(start < 0) start = 0; | |
838 | |
839 textpointer = 0; | |
840 for(int i=start;i<6+start;i++) | |
841 { | |
842 if(i == 0) | |
843 depthNext = depthLast; | |
844 else | |
845 depthNext = depthSecond + (( i - 1 )* depthInc); | |
846 | |
847 if(pDecoinfo->output_stop_length_seconds[i]) | |
848 textpointer += snprintf(&text[textpointer],20,"\030\034 %2u\016\016m\017%3i'\n\r",depthNext, (pDecoinfo->output_stop_length_seconds[i]+59)/60); | |
849 else | |
850 textpointer += snprintf(&text[textpointer],20,"\031\034 %2u\016\016m\017\n\r",depthNext); | |
851 if(textpointer > 200) break; | |
852 } | |
853 t9cY0free.WindowY0 = t9cC.WindowY0 - 10; | |
854 t9cY0free.WindowLineSpacing = 48; | |
855 t9cY0free.WindowNumberOfTextLines = 6; | |
856 GFX_write_string(&FontT42, &t9cY0free, text, 1); | |
857 break; | |
858 } | |
859 } | |
860 | |
861 /* DIVE MODE | |
862 */ | |
863 void t9_refresh_divemode(void) | |
864 { | |
865 char TextL1[TEXTSIZE]; | |
866 char TextL2[TEXTSIZE]; | |
867 | |
868 char TextR1[TEXTSIZE]; | |
869 char TextR2[TEXTSIZE]; | |
870 char TextR3[TEXTSIZE]; | |
871 | |
872 char TextC1[2*TEXTSIZE]; | |
873 char TextC2[TEXTSIZE]; | |
874 uint8_t textPointer; | |
875 | |
876 point_t start, stop; | |
877 uint8_t color; | |
878 int textlength; | |
879 | |
880 uint16_t nextstopLengthSeconds = 0; | |
881 uint8_t nextstopDepthMeter = 0; | |
882 uint8_t oxygen_percentage = 0; | |
883 SDivetime Divetime = {0,0,0, 0}; | |
884 SDivetime SafetyStopTime = {0,0,0,0}; | |
885 SDivetime TimeoutTime = {0,0,0,0}; | |
886 uint8_t customview_warnings = 0; | |
887 const SDecoinfo * pDecoinfo; | |
888 | |
889 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time; | |
890 Divetime.Minutes = Divetime.Total / 60; | |
891 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 ); | |
892 | |
893 SafetyStopTime.Total = timer_Safetystop_GetCountDown(); | |
894 SafetyStopTime.Minutes = SafetyStopTime.Total / 60; | |
895 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60); | |
896 | |
897 TimeoutTime.Total = settingsGetPointer()->timeoutDiveReachedZeroDepth - stateUsed->lifeData.counterSecondsShallowDepth; | |
898 if(TimeoutTime.Total > settingsGetPointer()->timeoutDiveReachedZeroDepth) | |
899 { | |
900 TimeoutTime.Total = 0; | |
901 } | |
902 TimeoutTime.Minutes = TimeoutTime.Total / 60; | |
903 TimeoutTime.Seconds = TimeoutTime.Total - (TimeoutTime.Minutes * 60); | |
904 | |
905 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
906 pDecoinfo = &stateUsed->decolistBuehlmann; | |
907 else | |
908 pDecoinfo = &stateUsed->decolistVPM; | |
909 | |
910 if(pDecoinfo->output_time_to_surface_seconds) | |
911 { | |
912 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); | |
913 } | |
914 else | |
915 { | |
916 nextstopDepthMeter = 0; | |
917 nextstopLengthSeconds = 0; | |
918 } | |
919 | |
920 /* depth */ | |
921 float depth = 0; | |
922 float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter); | |
923 if(is_stateUsedSetToSim()) | |
924 { | |
925 depth = (depthThisCall + t9_depthLastCall[0] + t9_depthLastCall[1] + t9_depthLastCall[2] + t9_depthLastCall[3] + t9_depthLastCall[4] + t9_depthLastCall[5] + t9_depthLastCall[6] + t9_depthLastCall[7] + t9_depthLastCall[8]) / 10.0f; | |
926 | |
927 idt9_depthLastCall++; | |
928 if(idt9_depthLastCall >= 9) | |
929 idt9_depthLastCall = 0; | |
930 t9_depthLastCall[idt9_depthLastCall] = depthThisCall; | |
931 } | |
932 else | |
933 { | |
934 depth = (depthThisCall + t9_depthLastCall[0] + t9_depthLastCall[1] + t9_depthLastCall[2]) / 4.0f; | |
935 | |
936 idt9_depthLastCall++; | |
937 if(idt9_depthLastCall >= 3) | |
938 idt9_depthLastCall = 0; | |
939 t9_depthLastCall[idt9_depthLastCall] = depthThisCall; | |
940 } | |
941 | |
942 if(depth <= 0.3f) | |
943 depth = 0; | |
944 | |
945 snprintf(TextL1,TEXTSIZE,"\032\f%c",TXT_Depth); | |
946 GFX_write_string(&FontT24,&t9l2,TextL1,0); | |
947 | |
948 if( depth < 100) | |
949 snprintf(TextL1,TEXTSIZE,"\020%01.1f",depth); | |
950 else | |
951 snprintf(TextL1,TEXTSIZE,"\020%01.0f",depth); | |
952 | |
953 t9_colorscheme_mod(TextL1); | |
954 GFX_write_string(&FontT105,&t9l2,TextL1,1); | |
955 | |
956 /* max depth */ | |
957 snprintf(TextL2,TEXTSIZE,"\032\f%c",TXT_MaxDepth); | |
958 GFX_write_string(&FontT24,&t9l3,TextL2,0); | |
959 | |
960 if(unit_depth_float(stateUsed->lifeData.max_depth_meter) < 100) | |
961 snprintf(TextL2,TEXTSIZE,"\020%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
962 else | |
963 snprintf(TextL2,TEXTSIZE,"\020%01.0f",unit_depth_float(stateUsed->lifeData.max_depth_meter)); | |
964 | |
965 t9_colorscheme_mod(TextL2); | |
966 GFX_write_string(&FontT105,&t9l3,TextL2,1); | |
967 | |
968 /* ascentrate graph */ | |
969 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) | |
970 { | |
971 start.y = t9l1.WindowY0 - 1; | |
972 for(int i = 0; i<4;i++) | |
973 { | |
974 start.y += 5*6; | |
975 stop.y = start.y; | |
976 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
977 stop.x = start.x - 17; | |
978 GFX_draw_line(&t9screen, start, stop, 0); | |
979 // start.x = CUSTOMBOX_LINE_RIGHT + 2; old right too | |
980 // stop.x = start.x + 17; | |
981 // GFX_draw_line(&t9screen, start, stop, 0); | |
982 } | |
983 // new thick bar design Sept. 2015 | |
984 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 3 - 5; | |
985 stop.x = start.x; | |
986 start.y = t9l1.WindowY0 - 1; | |
987 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 6); | |
988 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 | |
989 if(stop.y >= 470) | |
990 stop.y = 470; | |
991 start.y += 7; // starte etwas weiter oben | |
992 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10) | |
993 color = CLUT_EverythingOkayGreen; | |
994 else | |
995 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15) | |
996 color = CLUT_WarningYellow; | |
997 else | |
998 color = CLUT_WarningRed; | |
999 | |
1000 GFX_draw_thick_line(12,&t9screen, start, stop, color); | |
1001 } | |
1002 snprintf(TextL2,TEXTSIZE,"\f%.1f m/min",stateUsed->lifeData.ascent_rate_meter_per_min); | |
1003 | |
1004 /* divetime */ | |
1005 if(stateUsed->lifeData.counterSecondsShallowDepth) | |
1006 { | |
1007 snprintf(TextR1,TEXTSIZE,"\f\002\136 %u:%02u",TimeoutTime.Minutes, TimeoutTime.Seconds); | |
1008 GFX_write_string(&FontT24,&t9r2,TextR1,0); | |
1009 } | |
1010 else | |
1011 { | |
1012 snprintf(TextR1,TEXTSIZE,"\032\f\002%c",TXT_Divetime); | |
1013 GFX_write_string(&FontT24,&t9r2,TextR1,0); | |
1014 } | |
1015 | |
1016 if(Divetime.Minutes < 1000) | |
1017 snprintf(TextR1,TEXTSIZE,"\020\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); | |
1018 else | |
1019 snprintf(TextR1,TEXTSIZE,"\020\016\002%u'",Divetime.Minutes); | |
1020 t9_colorscheme_mod(TextR1); | |
1021 GFX_write_string(&FontT105,&t9r2,TextR1,1); | |
1022 | |
1023 /* next deco stop */ | |
1024 if(nextstopDepthMeter) | |
1025 { | |
1026 snprintf(TextR2,TEXTSIZE,"\032\f\002%c",TXT_Decostop); | |
1027 GFX_write_string(&FontT24,&t9r3,TextR2,0); | |
1028 textlength = snprintf(TextR2,TEXTSIZE,"\020\002%um %u'",nextstopDepthMeter,(nextstopLengthSeconds+59)/60); | |
1029 t9_colorscheme_mod(TextR2); | |
1030 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
1031 TextR2[0] = '\021'; | |
1032 if(textlength <= 8) | |
1033 GFX_write_string(&FontT105,&t9r3,TextR2,1); | |
1034 else | |
1035 GFX_write_string(&FontT54,&t9r3,TextR2,1); | |
1036 } | |
1037 else | |
1038 if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) | |
1039 { | |
1040 snprintf(TextR2,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); | |
1041 GFX_write_string(&FontT24,&t9r3,TextR2,0); | |
1042 snprintf(TextR2,TEXTSIZE,"\020\016\002%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); | |
1043 t9_colorscheme_mod(TextR2); | |
1044 GFX_write_string(&FontT105,&t9r3,TextR2,1); | |
1045 } | |
1046 | |
1047 /* tts - option 1 | |
1048 * ndl - option 2 | |
1049 * empty - option 3 */ | |
1050 if(pDecoinfo->output_time_to_surface_seconds) | |
1051 { | |
1052 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_TTS); | |
1053 GFX_write_string(&FontT24,&t9r4,TextR3,0); | |
1054 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) | |
1055 snprintf(TextR3,TEXTSIZE,"\020\002%i'",(pDecoinfo->output_time_to_surface_seconds + 30)/ 60); | |
1056 else | |
1057 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_time_to_surface_seconds / 3600); | |
1058 t9_colorscheme_mod(TextR3); | |
1059 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
1060 TextR2[0] = '\021'; | |
1061 GFX_write_string(&FontT105,&t9r4,TextR3,0); | |
1062 } | |
1063 else | |
1064 if(pDecoinfo->output_ndl_seconds) | |
1065 { | |
1066 snprintf(TextR3,TEXTSIZE,"\032\f\002%c",TXT_Nullzeit); | |
1067 GFX_write_string(&FontT24,&t9r4,TextR3,0); | |
1068 if(pDecoinfo->output_ndl_seconds < 1000 * 60) | |
1069 snprintf(TextR3,TEXTSIZE,"\020\002%i'",pDecoinfo->output_ndl_seconds/60); | |
1070 else | |
1071 snprintf(TextR3,TEXTSIZE,"\020\002%ih",pDecoinfo->output_ndl_seconds/3600); | |
1072 t9_colorscheme_mod(TextR3); | |
1073 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) | |
1074 TextR2[0] = '\021'; | |
1075 GFX_write_string(&FontT105,&t9r4,TextR3,0); | |
1076 } | |
1077 | |
1078 uint16_t scooterSpeedLocal; | |
1079 uint8_t scooterResidualCapacity; | |
1080 | |
1081 scooterSpeedLocal = unit_speed_integer(stateUsed->lifeData.scooterSpeed); | |
1082 scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity(); | |
1083 | |
1084 /* scooter global for both */ | |
1085 uint16_t ageInMilliSeconds; | |
1086 ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds; | |
1087 if(!ageInMilliSeconds) | |
1088 ageInMilliSeconds = 9999; | |
1089 | |
1090 /* scooter battery */ | |
1091 snprintf(TextR1,TEXTSIZE,"\032\f\002%c%c",TXT_2BYTE, TXT2BYTE_ScooterRestkapazitaet); | |
1092 GFX_write_string(&FontT24,&t9r1,TextR1,0); | |
1093 snprintf(TextR3,TEXTSIZE,"\020\002%u\016\016%%\017",scooterResidualCapacity); | |
1094 if(ageInMilliSeconds > 1500) | |
1095 { | |
1096 for(int i=0; i < TEXTSIZE -2; i++) | |
1097 { | |
1098 if(TextR3[i] == '\020') | |
1099 TextR3[i] = '\031'; | |
1100 } | |
1101 } | |
1102 else | |
1103 t9_colorscheme_mod(TextR3); | |
1104 GFX_write_string(&FontT105,&t9r1,TextR3,1); | |
1105 | |
1106 /* scooter speed */ | |
1107 textlength = snprintf(TextR3,TEXTSIZE-7,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_ScooterSpeed); | |
1108 if(settingsGetPointer()->nonMetricalSystem == 0) | |
1109 { | |
1110 snprintf(&TextR3[textlength],8," m/min"); | |
1111 } | |
1112 else | |
1113 { | |
1114 snprintf(&TextR3[textlength],8," ft/min"); | |
1115 } | |
1116 GFX_write_string(&FontT24,&t9l1,TextR3,0); | |
1117 snprintf(TextR3,TEXTSIZE,"\020%u",scooterSpeedLocal); | |
1118 if(ageInMilliSeconds > 1500) | |
1119 { | |
1120 for(int i=0; i < TEXTSIZE -2; i++) | |
1121 { | |
1122 if(TextR3[i] == '\020') | |
1123 TextR3[i] = '\031'; | |
1124 } | |
1125 } | |
1126 else | |
1127 t9_colorscheme_mod(TextR3); | |
1128 GFX_write_string(&FontT105,&t9l1,TextR3,1); | |
1129 | |
1130 | |
1131 | |
1132 /* Menu Selection (and gas mix) */ | |
1133 if(get_globalState() == StDMGAS) | |
1134 { | |
1135 textPointer = 0; | |
1136 TextR1[textPointer++] = '\a'; | |
1137 // TextR1[textPointer++] = '\f'; | |
1138 TextR1[textPointer++] = '\001'; | |
1139 TextR1[textPointer++] = ' '; | |
1140 textPointer += tHome_gas_writer(stateUsed->diveSettings.gas[actualBetterGasId()].oxygen_percentage,stateUsed->diveSettings.gas[actualBetterGasId()].helium_percentage,&TextR1[textPointer]); | |
1141 TextR1[textPointer++] = '?'; | |
1142 TextR1[textPointer++] = ' '; | |
1143 TextR1[textPointer++] = 0; | |
1144 GFX_write_string_color(&FontT48,&t9c2,TextR1,0,CLUT_WarningYellow); | |
1145 } | |
1146 else | |
1147 if(get_globalState() == StDMSPT) | |
1148 { | |
1149 textPointer = 0; | |
1150 TextR1[textPointer++] = '\a'; | |
1151 TextR1[textPointer++] = '\001'; | |
1152 TextR1[textPointer++] = ' '; | |
1153 textPointer += snprintf(&TextR1[textPointer],5,"%f01.2",((float)(stateUsed->diveSettings.setpoint[actualBetterSetpointId()].setpoint_cbar))/100); | |
1154 TextR1[textPointer++] = '?'; | |
1155 TextR1[textPointer++] = ' '; | |
1156 TextR1[textPointer++] = 0; | |
1157 GFX_write_string_color(&FontT48,&t9c2,TextR1,0,CLUT_WarningYellow); | |
1158 } | |
1159 else | |
1160 if(get_globalState() == StDMENU) | |
1161 { | |
1162 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveMenuQ); | |
1163 GFX_write_string_color(&FontT48,&t9c2,TextR1,0,CLUT_WarningYellow); | |
1164 } | |
1165 else | |
1166 if(get_globalState() == StDSIM1) | |
1167 { | |
1168 snprintf(TextR1,TEXTSIZE,"\a\001%c%c", TXT_2BYTE, TXT2BYTE_DiveQuitQ); | |
1169 GFX_write_string_color(&FontT48,&t9c2,TextR1,0,CLUT_WarningYellow); | |
1170 } | |
1171 else | |
1172 if(get_globalState() == StDSIM2) | |
1173 { | |
1174 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:-1m "); | |
1175 GFX_write_string_color(&FontT48,&t9c2,TextR1,0,CLUT_WarningYellow); | |
1176 snprintf(TextR1,TEXTSIZE,"\a\f %u m",simulation_get_aim_depth()); | |
1177 GFX_write_string_color(&FontT42,&t9l1,TextR1,0,CLUT_WarningYellow); | |
1178 | |
1179 } | |
1180 else | |
1181 if(get_globalState() == StDSIM3) | |
1182 { | |
1183 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+1m "); | |
1184 GFX_write_string_color(&FontT48,&t9c2,TextR1,0,CLUT_WarningYellow); | |
1185 snprintf(TextR1,TEXTSIZE,"\a\f %u m",simulation_get_aim_depth()); | |
1186 GFX_write_string_color(&FontT42,&t9l1,TextR1,0,CLUT_WarningYellow); | |
1187 } | |
1188 else | |
1189 if(get_globalState() == StDSIM4) | |
1190 { | |
1191 snprintf(TextR1,TEXTSIZE,"\a\001" " Sim:+5' "); | |
1192 GFX_write_string_color(&FontT48,&t9c2,TextR1,0,CLUT_WarningYellow); | |
1193 snprintf(TextR1,TEXTSIZE,"\a\f %u m",simulation_get_aim_depth()); | |
1194 GFX_write_string_color(&FontT42,&t9l1,TextR1,0,CLUT_WarningYellow); | |
1195 } | |
1196 else | |
1197 { | |
1198 /* gas mix */ | |
1199 oxygen_percentage = 100; | |
1200 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage; | |
1201 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; | |
1202 | |
1203 textPointer = 0; | |
1204 TextC2[textPointer++] = '\020'; | |
1205 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
1206 { | |
1207 TextC2[textPointer++] = '\a'; | |
1208 } | |
1209 else | |
1210 { | |
1211 float fPpO2limitHigh, fPpO2now; | |
1212 | |
1213 if(actualLeftMaxDepth(stateUsed)) | |
1214 fPpO2limitHigh = settingsGetPointer()->ppO2_max_deco; | |
1215 else | |
1216 fPpO2limitHigh = settingsGetPointer()->ppO2_max_std; | |
1217 | |
1218 fPpO2now = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * oxygen_percentage; | |
1219 | |
1220 if((fPpO2now > fPpO2limitHigh) || (fPpO2now < (float)(settingsGetPointer()->ppO2_min))) | |
1221 TextC2[textPointer++] = '\025'; | |
1222 } | |
1223 TextC2[textPointer++] = '\002'; | |
1224 textPointer += tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&TextC2[textPointer]); | |
1225 | |
1226 if(stateUsed->warnings.betterGas && warning_count_high_time) | |
1227 { | |
1228 if(TextC2[0] == '\020') | |
1229 { | |
1230 TextC2[0] = '\004'; // NOP | |
1231 } | |
1232 GFX_write_string_color(&FontT48,&t9c2,TextC2,0,CLUT_WarningYellow); | |
1233 } | |
1234 else | |
1235 { | |
1236 t9_colorscheme_mod(TextC2); | |
1237 GFX_write_string(&FontT48,&t9c2,TextC2,0); // T54 has only numbers | |
1238 } | |
1239 | |
1240 if(stateUsed->diveSettings.ccrOption) | |
1241 { | |
1242 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
1243 { | |
1244 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
1245 if(stateUsed->warnings.betterSetpoint && warning_count_high_time && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR)) | |
1246 { | |
1247 TextC2[0] = '\a'; // inverse instead of color \020 | |
1248 GFX_write_string_color(&FontT48,&t9c2,TextC2,0,CLUT_WarningYellow); | |
1249 } | |
1250 else | |
1251 { | |
1252 t9_colorscheme_mod(TextC2); | |
1253 GFX_write_string(&FontT48,&t9c2,TextC2,0); | |
1254 } | |
1255 } | |
1256 } | |
1257 else if(settingsGetPointer()->alwaysShowPPO2) | |
1258 { | |
1259 snprintf(TextC2,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
1260 t9_colorscheme_mod(TextC2); | |
1261 GFX_write_string(&FontT48,&t9c2,TextC2,0); | |
1262 } | |
1263 } | |
1264 | |
1265 /* algorithm, ccr, bailout and battery */ | |
1266 /* and permanent warnings (CNS) */ | |
1267 | |
1268 if((stateUsed->warnings.cnsHigh) && display_count_high_time) | |
1269 { | |
1270 TextC2[0] = '\f'; | |
1271 TextC2[1] = TXT_2BYTE; | |
1272 TextC2[2] = TXT2BYTE_WarnCnsHigh; | |
1273 TextC2[3] = 0; | |
1274 GFX_write_string_color(&FontT48,&t9c1,TextC2,0,CLUT_WarningRed); | |
1275 } | |
1276 else | |
1277 { | |
1278 if(stateUsed->warnings.aGf) | |
1279 { | |
1280 GFX_write_string_color(&FontT48,&t9c1,"\f" "aGF",0,CLUT_WarningYellow); | |
1281 } | |
1282 else if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1283 { | |
1284 GFX_write_string(&FontT48,&t9c1,"\027\f" "GF",0); | |
1285 } | |
1286 else | |
1287 { | |
1288 GFX_write_string(&FontT48,&t9c1,"\027\f" "VPM",0); | |
1289 } | |
1290 | |
1291 if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) | |
1292 GFX_write_string(&FontT24,&t9c1,"\027\f\002" "CCR",0); | |
1293 // GFX_write_string(&FontT24,&t9c1,"\f\177\177\x80" "CCR",0); | |
1294 else | |
1295 if(stateUsed->diveSettings.ccrOption) | |
1296 GFX_write_string(&FontT24,&t9c1,"\f\002\024" "Bailout",0); | |
1297 // GFX_write_string(&FontT24,&t9c1,"\f\177\177\x80\024" "Bailout",0); | |
1298 } | |
1299 TextC1[0] = '\020'; | |
1300 TextC1[1] = '3'; | |
1301 TextC1[2] = '1'; | |
1302 TextC1[3] = '1'; | |
1303 TextC1[4] = '1'; | |
1304 TextC1[5] = '1'; | |
1305 TextC1[6] = '1'; | |
1306 TextC1[7] = '1'; | |
1307 TextC1[8] = '1'; | |
1308 TextC1[9] = '1'; | |
1309 TextC1[10] = '1'; | |
1310 TextC1[11] = '1'; | |
1311 TextC1[12] = '0'; | |
1312 TextC1[13] = 0; | |
1313 | |
1314 for(int i=1;i<=10;i++) | |
1315 { | |
1316 if( stateUsed->lifeData.battery_charge > (9 * i)) | |
1317 TextC1[i+1] += 1; | |
1318 } | |
1319 | |
1320 if(stateUsed->warnings.lowBattery) | |
1321 { | |
1322 TextC1[0] = '\025'; | |
1323 if(warning_count_high_time) | |
1324 { | |
1325 for(int i=2;i<=11;i++) | |
1326 TextC1[i] = '1'; | |
1327 } | |
1328 else | |
1329 { | |
1330 TextC1[2] = '2'; | |
1331 } | |
1332 GFX_write_string(&Batt24,&t9batt,TextC1,0); | |
1333 | |
1334 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
1335 { | |
1336 snprintf(TextC1,16,"\004\025\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
1337 if(warning_count_high_time) | |
1338 TextC1[0] = '\a'; | |
1339 GFX_write_string(&FontT24,&t9batt,TextC1,0); | |
1340 } | |
1341 } | |
1342 else | |
1343 { | |
1344 t9_colorscheme_mod(TextC1); | |
1345 GFX_write_string(&Batt24,&t9batt,TextC1,0); | |
1346 | |
1347 if((stateUsed->lifeData.battery_charge > 0) && (stateUsed->lifeData.battery_charge < 140)) | |
1348 { | |
1349 snprintf(TextC1,16,"\020\f\002%u%%",(uint8_t)stateUsed->lifeData.battery_charge); | |
1350 t9_colorscheme_mod(TextC1); | |
1351 GFX_write_string(&FontT24,&t9batt,TextC1,0); | |
1352 } | |
1353 } | |
1354 | |
1355 /* customizable left lower corner */ | |
1356 t9_refresh_divemode_userselected_left_lower_corner(); | |
1357 | |
1358 | |
1359 /* customview - option 1 | |
1360 * warning - option 2 */ | |
1361 if(stateUsed->warnings.numWarnings) | |
1362 customview_warnings = t9_test_customview_warnings(); | |
1363 | |
1364 t9_background.pointer = NULL; | |
1365 if(customview_warnings && warning_count_high_time) | |
1366 t9_show_customview_warnings(); | |
1367 else | |
1368 t9_refresh_customview(); | |
1369 | |
1370 | |
1371 /* the frame */ | |
1372 t9_draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines); | |
1373 } | |
1374 | |
1375 | |
1376 void t9_set_field_to_primary(void) | |
1377 { | |
1378 if(stateUsed->mode == MODE_DIVE) | |
1379 t9_selection_custom_field = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
1380 } | |
1381 | |
1382 | |
1383 void t9_change_field(void) | |
1384 { | |
1385 const uint8_t minVal = 0; | |
1386 const uint8_t maxVal = 7; | |
1387 | |
1388 t9_selection_custom_field++; | |
1389 if(t9_selection_custom_field > maxVal) | |
1390 t9_selection_custom_field = minVal; | |
1391 } | |
1392 | |
1393 | |
1394 void t9_refresh_divemode_userselected_left_lower_corner(void) | |
1395 { | |
1396 // zero is scooter temperature :-) | |
1397 | |
1398 char headerText[10]; | |
1399 char text[TEXTSIZE]; | |
1400 uint8_t textpointer = 0; | |
1401 _Bool tinyHeaderFont = 0; | |
1402 uint8_t line = 0; | |
1403 | |
1404 SDivetime Stopwatch = {0,0,0,0}; | |
1405 float fAverageDepth, fAverageDepthAbsolute; | |
1406 const SDecoinfo * pDecoinfoStandard; | |
1407 const SDecoinfo * pDecoinfoFuture; | |
1408 float fCNS; | |
1409 | |
1410 float temperatureThisCall; | |
1411 float temperature; | |
1412 | |
1413 float scooterTemperatureLocal; | |
1414 uint16_t ageInMilliSeconds; | |
1415 | |
1416 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1417 { | |
1418 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
1419 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
1420 } | |
1421 else | |
1422 { | |
1423 pDecoinfoStandard = &stateUsed->decolistVPM; | |
1424 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
1425 } | |
1426 | |
1427 Stopwatch.Total = timer_Stopwatch_GetTime(); | |
1428 Stopwatch.Minutes = Stopwatch.Total / 60; | |
1429 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); | |
1430 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); | |
1431 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; | |
1432 | |
1433 headerText[0] = '\032'; | |
1434 headerText[1] = '\f'; | |
1435 | |
1436 switch(t9_selection_custom_field) | |
1437 { | |
1438 /* scooter temp. */ | |
1439 case 0: | |
1440 scooterTemperatureLocal = unit_temperature_float(((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f); | |
1441 headerText[2] = TXT_2BYTE; | |
1442 headerText[3] = TXT2BYTE_ScooterTemperature; | |
1443 textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",scooterTemperatureLocal); // "\016\016%01.1f `" + C or F | |
1444 if(settingsGetPointer()->nonMetricalSystem == 0) | |
1445 text[textpointer++] = 'C'; | |
1446 else | |
1447 text[textpointer++] = 'F'; | |
1448 text[textpointer++] = 0; | |
1449 tinyHeaderFont = 0; | |
1450 // connection active | |
1451 ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds; | |
1452 if(!ageInMilliSeconds) | |
1453 ageInMilliSeconds = 9999; | |
1454 if(ageInMilliSeconds > 1500) | |
1455 { | |
1456 for(int i=0; i < TEXTSIZE -2; i++) | |
1457 { | |
1458 if(text[i] == '\020') | |
1459 text[i] = '\031'; | |
1460 } | |
1461 } | |
1462 break; | |
1463 | |
1464 /* Temperature */ | |
1465 case 1: | |
1466 default: | |
1467 // mean value | |
1468 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius); | |
1469 temperature = (temperatureThisCall + t9_temperatureLastCall[0] + t9_temperatureLastCall[1] + t9_temperatureLastCall[2]) / 4.0f; | |
1470 idt9_temperatureLastCall++; | |
1471 if(idt9_temperatureLastCall >= 3) | |
1472 idt9_temperatureLastCall = 0; | |
1473 t9_temperatureLastCall[idt9_temperatureLastCall] = temperatureThisCall; | |
1474 // output | |
1475 headerText[2] = TXT_Temperature; | |
1476 textpointer = snprintf(text,TEXTSIZE,"\020\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F | |
1477 if(settingsGetPointer()->nonMetricalSystem == 0) | |
1478 text[textpointer++] = 'C'; | |
1479 else | |
1480 text[textpointer++] = 'F'; | |
1481 text[textpointer++] = 0; | |
1482 tinyHeaderFont = 0; | |
1483 break; | |
1484 | |
1485 /* Average Depth */ | |
1486 case 2: | |
1487 headerText[2] = TXT_AvgDepth; | |
1488 snprintf(text,TEXTSIZE,"\020%01.1f",fAverageDepthAbsolute); | |
1489 break; | |
1490 | |
1491 /* ppO2 */ | |
1492 case 3: | |
1493 headerText[2] = TXT_ppO2; | |
1494 snprintf(text,TEXTSIZE,"\020%01.2f",stateUsed->lifeData.ppO2); | |
1495 break; | |
1496 | |
1497 /* Stop Uhr */ | |
1498 case 4: | |
1499 headerText[2] = TXT_Stopwatch; | |
1500 snprintf(text,TEXTSIZE,"\020\016\016%u:%02u\n\r%01.1f",Stopwatch.Minutes, Stopwatch.Seconds,fAverageDepth); | |
1501 tinyHeaderFont = 1; | |
1502 line = 1; | |
1503 break; | |
1504 | |
1505 /* Ceiling */ | |
1506 case 5: | |
1507 headerText[2] = TXT_Ceiling; | |
1508 if(pDecoinfoStandard->output_ceiling_meter <= 99.9f) | |
1509 snprintf(text,TEXTSIZE,"\020%01.1f",pDecoinfoStandard->output_ceiling_meter); | |
1510 else | |
1511 snprintf(text,TEXTSIZE,"\020%01.0f",pDecoinfoStandard->output_ceiling_meter); | |
1512 break; | |
1513 | |
1514 /* Future TTS */ | |
1515 case 6: | |
1516 headerText[2] = TXT_FutureTTS; | |
1517 snprintf(text,TEXTSIZE,"\020\016\016@+%u'\n\r" "%i' TTS",settingsGetPointer()->future_TTS, pDecoinfoFuture->output_time_to_surface_seconds / 60); | |
1518 tinyHeaderFont = 1; | |
1519 line = 1; | |
1520 break; | |
1521 | |
1522 /* CNS */ | |
1523 case 7: | |
1524 headerText[2] = TXT_CNS; | |
1525 fCNS = stateUsed->lifeData .cns; | |
1526 if(fCNS > 999) | |
1527 fCNS = 999; | |
1528 snprintf(text,TEXTSIZE,"\020%.0f\016\016%%\017",fCNS); | |
1529 break; | |
1530 | |
1531 /* scooter voltage*/ | |
1532 case 77: // used as 7: alternative for Bonex | |
1533 headerText[2] = TXT_2BYTE; | |
1534 headerText[3] = TXT2BYTE_ScooterVolt; | |
1535 if(stateUsed->lifeData.scooterSpannung < 99) | |
1536 { | |
1537 snprintf(text,TEXTSIZE,"\020\016%01.2f",stateUsed->lifeData.scooterSpannung); | |
1538 ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds; | |
1539 if(!ageInMilliSeconds) | |
1540 ageInMilliSeconds = 9999; | |
1541 if(ageInMilliSeconds > 1500) | |
1542 { | |
1543 for(int i=0; i < TEXTSIZE -2; i++) | |
1544 { | |
1545 if(text[i] == '\020') | |
1546 text[i] = '\031'; | |
1547 } | |
1548 } | |
1549 } | |
1550 else | |
1551 { | |
1552 text[0] = 0; | |
1553 } | |
1554 break; | |
1555 | |
1556 } | |
1557 if(headerText[2] == TXT_2BYTE) | |
1558 headerText[4] = 0; | |
1559 else | |
1560 headerText[3] = 0; | |
1561 | |
1562 if(!tinyHeaderFont) | |
1563 GFX_write_string(&FontT24,&t9l4,headerText,0); | |
1564 | |
1565 t9_colorscheme_mod(text); | |
1566 GFX_write_string(&FontT105,&t9l4,text,line); | |
1567 } | |
1568 | |
1569 /* Private functions ---------------------------------------------------------*/ | |
1570 | |
1571 uint8_t t9_customtextPrepare(char * text) | |
1572 { | |
1573 uint8_t i, j, textptr, lineCount; | |
1574 char nextChar; | |
1575 | |
1576 textptr = 0; | |
1577 lineCount = 0; | |
1578 | |
1579 text[textptr++] = TXT_MINIMAL; | |
1580 | |
1581 j = 0; | |
1582 i = 0; | |
1583 do | |
1584 { | |
1585 j += i; | |
1586 i = 0; | |
1587 do | |
1588 { | |
1589 nextChar = settingsGetPointer()->customtext[i+j]; | |
1590 i++; | |
1591 if((!nextChar) || (nextChar =='\n') || (nextChar =='\r')) | |
1592 break; | |
1593 text[textptr++] = nextChar; | |
1594 } while (i < 12); | |
1595 | |
1596 if(!nextChar) | |
1597 break; | |
1598 | |
1599 if(lineCount < 3) | |
1600 { | |
1601 text[textptr++] = '\n'; | |
1602 text[textptr++] = '\r'; | |
1603 } | |
1604 lineCount++; | |
1605 for(uint8_t k=0;k<2;k++) | |
1606 { | |
1607 nextChar = settingsGetPointer()->customtext[i+j+k]; | |
1608 if((nextChar =='\n') || (nextChar =='\r')) | |
1609 i++; | |
1610 else | |
1611 break; | |
1612 } | |
1613 | |
1614 } while (lineCount < 4); | |
1615 | |
1616 text[textptr] = 0; | |
1617 return lineCount; | |
1618 } | |
1619 | |
1620 /* could be extended to search for \020 inside | |
1621 */ | |
1622 void t9_colorscheme_mod(char *text) | |
1623 { | |
1624 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard()) | |
1625 { | |
1626 text[0] = '\027'; | |
1627 } | |
1628 } | |
1629 | |
1630 void t9_draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide) | |
1631 { | |
1632 point_t LeftLow, WidthHeight; | |
1633 point_t start, stop; | |
1634 | |
1635 // plugin box | |
1636 LeftLow.x = CUSTOMBOX_LINE_LEFT; | |
1637 WidthHeight.x = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_LINE_LEFT; | |
1638 LeftLow.y = 60; | |
1639 WidthHeight.y = 440 - LeftLow.y; | |
1640 GFX_draw_box(&t9screen, LeftLow, WidthHeight, 1, colorBox); | |
1641 | |
1642 if(PluginBoxHeader) | |
1643 { | |
1644 // plugin box - header | |
1645 start.x = CUSTOMBOX_LINE_LEFT; | |
1646 stop.x = CUSTOMBOX_LINE_RIGHT; | |
1647 stop.y = start.y = 440 - 60; | |
1648 GFX_draw_line(&t9screen, start, stop, colorBox); | |
1649 } | |
1650 | |
1651 if(LinesOnTheSides) | |
1652 { | |
1653 // aufteilung links | |
1654 start.x = 0; | |
1655 stop.x = CUSTOMBOX_LINE_LEFT; | |
1656 stop.y = start.y = t9l1.WindowY0 - 1; | |
1657 GFX_draw_line(&t9screen, start, stop, colorLinesOnTheSide); | |
1658 stop.y = start.y = t9l2.WindowY0 -1; | |
1659 GFX_draw_line(&t9screen, start, stop, colorLinesOnTheSide); | |
1660 stop.y = start.y = t9l3.WindowY0 -1; | |
1661 GFX_draw_line(&t9screen, start, stop, colorLinesOnTheSide); | |
1662 | |
1663 // aufteilung rechts | |
1664 start.x = CUSTOMBOX_LINE_RIGHT; | |
1665 stop.x = 799; | |
1666 stop.y = start.y = t9l1.WindowY0 - 1; | |
1667 GFX_draw_line(&t9screen, start, stop, colorLinesOnTheSide); | |
1668 stop.y = start.y = t9l2.WindowY0 - 1; | |
1669 GFX_draw_line(&t9screen, start, stop, colorLinesOnTheSide); | |
1670 stop.y = start.y = t9l3.WindowY0 - 1; | |
1671 GFX_draw_line(&t9screen, start, stop, colorLinesOnTheSide); | |
1672 } | |
1673 } | |
1674 | |
1675 | |
1676 /* Compass like TCOS shellfish | |
1677 * input is 0 to 359 | |
1678 * 2 px / 1 degree | |
1679 * Range is 148 degree with CUSTOMBOX_SPACE_INSIDE = 296 | |
1680 * one side is 74 degree (less than 90 degree) | |
1681 * internal 360 + 180 degree of freedom | |
1682 * use positive values only, shift by 360 below 90 mid position | |
1683 */ | |
1684 | |
1685 | |
1686 point_t t9_compass_circle(uint8_t id, uint16_t degree) | |
1687 { | |
1688 float fCos, fSin; | |
1689 const float piMult = ((2 * 3.14159) / 360); | |
1690 // const int radius[4] = {95,105,115,60}; | |
1691 const int radius[4] = {95,105,115,100}; | |
1692 const point_t offset = {.x = 400, .y = 250}; | |
1693 | |
1694 static point_t r[4][360] = { 0 }; | |
1695 | |
1696 if(r[0][0].y == 0) | |
1697 { | |
1698 for(int i=0;i<360;i++) | |
1699 { | |
1700 fCos = cos(i * piMult); | |
1701 fSin = sin(i * piMult); | |
1702 for(int j=0;j<4;j++) | |
1703 { | |
1704 r[j][i].x = offset.x + (int)(fSin * radius[j]); | |
1705 r[j][i].y = offset.y + (int)(fCos * radius[j]); | |
1706 } | |
1707 } | |
1708 } | |
1709 if(id > 3) id = 0; | |
1710 if(degree > 359) degree = 0; | |
1711 return r[id][degree]; | |
1712 } | |
1713 | |
1714 /* range should be 0 to 30 bar if 300 meter with 100% of nitrogen or helium | |
1715 * T24 is 28 high | |
1716 */ | |
1717 void t9_tissues(const SDiveState * pState) | |
1718 { | |
1719 point_t start, change, stop; | |
1720 float value; | |
1721 uint16_t front, cns100pixel; | |
1722 char text[256]; | |
1723 uint8_t textpointer = 0; | |
1724 uint8_t color; | |
1725 | |
1726 float percent_N2; | |
1727 float percent_He; | |
1728 float partial_pressure_N2; | |
1729 float partial_pressure_He; | |
1730 | |
1731 | |
1732 /* N2 */ | |
1733 t9cY0free.WindowLineSpacing = 28 + 48 + 14; | |
1734 t9cY0free.WindowY0 = t9cH.WindowY0 - 5 - 2 * t9cY0free.WindowLineSpacing; | |
1735 t9cY0free.WindowNumberOfTextLines = 3; | |
1736 | |
1737 text[textpointer++] = '\030'; | |
1738 text[textpointer++] = TXT_2BYTE; | |
1739 text[textpointer++] = TXT2BYTE_Nitrogen; | |
1740 text[textpointer++] = '\n'; | |
1741 text[textpointer++] = '\r'; | |
1742 text[textpointer++] = TXT_2BYTE; | |
1743 text[textpointer++] = TXT2BYTE_Helium; | |
1744 text[textpointer++] = '\n'; | |
1745 text[textpointer++] = '\r'; | |
1746 text[textpointer++] = TXT_2BYTE; | |
1747 text[textpointer++] = TXT2BYTE_CNS; | |
1748 text[textpointer++] = 0; | |
1749 | |
1750 GFX_write_string(&FontT24, &t9cY0free, text, 1); | |
1751 | |
1752 start.y = t9cH.WindowY0 - 5; | |
1753 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
1754 stop.x = start.x + CUSTOMBOX_SPACE_INSIDE; | |
1755 | |
1756 for(int i=0;i<16;i++) | |
1757 { | |
1758 stop.y = start.y; | |
1759 change.y = start.y; | |
1760 | |
1761 value = pState->lifeData.tissue_nitrogen_bar[i] - 0.7512f; | |
1762 value *= 80;//20 | |
1763 | |
1764 if(value < 0) | |
1765 front = 0; | |
1766 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
1767 front = CUSTOMBOX_SPACE_INSIDE; | |
1768 else | |
1769 front = (uint16_t)value; | |
1770 | |
1771 change.x = start.x + front; | |
1772 if(change.x != start.x) | |
1773 GFX_draw_thick_line(1,&t9screen, start, change, CLUT_Font030); | |
1774 if(change.x != stop.x) | |
1775 GFX_draw_thick_line(1,&t9screen, change, stop, CLUT_Font031); | |
1776 | |
1777 start.y -= 3; | |
1778 } | |
1779 | |
1780 /* He */ | |
1781 start.y -= 28 + 14; | |
1782 for(int i=0;i<16;i++) | |
1783 { | |
1784 stop.y = start.y; | |
1785 change.y = start.y; | |
1786 | |
1787 value = pState->lifeData.tissue_helium_bar[i]; | |
1788 value *= 80;//20 | |
1789 | |
1790 if(value < 0) | |
1791 front = 0; | |
1792 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
1793 front = CUSTOMBOX_SPACE_INSIDE; | |
1794 else | |
1795 front = (uint16_t)value; | |
1796 | |
1797 change.x = start.x + front; | |
1798 if(change.x != start.x) | |
1799 GFX_draw_thick_line(1,&t9screen, start, change, CLUT_Font030); | |
1800 if(change.x != stop.x) | |
1801 GFX_draw_thick_line(1,&t9screen, change, stop, CLUT_Font031); | |
1802 | |
1803 start.y -= 3; | |
1804 } | |
1805 | |
1806 /* CNS == Oxygen */ | |
1807 start.y -= 28 + 14; | |
1808 | |
1809 cns100pixel = (8 * CUSTOMBOX_SPACE_INSIDE) / 10; | |
1810 value = pState->lifeData.cns; | |
1811 value *= cns100pixel; | |
1812 value /= 100; | |
1813 | |
1814 if(value < 0) | |
1815 front = 0; | |
1816 else if(value > CUSTOMBOX_SPACE_INSIDE) | |
1817 front = CUSTOMBOX_SPACE_INSIDE; | |
1818 else | |
1819 front = (uint16_t)value; | |
1820 | |
1821 if(pState->lifeData.cns < 95) | |
1822 color = CLUT_Font030; | |
1823 else if(pState->lifeData.cns < 100) | |
1824 color = CLUT_WarningYellow; | |
1825 else | |
1826 color = CLUT_WarningRed; | |
1827 | |
1828 for(int i=0;i<16;i++) | |
1829 { | |
1830 stop.y = start.y; | |
1831 change.y = start.y; | |
1832 | |
1833 change.x = start.x + front; | |
1834 if(change.x != start.x) | |
1835 GFX_draw_thick_line(1,&t9screen, start, change, color); | |
1836 if(change.x != stop.x) | |
1837 GFX_draw_thick_line(1,&t9screen, change, stop, CLUT_Font031); | |
1838 | |
1839 start.y -= 3; | |
1840 } | |
1841 | |
1842 /* where is the onload/offload limit for N2 and He */ | |
1843 decom_get_inert_gases(pState->lifeData.pressure_ambient_bar, &pState->lifeData.actualGas, &percent_N2, &percent_He); | |
1844 partial_pressure_N2 = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_N2; | |
1845 partial_pressure_He = (pState->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * percent_He; | |
1846 | |
1847 // Nitrogen vertical bar | |
1848 start.y = t9cH.WindowY0 + 1 - 5; | |
1849 stop.y = start.y - (3 * 15) - 1; | |
1850 if((percent_N2 > 0) && (partial_pressure_N2 > 0.8f))//(0.8f + 0.5f))) | |
1851 { | |
1852 value = partial_pressure_N2; | |
1853 value *= 80;//20 | |
1854 | |
1855 if(value < 0) | |
1856 front = 3; | |
1857 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
1858 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
1859 else | |
1860 front = (uint16_t)value; | |
1861 } | |
1862 else | |
1863 { | |
1864 front = 1; | |
1865 } | |
1866 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
1867 stop.x = start.x; | |
1868 GFX_draw_thick_line(2,&t9screen, start, stop, CLUT_EverythingOkayGreen); | |
1869 | |
1870 | |
1871 // Helium vertical bar | |
1872 start.y = t9cH.WindowY0 + 1 - 5 - 3*16 - 28 - 14; | |
1873 stop.y = start.y - (3 * 15) - 1; | |
1874 if((percent_He > 0) && (partial_pressure_He > 0.01f)) // 0.5f | |
1875 { | |
1876 | |
1877 value = partial_pressure_He; | |
1878 value *= 80;//20 | |
1879 | |
1880 if(value < 0) | |
1881 front = 3; | |
1882 else if(value + 5 > CUSTOMBOX_SPACE_INSIDE) | |
1883 front = CUSTOMBOX_SPACE_INSIDE - 3; | |
1884 else | |
1885 front = (uint16_t)value; | |
1886 } | |
1887 else | |
1888 { | |
1889 front = 1; | |
1890 } | |
1891 | |
1892 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + front; | |
1893 stop.x = start.x; | |
1894 GFX_draw_thick_line(2,&t9screen, start, stop, CLUT_EverythingOkayGreen); | |
1895 | |
1896 // Oxygen vertical bar | |
1897 start.y = t9cH.WindowY0 + 1 - 5 - 6*16 - 2*28 - 2*14; | |
1898 stop.y = start.y - (3 * 15) - 1; | |
1899 | |
1900 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + cns100pixel; | |
1901 stop.x = start.x; | |
1902 GFX_draw_thick_line(2, &t9screen, start, stop, CLUT_WarningRed); | |
1903 } | |
1904 | |
1905 | |
1906 void t9_debug(void) | |
1907 { | |
1908 char text[256+50]; | |
1909 uint8_t textpointer = 0; | |
1910 | |
1911 t9cY0free.WindowLineSpacing = 28 + 48 + 14; | |
1912 t9cY0free.WindowY0 = t9cH.WindowY0 - 5 - 2 * t9cY0free.WindowLineSpacing; | |
1913 t9cY0free.WindowNumberOfTextLines = 3; | |
1914 | |
1915 textpointer += snprintf(&text[textpointer],50,"Ambient [bar]\n\r"); | |
1916 textpointer += snprintf(&text[textpointer],50,"Surface [bar] + salt\n\r"); | |
1917 // textpointer += snprintf(&text[textpointer],50,"Difference [mbar]\n\r"); | |
1918 textpointer += snprintf(&text[textpointer],50,"ShallowCounter [s]\n\r"); | |
1919 GFX_write_string(&FontT24, &t9cY0free, text, 1); | |
1920 | |
1921 t9cY0free.WindowY0 -= 52; | |
1922 // snprintf(text,60,"%0.2f\n\r%0.2f %u%%\n\r%0.0f",stateUsed->lifeData.pressure_ambient_bar, stateUsed->lifeData.pressure_surface_bar, settingsGetPointer()->salinity, 1000 * (stateUsed->lifeData.pressure_ambient_bar-stateUsed->lifeData.pressure_surface_bar)); | |
1923 snprintf(text,60, | |
1924 "%0.2f\n\r" | |
1925 "%0.2f %u%%\n\r" | |
1926 "%u" | |
1927 ,stateUsed->lifeData.pressure_ambient_bar | |
1928 ,stateUsed->lifeData.pressure_surface_bar | |
1929 ,settingsGetPointer()->salinity | |
1930 ,stateUsed->lifeData.counterSecondsShallowDepth); | |
1931 GFX_write_string(&FontT42, &t9cY0free, text, 1); | |
1932 } | |
1933 | |
1934 | |
1935 void t9_SummaryOfLeftCorner(void) | |
1936 { | |
1937 char text[256+60]; | |
1938 uint8_t textpointer = 0; | |
1939 | |
1940 const SDecoinfo * pDecoinfoStandard; | |
1941 const SDecoinfo * pDecoinfoFuture; | |
1942 float fCNS; | |
1943 | |
1944 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) | |
1945 { | |
1946 pDecoinfoStandard = &stateUsed->decolistBuehlmann; | |
1947 pDecoinfoFuture = &stateUsed->decolistFutureBuehlmann; | |
1948 } | |
1949 else | |
1950 { | |
1951 pDecoinfoStandard = &stateUsed->decolistVPM; | |
1952 pDecoinfoFuture = &stateUsed->decolistFutureVPM; | |
1953 } | |
1954 | |
1955 fCNS = stateUsed->lifeData .cns; | |
1956 if(fCNS > 999) | |
1957 fCNS = 999; | |
1958 | |
1959 t9cY0free.WindowY0 = t9cC.WindowY0 - 10; | |
1960 t9cY0free.WindowLineSpacing = 48; | |
1961 t9cY0free.WindowNumberOfTextLines = 6; | |
1962 t9cY0free.WindowTab = 420; | |
1963 | |
1964 // header | |
1965 textpointer = 0; | |
1966 text[textpointer++] = '\032'; | |
1967 text[textpointer++] = '\016'; | |
1968 text[textpointer++] = '\016'; | |
1969 text[textpointer++] = TXT_ppO2; | |
1970 text[textpointer++] = '\n'; | |
1971 text[textpointer++] = '\r'; | |
1972 text[textpointer++] = TXT_Ceiling; | |
1973 text[textpointer++] = '\n'; | |
1974 text[textpointer++] = '\r'; | |
1975 text[textpointer++] = TXT_ActualGradient; | |
1976 text[textpointer++] = '\n'; | |
1977 text[textpointer++] = '\r'; | |
1978 text[textpointer++] = TXT_CNS; | |
1979 text[textpointer++] = '\n'; | |
1980 text[textpointer++] = '\r'; | |
1981 text[textpointer++] = TXT_FutureTTS; | |
1982 text[textpointer++] = '\n'; | |
1983 text[textpointer++] = '\r'; | |
1984 text[textpointer++] = TXT_2BYTE; | |
1985 text[textpointer++] = TXT2BYTE_ScooterTemperature; | |
1986 text[textpointer++] = '\017'; | |
1987 text[textpointer++] = 0; | |
1988 t9cY0free.WindowX0 += 10; | |
1989 t9cY0free.WindowY0 += 10; | |
1990 GFX_write_string(&FontT24, &t9cY0free, text, 1); | |
1991 t9cY0free.WindowX0 -= 10; | |
1992 t9cY0free.WindowY0 -= 10; | |
1993 | |
1994 textpointer = 0; | |
1995 text[textpointer++] = '\t'; | |
1996 textpointer += snprintf(&text[textpointer],10,"\020%01.2f", stateUsed->lifeData.ppO2); | |
1997 text[textpointer++] = '\n'; | |
1998 text[textpointer++] = '\r'; | |
1999 text[textpointer++] = '\t'; | |
2000 if(pDecoinfoStandard->output_ceiling_meter <= 99.9f) | |
2001 textpointer += snprintf(&text[textpointer],10,"\020%01.1f",pDecoinfoStandard->output_ceiling_meter); | |
2002 else | |
2003 textpointer += snprintf(&text[textpointer],10,"\020%01.0f",pDecoinfoStandard->output_ceiling_meter); | |
2004 text[textpointer++] = '\n'; | |
2005 text[textpointer++] = '\r'; | |
2006 text[textpointer++] = '\t'; | |
2007 textpointer += snprintf(&text[textpointer],10,"\020%.0f", 100 * pDecoinfoStandard->output_relative_gradient); | |
2008 text[textpointer++] = '\n'; | |
2009 text[textpointer++] = '\r'; | |
2010 text[textpointer++] = '\t'; | |
2011 textpointer += snprintf(&text[textpointer],10,"\020%.0f\016\016%%\017",fCNS); | |
2012 text[textpointer++] = '\n'; | |
2013 text[textpointer++] = '\r'; | |
2014 text[textpointer++] = '\t'; | |
2015 textpointer += snprintf(&text[textpointer],10,"\020%i'", pDecoinfoFuture->output_time_to_surface_seconds / 60); | |
2016 text[textpointer++] = '\n'; | |
2017 text[textpointer++] = '\r'; | |
2018 text[textpointer++] = '\t'; | |
2019 textpointer += snprintf(&text[textpointer],15,"\020\016%01.0f \140",unit_temperature_float(((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f)); // "\016\016%01.1f `" + C or F | |
2020 if(settingsGetPointer()->nonMetricalSystem == 0) | |
2021 text[textpointer++] = 'C'; | |
2022 else | |
2023 text[textpointer++] = 'F'; | |
2024 text[textpointer++] = 0; | |
2025 text[textpointer++] = 0; | |
2026 GFX_write_string(&FontT42, &t9cY0free, text, 1); | |
2027 } | |
2028 | |
2029 | |
2030 void t9_scooter(void) | |
2031 { | |
2032 float scooterTemperatureLocal; | |
2033 uint16_t scooterSpeedLocal; | |
2034 // uint16_t scooterDrehzhl; | |
2035 uint8_t scooterResidualCapacity; | |
2036 // float scooterVoltage; | |
2037 // uint8_t scooterCurrent; | |
2038 //uint16_t scooterWattHours; | |
2039 // uint16_t bkpX0, bkpX1; | |
2040 | |
2041 uint16_t ageInMilliSeconds; | |
2042 uint8_t textSize; | |
2043 | |
2044 scooterTemperatureLocal = unit_temperature_float(((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f); | |
2045 scooterSpeedLocal = unit_speed_integer(stateUsed->lifeData.scooterSpeed); | |
2046 scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity(); | |
2047 | |
2048 // scooterDrehzhl = stateUsed->lifeData.scooterDrehzahl; | |
2049 // scooterVoltage = stateUsed->lifeData.scooterSpannung; | |
2050 // scooterCurrent = stateUsed->lifeData.scooterAmpere; | |
2051 // scooterWattHours = stateUsed->lifeData.scooterWattstunden; | |
2052 | |
2053 ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds; | |
2054 if(!ageInMilliSeconds) | |
2055 ageInMilliSeconds = 9999; | |
2056 | |
2057 char text[256+60]; | |
2058 uint8_t textpointer = 0; | |
2059 | |
2060 t9cY0free.WindowLineSpacing = 28 + 48 + 14; | |
2061 t9cY0free.WindowY0 = t9cH.WindowY0 - 5 - 2 * t9cY0free.WindowLineSpacing; | |
2062 t9cY0free.WindowNumberOfTextLines = 3; | |
2063 | |
2064 // header | |
2065 text[textpointer++] = '\032'; | |
2066 text[textpointer++] = TXT_2BYTE; | |
2067 text[textpointer++] = TXT2BYTE_ScooterRestkapazitaet; | |
2068 text[textpointer++] = '\n'; | |
2069 text[textpointer++] = '\r'; | |
2070 text[textpointer++] = TXT_2BYTE; | |
2071 text[textpointer++] = TXT2BYTE_ScooterTemperature; | |
2072 text[textpointer++] = '\n'; | |
2073 text[textpointer++] = '\r'; | |
2074 text[textpointer++] = TXT_2BYTE; | |
2075 text[textpointer++] = TXT2BYTE_ScooterSpeed; | |
2076 text[textpointer++] = 0; | |
2077 GFX_write_string(&FontT24, &t9cY0free, text, 1); | |
2078 | |
2079 /* | |
2080 snprintf(text,60, | |
2081 "\032" | |
2082 "%0u" "\016\016 Wh used\017" | |
2083 ,stateUsed->lifeData.scooterWattstunden); | |
2084 */ | |
2085 if(ageInMilliSeconds > 1500) | |
2086 text[0] = '\031'; | |
2087 GFX_write_string(&FontT24, &t9cY0free, text, 1); | |
2088 | |
2089 /* | |
2090 snprintf(text,60, | |
2091 "\030" | |
2092 "\n\r" | |
2093 "\n\r" | |
2094 "%0u" "\022\016\016 rpm\017\030" | |
2095 ,stateUsed->lifeData.scooterDrehzahl); | |
2096 GFX_write_string(&FontT24, &t9cY0free, text, 1); | |
2097 */ | |
2098 // data | |
2099 t9cY0free.WindowY0 -= 52; | |
2100 if(settingsGetPointer()->nonMetricalSystem == 0) | |
2101 { | |
2102 textSize = snprintf(text,60, | |
2103 "\030" | |
2104 "%0u" "\022\016\016 %%\017\030" | |
2105 "\n\r" | |
2106 "%0.0f\140" "\022\016\016 C\017\030" | |
2107 "\n\r" | |
2108 "%u" "\022\016\016 m/min\017\030" | |
2109 ,scooterResidualCapacity,scooterTemperatureLocal,scooterSpeedLocal); | |
2110 } | |
2111 else | |
2112 { | |
2113 textSize = snprintf(text,60, | |
2114 "\030" | |
2115 "%0u" "\022\016\016 %%\017\030" | |
2116 "\n\r" | |
2117 "%0.0f\140" "\022\016\016 Fht\017\030" | |
2118 "\n\r" | |
2119 "%u" "\022\016\016 ft/min\017\030" | |
2120 ,scooterResidualCapacity,scooterTemperatureLocal,scooterSpeedLocal); | |
2121 } | |
2122 // connection active | |
2123 if(ageInMilliSeconds > 1500) | |
2124 { | |
2125 for(int i=0; i < textSize -2; i++) | |
2126 { | |
2127 if(text[i] == '\030') | |
2128 text[i] = '\031'; | |
2129 } | |
2130 } | |
2131 // write data | |
2132 GFX_write_string(&FontT42, &t9cY0free, text, 1); | |
2133 | |
2134 // age stamp | |
2135 if(ageInMilliSeconds < 9999) | |
2136 { | |
2137 t9cY0free.WindowY0 -= 30; | |
2138 snprintf(text,60, | |
2139 "\021\001%u" | |
2140 ,ageInMilliSeconds); | |
2141 GFX_write_string(&FontT24, &t9cY0free, text, 0); | |
2142 } | |
2143 } | |
2144 | |
2145 | |
2146 void t9_scooter_May2016_01(void) | |
2147 { | |
2148 float scooterTemperature; | |
2149 uint16_t scooterDrehzhl; | |
2150 uint8_t scooterResidualCapacity; | |
2151 float scooterSpeed; | |
2152 float scooterVoltage; | |
2153 uint8_t scooterCurrent; | |
2154 // uint16_t scooterWattHours; | |
2155 uint16_t bkpX0, bkpX1; | |
2156 | |
2157 uint16_t ageInMilliSeconds; | |
2158 uint8_t textSize; | |
2159 // old scooterStatus = bC_getData(0,&scooterTemperature,&scooterDrehzhl,&scooterResidualCapacity); | |
2160 | |
2161 scooterDrehzhl = stateUsed->lifeData.scooterDrehzahl; | |
2162 scooterTemperature = ((float)(stateUsed->lifeData.scooterTemperature)) / 10.0f; | |
2163 scooterResidualCapacity = stateUsed_scooterRemainingBattCapacity(); | |
2164 | |
2165 scooterVoltage = stateUsed->lifeData.scooterSpannung; | |
2166 scooterCurrent = stateUsed->lifeData.scooterAmpere; | |
2167 // scooterWattHours = stateUsed->lifeData.scooterWattstunden; | |
2168 | |
2169 ageInMilliSeconds = stateUsed->lifeData.scooterAgeInMilliSeconds; | |
2170 if(!ageInMilliSeconds) | |
2171 ageInMilliSeconds = 9999; | |
2172 | |
2173 scooterSpeed = scooterDrehzhl * 80 / 3300; | |
2174 | |
2175 char text[256+60]; | |
2176 | |
2177 t9cY0free.WindowLineSpacing = (28 + 48 + 14)/2; | |
2178 t9cY0free.WindowY0 = t9cH.WindowY0 - 5 - 5 * t9cY0free.WindowLineSpacing; | |
2179 t9cY0free.WindowNumberOfTextLines = 6; | |
2180 | |
2181 t9cY0free.WindowY0 -= 7; | |
2182 | |
2183 bkpX0 = t9cY0free.WindowX0; | |
2184 bkpX1 = t9cY0free.WindowX1; | |
2185 t9cY0free.WindowX0 = 430; | |
2186 | |
2187 textSize = snprintf(text,120, | |
2188 "\022\016\016" | |
2189 "%%" | |
2190 "\n\r" | |
2191 "celsius" | |
2192 "\n\r" | |
2193 "rpm" | |
2194 "\n\r" | |
2195 "m/min" | |
2196 "\n\r" | |
2197 "Ampere" | |
2198 "\n\r" | |
2199 "Volt" | |
2200 // "\n\r" | |
2201 // "Wh" | |
2202 ); | |
2203 GFX_write_string(&FontT42, &t9cY0free, text, 1); | |
2204 | |
2205 t9cY0free.WindowX0 = bkpX0; | |
2206 t9cY0free.WindowX1 = 420; | |
2207 | |
2208 textSize = snprintf(text,120, | |
2209 "\030" | |
2210 "\002" | |
2211 "%0u" | |
2212 "\n\r" | |
2213 "\002" | |
2214 "%0.0f" | |
2215 "\n\r" | |
2216 "\002" | |
2217 "%0u" | |
2218 "\n\r" | |
2219 "\002" | |
2220 "%0.0f" | |
2221 "\n\r" | |
2222 "\002" | |
2223 "%0u" | |
2224 "\n\r" | |
2225 "\002" | |
2226 "%0.1f" | |
2227 // "\n\r" | |
2228 // "%0u" "\022\016\016 Wh\017\030" | |
2229 ,scooterResidualCapacity,scooterTemperature,scooterDrehzhl,scooterSpeed | |
2230 ,scooterCurrent,scooterVoltage);//,scooterWattHours); | |
2231 | |
2232 if((ageInMilliSeconds > 1500) || (stateUsed->lifeData.scooterType == 0xFF)) | |
2233 { | |
2234 for(int i=0; i < textSize -2; i++) | |
2235 { | |
2236 if(text[i] == '\030') | |
2237 text[i] = '\031'; | |
2238 } | |
2239 } | |
2240 GFX_write_string(&FontT42, &t9cY0free, text, 1); | |
2241 | |
2242 t9cY0free.WindowX0 = bkpX0; | |
2243 t9cY0free.WindowX1 = bkpX1; | |
2244 | |
2245 t9cY0free.WindowY0 -= 30; | |
2246 snprintf(text,60, | |
2247 "\021\001%u" | |
2248 ,ageInMilliSeconds); | |
2249 GFX_write_string(&FontT24, &t9cY0free, text, 0); | |
2250 | |
2251 } | |
2252 | |
2253 | |
2254 void t9_compass(uint16_t ActualHeading, uint16_t UserSetHeading) | |
2255 { | |
2256 uint16_t LeftBorderHeading, LineHeading; | |
2257 uint32_t offsetPicture; | |
2258 point_t start, stop, center; | |
2259 static int32_t LastHeading = 0; | |
2260 int32_t newHeading = 0; | |
2261 int32_t diff = 0; | |
2262 int32_t diff2 = 0; | |
2263 | |
2264 int32_t diffAbs = 0; | |
2265 int32_t diffAbs2 = 0; | |
2266 | |
2267 newHeading = ActualHeading; | |
2268 | |
2269 diff = newHeading - LastHeading; | |
2270 | |
2271 if(newHeading < LastHeading) | |
2272 diff2 = newHeading + 360 - LastHeading; | |
2273 else | |
2274 diff2 = newHeading - 360 - LastHeading; | |
2275 | |
2276 diffAbs = diff; | |
2277 if(diffAbs < 0) | |
2278 diffAbs *= -1; | |
2279 | |
2280 diffAbs2 = diff2; | |
2281 if(diffAbs2 < 0) | |
2282 diffAbs2 *= -1; | |
2283 | |
2284 | |
2285 if(diffAbs <= diffAbs2) | |
2286 newHeading = LastHeading + (diff / 2); | |
2287 else | |
2288 newHeading = LastHeading + (diff2 / 2); | |
2289 | |
2290 if(newHeading < 0) | |
2291 newHeading += 360; | |
2292 else | |
2293 if(newHeading >= 360) | |
2294 newHeading -= 360; | |
2295 | |
2296 LastHeading = newHeading; | |
2297 ActualHeading = newHeading; | |
2298 | |
2299 if (ActualHeading < 90) | |
2300 ActualHeading += 360; | |
2301 | |
2302 LeftBorderHeading = 2 * (ActualHeading - (CUSTOMBOX_SPACE_INSIDE/4)); | |
2303 | |
2304 offsetPicture = LeftBorderHeading * t9screenCompass.ImageHeight * 2; | |
2305 | |
2306 t9_background.pointer = t9screenCompass.FBStartAdress+offsetPicture; | |
2307 t9_background.x0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
2308 t9_background.y0 = 65; | |
2309 t9_background.width = CUSTOMBOX_SPACE_INSIDE; | |
2310 t9_background.height = t9screenCompass.ImageHeight; | |
2311 | |
2312 start.x = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + (CUSTOMBOX_SPACE_INSIDE/2); | |
2313 stop.x = start.x; | |
2314 start.y = 65; | |
2315 stop.y = start.y + 55; | |
2316 GFX_draw_line(&t9screen, start, stop, CLUT_Font030); | |
2317 | |
2318 | |
2319 center.x = start.x; | |
2320 center.y = 300; | |
2321 | |
2322 stop.x = center.x + 44; | |
2323 stop.y = center.y + 24; | |
2324 | |
2325 | |
2326 while(ActualHeading > 359) ActualHeading -= 360; | |
2327 LineHeading = 360 - ActualHeading; | |
2328 GFX_draw_thick_line(9,&t9screen, t9_compass_circle(0,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font030); // North | |
2329 LineHeading += 90; | |
2330 if(LineHeading > 359) LineHeading -= 360; | |
2331 GFX_draw_thick_line(9,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); // Maintick | |
2332 LineHeading += 90; | |
2333 if(LineHeading > 359) LineHeading -= 360; | |
2334 GFX_draw_thick_line(9,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2335 LineHeading += 90; | |
2336 if(LineHeading > 359) LineHeading -= 360; | |
2337 GFX_draw_thick_line(9,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2338 | |
2339 LineHeading = 360 - ActualHeading; | |
2340 LineHeading += 45; | |
2341 if(LineHeading > 359) LineHeading -= 360; | |
2342 GFX_draw_thick_line(5,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
2343 LineHeading += 90; | |
2344 if(LineHeading > 359) LineHeading -= 360; | |
2345 GFX_draw_thick_line(5,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2346 LineHeading += 90; | |
2347 if(LineHeading > 359) LineHeading -= 360; | |
2348 GFX_draw_thick_line(5,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2349 LineHeading += 90; | |
2350 if(LineHeading > 359) LineHeading -= 360; | |
2351 GFX_draw_thick_line(5,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2352 | |
2353 LineHeading = 360 - ActualHeading; | |
2354 LineHeading += 22; | |
2355 if(LineHeading > 359) LineHeading -= 360; | |
2356 GFX_draw_thick_line(3,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
2357 LineHeading += 45; | |
2358 if(LineHeading > 359) LineHeading -= 360; | |
2359 GFX_draw_thick_line(3,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2360 LineHeading += 45; | |
2361 if(LineHeading > 359) LineHeading -= 360; | |
2362 GFX_draw_thick_line(3,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2363 LineHeading += 45; | |
2364 if(LineHeading > 359) LineHeading -= 360; | |
2365 GFX_draw_thick_line(3,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2366 LineHeading += 45; | |
2367 if(LineHeading > 359) LineHeading -= 360; | |
2368 GFX_draw_thick_line(3,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); // Subtick | |
2369 LineHeading += 45; | |
2370 if(LineHeading > 359) LineHeading -= 360; | |
2371 GFX_draw_thick_line(3,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2372 LineHeading += 45; | |
2373 if(LineHeading > 359) LineHeading -= 360; | |
2374 GFX_draw_thick_line(3,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2375 LineHeading += 45; | |
2376 if(LineHeading > 359) LineHeading -= 360; | |
2377 GFX_draw_thick_line(3,&t9screen, t9_compass_circle(1,LineHeading), t9_compass_circle(2,LineHeading), CLUT_Font031); | |
2378 | |
2379 if(UserSetHeading) | |
2380 { | |
2381 LineHeading = UserSetHeading + 360 - ActualHeading; | |
2382 if(LineHeading > 359) LineHeading -= 360; | |
2383 GFX_draw_thick_line(9,&t9screen, t9_compass_circle(3,LineHeading), t9_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick); | |
2384 | |
2385 // R�ckpeilung, User Back Heading | |
2386 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; | |
2387 if(LineHeading > 359) LineHeading -= 360; | |
2388 if(LineHeading > 359) LineHeading -= 360; | |
2389 GFX_draw_thick_line(9,&t9screen, t9_compass_circle(3,LineHeading), t9_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick); | |
2390 } | |
2391 | |
2392 center.x = start.x; | |
2393 center.y = 250; | |
2394 GFX_draw_circle(&t9screen, center, 116, CLUT_Font030); | |
2395 GFX_draw_circle(&t9screen, center, 118, CLUT_Font030); | |
2396 GFX_draw_circle(&t9screen, center, 117, CLUT_Font030); | |
2397 } | |
2398 | |
2399 | |
2400 void init_t9_compass(void) | |
2401 { | |
2402 t9screenCompass.FBStartAdress = getFrame(26); | |
2403 | |
2404 char text[256]; | |
2405 uint8_t textpointer = 0; | |
2406 | |
2407 text[textpointer++] = '\030'; | |
2408 text[textpointer++] = '\177'; | |
2409 text[textpointer++] = '\177'; | |
2410 text[textpointer++] = 76; // 90 - 14 | |
2411 text[textpointer++] = '\016'; | |
2412 text[textpointer++] = '\016'; | |
2413 text[textpointer++] = 'N'; | |
2414 text[textpointer++] = 'E'; // 96 + 28 = 124 total | |
2415 text[textpointer++] = '\017'; | |
2416 text[textpointer++] = '\177'; | |
2417 text[textpointer++] = '\177'; | |
2418 text[textpointer++] = 64; // 90 - 14 - 12 | |
2419 text[textpointer++] = 'E'; // 124 + 74 + 23 = 221 total | |
2420 text[textpointer++] = '\177'; | |
2421 text[textpointer++] = '\177'; | |
2422 text[textpointer++] = 66; // 90 - 11 - 13 | |
2423 text[textpointer++] = '\016'; | |
2424 text[textpointer++] = '\016'; | |
2425 text[textpointer++] = 'S'; | |
2426 text[textpointer++] = 'E'; | |
2427 text[textpointer++] = '\017'; | |
2428 text[textpointer++] = '\177'; | |
2429 text[textpointer++] = '\177'; | |
2430 text[textpointer++] = 68; // 90 - 12 - 10 | |
2431 text[textpointer++] = 'S'; | |
2432 text[textpointer++] = '\177'; | |
2433 text[textpointer++] = '\177'; | |
2434 text[textpointer++] = 64; // 90 - 10 - 16 | |
2435 text[textpointer++] = '\016'; | |
2436 text[textpointer++] = '\016'; | |
2437 text[textpointer++] = 'S'; | |
2438 text[textpointer++] = 'W'; | |
2439 text[textpointer++] = '\017'; | |
2440 text[textpointer++] = '\177'; | |
2441 text[textpointer++] = '\177'; | |
2442 text[textpointer++] = 56; // 90 - 16 - 18 | |
2443 text[textpointer++] = 'W'; | |
2444 text[textpointer++] = '\177'; | |
2445 text[textpointer++] = '\177'; | |
2446 text[textpointer++] = 54; // 90 - 18 - 18 | |
2447 text[textpointer++] = '\016'; | |
2448 text[textpointer++] = '\016'; | |
2449 text[textpointer++] = 'N'; | |
2450 text[textpointer++] = 'W'; | |
2451 text[textpointer++] = '\017'; | |
2452 text[textpointer++] = '\177'; | |
2453 text[textpointer++] = '\177'; | |
2454 text[textpointer++] = 59; // 90 - 17 - 14 | |
2455 text[textpointer++] = 'N'; | |
2456 text[textpointer++] = '\177'; | |
2457 text[textpointer++] = '\177'; | |
2458 text[textpointer++] = 63; // 90 - 13 - 14 | |
2459 text[textpointer++] = '\016'; | |
2460 text[textpointer++] = '\016'; | |
2461 text[textpointer++] = 'N'; | |
2462 text[textpointer++] = 'E'; | |
2463 text[textpointer++] = '\017'; | |
2464 text[textpointer++] = '\177'; | |
2465 text[textpointer++] = '\177'; | |
2466 text[textpointer++] = 64; // 90 - 14 - 12 | |
2467 text[textpointer++] = 'E'; | |
2468 text[textpointer++] = '\177'; | |
2469 text[textpointer++] = '\177'; | |
2470 text[textpointer++] = 66; // 90 - 11 - 13 | |
2471 text[textpointer++] = '\016'; | |
2472 text[textpointer++] = '\016'; | |
2473 text[textpointer++] = 'S'; | |
2474 text[textpointer++] = 'E'; | |
2475 text[textpointer++] = '\017'; | |
2476 text[textpointer++] = '\177'; | |
2477 text[textpointer++] = '\177'; | |
2478 text[textpointer++] = 68; // 90 - 12 - 10 | |
2479 text[textpointer++] = 'S'; | |
2480 text[textpointer++] = '\177'; | |
2481 text[textpointer++] = '\177'; | |
2482 text[textpointer++] = 64; // 90 - 10 - 16 | |
2483 text[textpointer++] = '\016'; | |
2484 text[textpointer++] = '\016'; | |
2485 text[textpointer++] = 'S'; | |
2486 text[textpointer++] = 'W'; | |
2487 text[textpointer++] = '\017'; | |
2488 text[textpointer++] = 0; // end | |
2489 | |
2490 GFX_write_string(&FontT42,&t9pCompass,text,1); | |
2491 | |
2492 releaseAllFramesExcept(26,t9screenCompass.FBStartAdress); | |
2493 } | |
2494 | |
2495 | |
2496 void t9_miniLiveLogProfile(void) | |
2497 { | |
2498 SWindowGimpStyle wintemp; | |
2499 wintemp.left = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET; | |
2500 wintemp.right = wintemp.left + CUSTOMBOX_SPACE_INSIDE; | |
2501 wintemp.top = 480 - t9l1.WindowY0; | |
2502 wintemp.bottom = wintemp. top + 200; | |
2503 | |
2504 uint16_t max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 10); | |
2505 | |
2506 GFX_graph_print(&t9screen, &wintemp, 0,1,0, max_depth, getMiniLiveLogbookPointerToData(), getMiniLiveLogbookActualDataLength(), CLUT_Font030, NULL); | |
2507 } | |
2508 |