comparison Discovery/Src/t3.c @ 38:5f11787b4f42

include in ostc4 repository
author heinrichsweikamp
date Sat, 28 Apr 2018 11:52:34 +0200
parents
children cc8e24374b83
comparison
equal deleted inserted replaced
37:ccc45c0e1ea2 38:5f11787b4f42
1 ///////////////////////////////////////////////////////////////////////////////
2 /// -*- coding: UTF-8 -*-
3 ///
4 /// \file Discovery/Src/t3.c
5 /// \brief Main Template file for dive mode special scree t3
6 /// \author Heinrichs Weikamp gmbh
7 /// \date 10-Nov-2014
8 ///
9 /// \details
10 ///
11 /// $Id$
12 ///////////////////////////////////////////////////////////////////////////////
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
14 ///
15 /// This program is free software: you can redistribute it and/or modify
16 /// it under the terms of the GNU General Public License as published by
17 /// the Free Software Foundation, either version 3 of the License, or
18 /// (at your option) any later version.
19 ///
20 /// This program is distributed in the hope that it will be useful,
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 /// GNU General Public License for more details.
24 ///
25 /// You should have received a copy of the GNU General Public License
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
27 //////////////////////////////////////////////////////////////////////////////
28
29 /* Includes ------------------------------------------------------------------*/
30 #include "t3.h"
31
32 #include "data_exchange_main.h"
33 #include "decom.h"
34 #include "gfx_fonts.h"
35 #include "math.h"
36 #include "tHome.h"
37 #include "timer.h"
38 #include "unit.h"
39
40 //* Importend function prototypes ---------------------------------------------*/
41 extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium);
42
43 /* Exported variables --------------------------------------------------------*/
44
45 const uint16_t BigFontSeperationLeftRight = 399;
46 const uint16_t BigFontSeperationTopBottom = 240;
47
48 /* Private variables ---------------------------------------------------------*/
49 GFX_DrawCfgScreen t3screen;
50 GFX_DrawCfgWindow t3l1;
51 GFX_DrawCfgWindow t3r1;
52 GFX_DrawCfgWindow t3c1;
53 GFX_DrawCfgWindow t3c2;
54
55 extern float depthLastCall[9];
56 extern uint8_t idDepthLastCall;
57 extern float temperatureLastCall[3];
58 extern uint8_t idTemperatureLastCall;
59
60 uint8_t t3_selection_customview = 0;
61
62 /* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/
63
64 /* Private types -------------------------------------------------------------*/
65 #define TEXTSIZE 16
66
67 const uint8_t t3_customviewsStandard[] =
68 {
69 CVIEW_T3_Decostop,
70 CVIEW_sensors,
71 CVIEW_Compass,
72 CVIEW_T3_MaxDepth,
73 CVIEW_T3_StopWatch,
74 CVIEW_T3_TTS,
75 CVIEW_T3_ppO2andGas,
76 CVIEW_T3_END
77 };
78
79 const uint8_t t3_customviewsScooter[] =
80 {
81 CVIEW_Scooter,
82 CVIEW_Compass,
83
84 CVIEW_T3_Decostop,
85 CVIEW_T3_MaxDepth,
86 CVIEW_T3_StopWatch,
87 CVIEW_T3_TTS,
88 CVIEW_T3_ppO2andGas,
89
90 CVIEW_T3_END
91 };
92
93 const uint8_t *t3_customviews = t3_customviewsStandard;
94
95 /* Private function prototypes -----------------------------------------------*/
96 void t3_refresh_divemode(void);
97
98 uint8_t t3_test_customview_warnings(void);
99 void t3_refresh_customview(float depth);
100 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, uint16_t ActualHeading, uint16_t UserSetHeading);
101
102 /* Exported functions --------------------------------------------------------*/
103
104 void t3_init(void)
105 {
106 if(getLicence() == LICENCEBONEX)
107 {
108 t3_customviews = t3_customviewsScooter;
109 }
110
111 t3_selection_customview = t3_customviews[0];
112
113 t3screen.FBStartAdress = 0;
114 t3screen.ImageHeight = 480;
115 t3screen.ImageWidth = 800;
116 t3screen.LayerIndex = 1;
117
118 t3l1.Image = &t3screen;
119 t3l1.WindowNumberOfTextLines = 2;
120 t3l1.WindowLineSpacing = 19; // Abstand von Y0
121 t3l1.WindowTab = 100;
122 t3l1.WindowX0 = 0;
123 t3l1.WindowX1 = BigFontSeperationLeftRight - 5;
124 t3l1.WindowY0 = BigFontSeperationTopBottom + 5;
125 t3l1.WindowY1 = 479;
126
127 t3r1.Image = &t3screen;
128 t3r1.WindowNumberOfTextLines = t3l1.WindowNumberOfTextLines;
129 t3r1.WindowLineSpacing = t3l1.WindowLineSpacing;
130 t3r1.WindowTab = t3l1.WindowTab;
131 t3r1.WindowX0 = BigFontSeperationLeftRight + 5;
132 t3r1.WindowX1 = 799;
133 t3r1.WindowY0 = t3l1.WindowY0;
134 t3r1.WindowY1 = t3l1.WindowY1;
135
136 t3c1.Image = &t3screen;
137 t3c1.WindowNumberOfTextLines = 2;
138 t3c1.WindowLineSpacing = t3l1.WindowLineSpacing;
139 t3c1.WindowX0 = 0;
140 t3c1.WindowX1 = 799;
141 t3c1.WindowY0 = 0;
142 t3c1.WindowY1 = BigFontSeperationTopBottom - 5;
143
144 t3c2.Image = &t3screen;
145 t3c2.WindowNumberOfTextLines = 3;
146 t3c2.WindowLineSpacing = 58;
147 t3c2.WindowX0 = 370;
148 t3c2.WindowX1 = 799;
149 t3c2.WindowY0 = 0;
150 t3c2.WindowY1 = BigFontSeperationTopBottom - 5;
151 t3c2.WindowTab = 600;
152 }
153
154
155 void t3_refresh(void)
156 {
157 SStateList status;
158 get_globalStateList(&status);
159
160 if(stateUsed->mode != MODE_DIVE)
161 {
162 settingsGetPointer()->design = 7;
163 return;
164 }
165
166 if(status.base != BaseHome)
167 return;
168
169 t3screen.FBStartAdress = getFrame(24);
170 t3_refresh_divemode();
171 GFX_SetFramesTopBottom(t3screen.FBStartAdress, NULL,480);
172 releaseAllFramesExcept(24,t3screen.FBStartAdress);
173 }
174
175
176 /* Private functions ---------------------------------------------------------*/
177
178 float t3_basics_lines_depth_and_divetime(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode)
179 {
180 char text[512];
181 uint8_t color;
182 uint8_t depthChangeRate;
183 uint8_t depthChangeAscent;
184 point_t start, stop, startZeroLine;
185
186 start.x = 0;
187 stop.x = 799;
188 stop.y = start.y = BigFontSeperationTopBottom;
189 GFX_draw_line(tXscreen, start, stop, CLUT_Font020);
190
191 start.y = BigFontSeperationTopBottom;
192 stop.y = 479;
193 stop.x = start.x = BigFontSeperationLeftRight;
194 GFX_draw_line(tXscreen, start, stop, CLUT_Font020);
195
196
197 /* depth */
198 float depth = 0;
199 float depthThisCall = unit_depth_float(stateUsed->lifeData.depth_meter);
200 if(is_stateUsedSetToSim())
201 {
202 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2] + depthLastCall[3] + depthLastCall[4] + depthLastCall[5] + depthLastCall[6] + depthLastCall[7] + depthLastCall[8]) / 10.0f;
203
204 idDepthLastCall++;
205 if(idDepthLastCall >= 9)
206 idDepthLastCall = 0;
207 depthLastCall[idDepthLastCall] = depthThisCall;
208 }
209 else
210 {
211 depth = (depthThisCall + depthLastCall[0] + depthLastCall[1] + depthLastCall[2]) / 4.0f;
212
213 idDepthLastCall++;
214 if(idDepthLastCall >= 3)
215 idDepthLastCall = 0;
216 depthLastCall[idDepthLastCall] = depthThisCall;
217 }
218
219 if(depth <= 0.3f)
220 depth = 0;
221
222 if(settingsGetPointer()->nonMetricalSystem)
223 snprintf(text,TEXTSIZE,"\032\f[feet]");
224 else
225 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Depth);
226 GFX_write_string(&FontT42,tXl1,text,0);
227
228 if( ((mode == DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4 )))
229 || ((mode != DIVEMODE_Apnea) && ((stateUsed->lifeData.ascent_rate_meter_per_min > 8) || (stateUsed->lifeData.ascent_rate_meter_per_min < -10)))
230 )
231 {
232 snprintf(text,TEXTSIZE,"\f\002%.0f %c%c/min "
233 , unit_depth_float(stateUsed->lifeData.ascent_rate_meter_per_min)
234 , unit_depth_char1()
235 , unit_depth_char2()
236 );
237 GFX_write_string(&FontT42,tXl1,text,0);
238 }
239
240 if( depth < 100)
241 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",depth);
242 else
243 snprintf(text,TEXTSIZE,"\020\003\016%01.0f",depth);
244
245 t3_basics_colorscheme_mod(text);
246 GFX_write_string(&FontT105,tXl1,text,1);
247
248
249 /* ascentrate graph */
250 if(mode == DIVEMODE_Apnea)
251 {
252 /* ascentrate graph - apnea mode */
253 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0)
254 {
255 depthChangeAscent = 1;
256 if(stateUsed->lifeData.ascent_rate_meter_per_min < 200)
257 depthChangeRate = (uint8_t)stateUsed->lifeData.ascent_rate_meter_per_min;
258 else
259 depthChangeRate = 200;
260 }
261 else
262 {
263 depthChangeAscent = 0;
264 if(stateUsed->lifeData.ascent_rate_meter_per_min > -200)
265 depthChangeRate = (uint8_t)(0 - stateUsed->lifeData.ascent_rate_meter_per_min);
266 else
267 depthChangeRate = 200;
268 }
269 start.y = tXl1->WindowY0 - 1;
270 for(int i = 0; i<5;i++)
271 {
272 start.y += 40;
273 stop.y = start.y;
274 start.x = tXl1->WindowX1 - 1;
275 stop.x = start.x - 17;
276
277 if(depthChangeRate <= 6)
278 {
279 if(i == 2)
280 {
281 startZeroLine.y = start.y;
282 stop.x = start.x - 34;
283 }
284 }
285 else
286 {
287 if(((i == 1) && depthChangeAscent) || ((i == 3) && !depthChangeAscent))
288 {
289 startZeroLine.y = start.y;
290 stop.x = start.x - 34;
291 }
292 }
293 GFX_draw_line(tXscreen, start, stop, 0);
294 }
295 // new thick bar design Sept. 2015
296 if((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4))
297 {
298 start.y = startZeroLine.y;
299
300 if(depthChangeAscent)
301 {
302 color = CLUT_EverythingOkayGreen;
303 start.y += 7; // starte etwas weiter oben
304 stop.y = start.y + (uint16_t)(depthChangeRate * 4) - 9; // - x; // wegen der Liniendicke
305 if(stop.y > 475)
306 stop.y = 475;
307 }
308 else
309 {
310 color = CLUT_Font023;
311 start.y -= 7;
312 stop.y = start.y - (uint16_t)(depthChangeRate * 4) + 9;
313 if(stop.y <= tXl1->WindowY0)
314 stop.y = tXl1->WindowY0 + 1;
315 }
316 stop.x = start.x = tXl1->WindowX1 - 8;
317 GFX_draw_thick_line(12,tXscreen, start, stop, color);
318 }
319 }
320 else
321 {
322 /* ascentrate graph -standard mode */
323 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0)
324 {
325 start.y = tXl1->WindowY0 - 1;
326 for(int i = 0; i<4;i++)
327 {
328 start.y += 5*8;
329 stop.y = start.y;
330 start.x = tXl1->WindowX1 - 1;
331 stop.x = start.x - 17;
332 GFX_draw_line(tXscreen, start, stop, 0);
333 }
334 // new thick bar design Sept. 2015
335 start.x = tXl1->WindowX1 - 3 - 5;
336 stop.x = start.x;
337 start.y = tXl1->WindowY0 - 1;
338 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8);
339 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9
340 if(stop.y >= 470)
341 stop.y = 470;
342 start.y += 7; // starte etwas weiter oben
343 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 10)
344 color = CLUT_EverythingOkayGreen;
345 else
346 if(stateUsed->lifeData.ascent_rate_meter_per_min <= 15)
347 color = CLUT_WarningYellow;
348 else
349 color = CLUT_WarningRed;
350
351 GFX_draw_thick_line(12,tXscreen, start, stop, color);
352 }
353 }
354
355 // divetime
356 if(mode == DIVEMODE_Apnea)
357 {
358 if(stateUsed->lifeData.counterSecondsShallowDepth)
359 {
360 SDivetime SurfaceBreakTime = {0,0,0,0};
361
362 SurfaceBreakTime.Total = stateUsed->lifeData.counterSecondsShallowDepth;
363 SurfaceBreakTime.Minutes = SurfaceBreakTime.Total / 60;
364 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60);
365
366 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface);
367 GFX_write_string(&FontT42,tXr1,text,0);
368
369 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds);
370 }
371 else
372 {
373 SDivetime Divetime = {0,0,0, 0};
374
375 Divetime.Total = stateUsed->lifeData.dive_time_seconds;
376 Divetime.Minutes = Divetime.Total / 60;
377 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 );
378
379 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime);
380 GFX_write_string(&FontT42,tXr1,text,0);
381
382 if(Divetime.Minutes < 100)
383 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds);
384 else
385 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes);
386 }
387 }
388 else
389 {
390 SDivetime Divetime = {0,0,0, 0};
391
392 Divetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time;
393 Divetime.Minutes = Divetime.Total / 60;
394 Divetime.Seconds = Divetime.Total - ( Divetime.Minutes * 60 );
395
396 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime);
397 GFX_write_string(&FontT42,tXr1,text,0);
398
399 if(Divetime.Minutes < 100)
400 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds);
401 else
402 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes);
403 }
404 t3_basics_colorscheme_mod(text);
405 GFX_write_string(&FontT105,tXr1,text,1);
406
407 return depth;
408 }
409
410
411 void t3_refresh_divemode(void)
412 {
413 uint8_t customview_warnings = 0;
414 float depth_meter = 0.0;
415
416 // everything like lines, depth, ascent graph and divetime
417 depth_meter = t3_basics_lines_depth_and_divetime(&t3screen, &t3l1, &t3r1, 0); // 0 could be stateUsed->diveSettings.diveMode for CCR specials
418
419 // customview
420 if(stateUsed->warnings.numWarnings)
421 customview_warnings = t3_test_customview_warnings();
422
423 if(customview_warnings && warning_count_high_time)
424 t3_basics_show_customview_warnings(&t3c1);
425 else
426 t3_refresh_customview(depth_meter);
427
428 if(stateUsed->warnings.lowBattery)
429 t3_basics_battery_low_customview_extra(&t3c1);
430 }
431
432
433 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1)
434 {
435 char TextC1[256];
436
437 TextC1[0] = '\002';
438 TextC1[1] = '\f';
439 TextC1[2] = '\025';
440 TextC1[3] = '3';
441 TextC1[4] = '1';
442 TextC1[5] = '1';
443 TextC1[6] = '1';
444 TextC1[7] = '1';
445 TextC1[8] = '1';
446 TextC1[9] = '1';
447 TextC1[10] = '1';
448 TextC1[11] = '1';
449 TextC1[12] = '1';
450 TextC1[13] = '1';
451 TextC1[14] = '0';
452 TextC1[15] = 0;
453
454 if(!warning_count_high_time)
455 TextC1[4] = '2';
456
457 GFX_write_string(&Batt24,tXc1,TextC1,0);
458 }
459
460
461 void t3_basics_battery_scooter_customview_extra(GFX_DrawCfgWindow* tXc1)
462 {
463 char TextC1[256];
464
465 TextC1[0] = '\001';
466 TextC1[1] = '\f';
467 TextC1[2] = '\032';
468 TextC1[3] = '3';
469 TextC1[4] = '1';
470 TextC1[5] = '1';
471 TextC1[6] = '1';
472 TextC1[7] = '1';
473 TextC1[8] = '1';
474 TextC1[9] = '1';
475 TextC1[10] = '1';
476 TextC1[11] = '1';
477 TextC1[12] = '1';
478 TextC1[13] = '1';
479 TextC1[14] = '0';
480 TextC1[15] = 0;
481
482 for(int i=1;i<=10;i++)
483 {
484 if( stateUsed_scooterRemainingBattCapacity() > (9 * i))
485 TextC1[i+3] += 1;
486 }
487
488 if(stateUsed_scooterRemainingBattCapacity() < 10)
489 TextC1[2] = '\025';
490
491 if(!warning_count_high_time)
492 TextC1[4] = '2';
493
494 if(stateUsed->lifeData.scooterAgeInMilliSeconds > 1500)
495 TextC1[2] = '\031';
496
497 GFX_write_string(&Batt24,tXc1,TextC1,0);
498 }
499
500
501 void t3_refresh_customview(float depth)
502 {
503 if((t3_selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
504 t3_change_customview();
505
506 SDiveState * pDiveState;
507
508 if(stateUsed == stateRealGetPointer())
509 pDiveState = stateRealGetPointerWrite();
510 else
511 pDiveState = stateSimGetPointerWrite();
512
513 t3_basics_refresh_customview(depth, t3_selection_customview, &t3screen, &t3c1, &t3c2, pDiveState->diveSettings.diveMode);
514 }
515
516
517 void t3_basics_refresh_apnoeRight(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode)
518 {
519 char text[512];
520 uint16_t textpointer = 0;
521
522 // CVIEW_T3_Temperature
523 float temperatureThisCall;
524 float temperature;
525
526 SDivetime TotalDivetime = {0,0,0,0};
527 SDivetime LastDivetime = {0,0,0,0};
528
529 uint16_t tempWinX0;
530 uint16_t tempWinY0;
531
532 tempWinX0 = tXc1->WindowX0;
533 tempWinY0 = tXc1->WindowY0;
534
535 tXc1->WindowX0 = 440; // rechte Seite
536
537 switch(tX_selection_customview)
538 {
539 case CVIEW_T3_Temperature:
540 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature);
541 GFX_write_string(&FontT42,tXc1,text,0);
542
543 // mean value
544 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius);
545 temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f;
546 idTemperatureLastCall++;
547 if(idTemperatureLastCall >= 3)
548 idTemperatureLastCall = 0;
549 temperatureLastCall[idTemperatureLastCall] = temperatureThisCall;
550 textpointer = snprintf(text,TEXTSIZE,"\020\003\016%01.0f\016\016\140",temperature); // "\016\016%01.1f `" + C or F
551 if(settingsGetPointer()->nonMetricalSystem == 0)
552 text[textpointer++] = 'C';
553 else
554 text[textpointer++] = 'F';
555 text[textpointer++] = 0;
556 t3_basics_colorscheme_mod(text);
557 GFX_write_string(&FontT105,tXc1,text,1);
558 break;
559
560 case CVIEW_T3_ApnoeSurfaceInfo:
561 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Divetime);
562 GFX_write_string(&FontT42,tXc1,text,0);
563
564 TotalDivetime.Total = stateUsed->lifeData.dive_time_seconds_without_surface_time;
565 TotalDivetime.Minutes = TotalDivetime.Total / 60;
566 TotalDivetime.Seconds = TotalDivetime.Total - ( TotalDivetime.Minutes * 60 );
567
568 LastDivetime.Total = stateUsed->lifeData.apnea_last_dive_time_seconds;
569 LastDivetime.Minutes = LastDivetime.Total / 60;
570 LastDivetime.Seconds = LastDivetime.Total - ( LastDivetime.Minutes * 60 );
571
572 tXc1->WindowY0 = 100; // obere Zeile
573
574 snprintf(text,TEXTSIZE,"\020\016%u:%02u",LastDivetime.Minutes, LastDivetime.Seconds);
575 t3_basics_colorscheme_mod(text);
576 GFX_write_string(&FontT105,tXc1,text,0);
577
578 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaLast);
579 GFX_write_string(&FontT42,tXc1,text,0);
580
581 tXc1->WindowY0 = tempWinY0; // wieder unten
582
583 snprintf(text,TEXTSIZE,"\020\016%u:%02u",TotalDivetime.Minutes, TotalDivetime.Seconds);
584 t3_basics_colorscheme_mod(text);
585 GFX_write_string(&FontT105,tXc1,text,0);
586
587 snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaTotal);
588 GFX_write_string(&FontT42,tXc1,text,0);
589 break;
590 }
591
592 tXc1->WindowX0 = tempWinX0;
593 tXc1->WindowY0 = tempWinY0;
594
595 }
596
597
598 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode)
599 {
600 char text[512];
601 uint16_t textpointer = 0;
602
603 // CVIEW_T3_Decostop and CVIEW_T3_TTS
604 const SDecoinfo * pDecoinfo;
605 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
606 pDecoinfo = &stateUsed->decolistBuehlmann;
607 else
608 pDecoinfo = &stateUsed->decolistVPM;
609
610 // CVIEW_T3_Decostop
611 uint16_t nextstopLengthSeconds = 0;
612 uint8_t nextstopDepthMeter = 0;
613 SDivetime SafetyStopTime = {0,0,0,0};
614
615 // CVIEW_T3_ppO2andGas
616 uint8_t oxygen_percentage = 0;
617 float scooterSpeed;
618
619 // CVIEW_T3_Temperature
620 float temperatureThisCall;
621 float temperature;
622
623 // CVIEW_T3_GasList
624 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth;
625 const SGasLine * pGasLine;
626 uint8_t oxygen, helium;
627 uint8_t lineNumber;
628
629 // CVIEW_T3_StopWatch
630 SDivetime Stopwatch = {0,0,0,0};
631 float fAverageDepth, fAverageDepthAbsolute;
632
633
634 uint16_t tempWinX0;
635 uint16_t tempWinY0;
636 uint16_t tempWinC2X0;
637 uint16_t tempWinC2Tab;
638
639 tempWinX0 = tXc1->WindowX0;
640 tempWinY0 = tXc1->WindowY0;
641 tempWinC2X0 = tXc2->WindowX0;
642 tempWinC2Tab = tXc2->WindowTab;
643
644 switch(tX_selection_customview)
645 {
646 case CVIEW_Scooter:
647 snprintf(text,TEXTSIZE,"\032\fScooter");
648 GFX_write_string(&FontT42,tXc1,text,0);
649
650 t3_basics_battery_scooter_customview_extra(tXc1);
651
652 scooterSpeed = stateUsed->lifeData.scooterDrehzahl * 80 / 3300;
653
654 snprintf(text,100,"\030\003%.1f",scooterSpeed);
655 if(stateUsed->lifeData.scooterAgeInMilliSeconds > 1500)
656 text[0] = '\031';
657 GFX_write_string(&FontT105,tXc1,text,0);
658 break;
659
660
661 case CVIEW_T3_ApnoeSurfaceInfo:
662 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
663 GFX_write_string(&FontT42,tXc1,text,0);
664
665 tXc1->WindowY0 = 100; // obere Zeile
666
667 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_last_max_depth_meter));
668 t3_basics_colorscheme_mod(text);
669 GFX_write_string(&FontT105,tXc1,text,0);
670
671 tXc1->WindowY0 = tempWinY0; // wieder unten
672
673 snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_total_max_depth_meter));
674 t3_basics_colorscheme_mod(text);
675 GFX_write_string(&FontT105,tXc1,text,0);
676 break;
677
678 case CVIEW_T3_StopWatch:
679 Stopwatch.Total = timer_Stopwatch_GetTime();
680 Stopwatch.Minutes = Stopwatch.Total / 60;
681 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 );
682 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter();
683 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
684
685 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth);
686 GFX_write_string(&FontT42,tXc1,text,0);
687 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute));
688 GFX_write_string(&FontT105,tXc1,text,0);
689
690 tempWinX0 = tXc1->WindowX0;
691 tempWinY0 = tXc1->WindowY0;
692 tXc1->WindowX0 = 480;
693 // snprintf(text,TEXTSIZE,"\032\f%c%c - %c",TXT_2BYTE, TXT2BYTE_Clock, TXT_AvgDepth);
694 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch);
695 GFX_write_string(&FontT42,tXc1,text,0);
696 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth));
697 GFX_write_string(&FontT105,tXc1,text,0);
698 tXc1->WindowY0 = 100;
699 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds);
700 GFX_write_string(&FontT105,tXc1,text,0);
701 tXc1->WindowX0 = tempWinX0;
702 tXc1->WindowY0 = tempWinY0;
703 break;
704
705 case CVIEW_T3_GasList:
706 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist);
707 GFX_write_string(&FontT42,tXc1,text,0);
708
709 textpointer = 0;
710 tempWinC2X0 = tXc2->WindowX0;
711 tempWinC2Tab = tXc2->WindowTab;
712
713 tXc2->WindowX0 = 0;
714 tXc2->WindowTab = 800/2;
715
716 pGasLine = settingsGetPointer()->gas;
717 if(actualLeftMaxDepth(stateUsed))
718 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100;
719 else
720 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100;
721 fPpO2limitLow = (float)(settingsGetPointer()->ppO2_min) / 100;
722 for(int gasId=1;gasId<=NUM_GASES;gasId++)
723 {
724 textpointer = 0;
725 lineNumber = gasId;
726 if(gasId > 3)
727 {
728 text[textpointer++] = '\t';
729 lineNumber = gasId - 3;
730 }
731 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100;
732 if(pGasLine[gasId].note.ub.active == 0)
733 strcpy(&text[textpointer++],"\021");
734 else if((fPpO2ofGasAtThisDepth > fPpO2limitHigh) || (fPpO2ofGasAtThisDepth < fPpO2limitLow))
735 strcpy(&text[textpointer++],"\025");
736 else
737 strcpy(&text[textpointer++],"\030");
738
739 text[textpointer++] = ' ';
740 oxygen = pGasLine[gasId].oxygen_percentage;
741 helium = pGasLine[gasId].helium_percentage;
742 textpointer += write_gas(&text[textpointer], oxygen, helium);
743 GFX_write_string(&FontT42, tXc2, text, lineNumber);
744 }
745 break;
746
747 case CVIEW_T3_Temperature:
748 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Temperature);
749 GFX_write_string(&FontT42,tXc1,text,0);
750 // mean value
751 temperatureThisCall = unit_temperature_float(stateUsed->lifeData.temperature_celsius);
752 temperature = (temperatureThisCall + temperatureLastCall[0] + temperatureLastCall[1] + temperatureLastCall[2]) / 4.0f;
753 idTemperatureLastCall++;
754 if(idTemperatureLastCall >= 3)
755 idTemperatureLastCall = 0;
756 temperatureLastCall[idTemperatureLastCall] = temperatureThisCall;
757 textpointer = snprintf(text,TEXTSIZE,"\030\003\016%01.1f \140",temperature); // "\016\016%01.1f `" + C or F
758 if(settingsGetPointer()->nonMetricalSystem == 0)
759 text[textpointer++] = 'C';
760 else
761 text[textpointer++] = 'F';
762 text[textpointer++] = 0;
763 GFX_write_string(&FontT105,tXc1,text,0);
764 break;
765
766 case CVIEW_Compass:
767 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass);
768 GFX_write_string(&FontT42,tXc1,text,0);
769 snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading);
770 GFX_write_string(&FontT105,tXc1,text,0);
771 t3_basics_compass(tXscreen, (uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading);
772 break;
773
774 case CVIEW_T3_Decostop:
775 default:
776 // decostop
777 if(pDecoinfo->output_time_to_surface_seconds)
778 {
779 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds);
780 }
781 else
782 {
783 nextstopDepthMeter = 0;
784 nextstopLengthSeconds = 0;
785 }
786
787 SafetyStopTime.Total = timer_Safetystop_GetCountDown();
788 SafetyStopTime.Minutes = SafetyStopTime.Total / 60;
789 SafetyStopTime.Seconds = SafetyStopTime.Total - (SafetyStopTime.Minutes * 60);
790
791 if(nextstopDepthMeter)
792 {
793 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Decostop);
794 GFX_write_string(&FontT42,tXc1,text,0);
795
796 textpointer = 0;
797 snprintf(&text[textpointer],TEXTSIZE,"\020\003%u%c%c %u'"
798 , unit_depth_integer(nextstopDepthMeter)
799 , unit_depth_char1_T105()
800 , unit_depth_char2_T105()
801 , (nextstopLengthSeconds+59)/60);
802 // old without feet hw 170703 snprintf(&text[textpointer],TEXTSIZE,"\020\003%um %u'",nextstopDepthMeter,(nextstopLengthSeconds+59)/60);
803 t3_basics_colorscheme_mod(text);
804 GFX_write_string(&FontT105,tXc1,text,1);
805 }
806 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit()))
807 {
808 textpointer = 0;
809 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2);
810 GFX_write_string(&FontT42,tXc1,text,0);
811
812 textpointer = 0;
813 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds);
814 t3_basics_colorscheme_mod(text);
815 GFX_write_string(&FontT105,tXc1,text,1);
816 }
817 else // NDL
818 {
819 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit);
820 GFX_write_string(&FontT42,tXc1,text,0);
821 if(pDecoinfo->output_ndl_seconds < 1000 * 60)
822 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60);
823 else
824 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600);
825 t3_basics_colorscheme_mod(text);
826 GFX_write_string(&FontT105,tXc1,text,1);
827 }
828 break;
829
830 case CVIEW_sensors:
831 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor);
832 GFX_write_string(&FontT42,tXc1,text,0);
833
834 for(int i=0;i<3;i++)
835 {
836 textpointer = 0;
837 text[textpointer++] = '\030';
838 if(i==1)
839 text[textpointer++] = '\001';
840 else if(i==2)
841 text[textpointer++] = '\002';
842 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i))
843 {
844 text[textpointer++] = '\031';
845 text[textpointer++] = ' ';
846 text[textpointer++] = '-';
847 text[textpointer++] = ' ';
848 }
849 else
850 {
851 if(stateUsed->warnings.sensorOutOfBounds[i])
852 text[textpointer++] = '\025';
853 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.1f",stateUsed->lifeData.ppO2Sensor_bar[i]);
854 }
855 GFX_write_string(&FontT144,tXc1,text,1);
856 }
857 break;
858
859 case CVIEW_T3_MaxDepth:
860 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
861 GFX_write_string(&FontT42,tXc1,text,0);
862 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter));
863 t3_basics_colorscheme_mod(text);
864 GFX_write_string(&FontT105,tXc1,text,1);
865 break;
866
867 case CVIEW_T3_TTS:
868 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS);
869 GFX_write_string(&FontT42,tXc1,text,0);
870 if(pDecoinfo->output_time_to_surface_seconds)
871 {
872 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60)
873 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 30)/ 60);
874 else
875 snprintf(text,TEXTSIZE,"\020\003\002%ih",pDecoinfo->output_time_to_surface_seconds / 3600);
876 t3_basics_colorscheme_mod(text);
877 GFX_write_string(&FontT105,tXc1,text,1);
878 }
879 break;
880
881 case CVIEW_T3_ppO2andGas:
882 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2);
883 GFX_write_string(&FontT42,tXc1,text,0);
884 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2);
885 t3_basics_colorscheme_mod(text);
886 GFX_write_string(&FontT105,tXc1,text,1);
887
888 textpointer = 0;
889 text[textpointer++] = '\020';
890 text[textpointer++] = '\003';
891 oxygen_percentage = 100;
892 oxygen_percentage -= stateUsed->lifeData.actualGas.nitrogen_percentage;
893 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage;
894 text[textpointer++] = '\002';
895 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]);
896 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage);
897 t3_basics_colorscheme_mod(text);
898 GFX_write_string(&FontT48,tXc1,text,1);
899 break;
900 }
901 tXc1->WindowX0 = tempWinX0;
902 tXc1->WindowY0 = tempWinY0;
903 tXc2->WindowX0 = tempWinC2X0;
904 tXc2->WindowTab = tempWinC2Tab;
905 }
906
907
908 uint8_t t3_test_customview_warnings(void)
909 {
910 uint8_t count = 0;
911
912 count = 0;
913 count += stateUsed->warnings.decoMissed;
914 count += stateUsed->warnings.ppO2Low;
915 count += stateUsed->warnings.ppO2High;
916 //count += stateUsed->warnings.lowBattery;
917 count += stateUsed->warnings.sensorLinkLost;
918 count += stateUsed->warnings.fallback;
919
920 return count;
921 }
922
923 //void t3_show_customview_warnings(GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXl1, GFX_DrawCfgWindow* tXr1, uint8_t mode)
924 void t3_basics_show_customview_warnings(GFX_DrawCfgWindow* tXc1)
925 {
926 char text[256], textMain[256];
927 uint8_t textpointer, textpointerMain, lineFree, more;
928
929 snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning);
930 GFX_write_string(&FontT42,&t3c1,text,0);
931
932 lineFree = 1;
933 more = 0;
934
935 textpointerMain = 0;
936 textMain[textpointerMain++] = '\025';
937 textMain[textpointerMain++] = '\003';
938
939 textpointer = 0;
940
941 text[textpointer++] = '\021';
942 text[textpointer++] = TXT_2BYTE;
943 text[textpointer++] = TXT2BYTE_WarnDecoMissed;
944 if(stateUsed->warnings.decoMissed)
945 {
946 text[textpointer - 3] = '\025';
947 if(lineFree)
948 {
949 textMain[textpointerMain++] = TXT_2BYTE;
950 textMain[textpointerMain++] = text[textpointer - 1];
951 textMain[textpointerMain] = 0;
952 lineFree--;
953 }
954 else
955 {
956 more++;
957 }
958 }
959
960 text[textpointer++] = '\t';
961 text[textpointer++] = '\021';
962 text[textpointer++] = TXT_2BYTE;
963 text[textpointer++] = TXT2BYTE_WarnPPO2Low;
964 if(stateUsed->warnings.ppO2Low)
965 {
966 text[textpointer - 3] = '\025';
967 if(lineFree)
968 {
969 textMain[textpointerMain++] = TXT_2BYTE;
970 textMain[textpointerMain++] = text[textpointer - 1];
971 textMain[textpointerMain] = 0;
972 lineFree--;
973 }
974 else
975 {
976 more++;
977 }
978 }
979
980 text[textpointer++] = '\n';
981 text[textpointer++] = '\r';
982 text[textpointer++] = '\021';
983 text[textpointer++] = TXT_2BYTE;
984 text[textpointer++] = TXT2BYTE_WarnPPO2High;
985 if(stateUsed->warnings.ppO2High)
986 {
987 text[textpointer - 3] = '\025';
988 if(lineFree)
989 {
990 textMain[textpointerMain++] = TXT_2BYTE;
991 textMain[textpointerMain++] = text[textpointer - 1];
992 textMain[textpointerMain] = 0;
993 lineFree--;
994 }
995 else
996 {
997 more++;
998 }
999 }
1000
1001 text[textpointer++] = '\t';
1002 text[textpointer++] = '\021';
1003 text[textpointer++] = TXT_2BYTE;
1004 text[textpointer++] = TXT2BYTE_WarnFallback;
1005 if(stateUsed->warnings.fallback)
1006 {
1007 text[textpointer - 3] = '\025';
1008 if(lineFree)
1009 {
1010 textMain[textpointerMain++] = TXT_2BYTE;
1011 textMain[textpointerMain++] = text[textpointer - 1];
1012 textMain[textpointerMain] = 0;
1013 lineFree--;
1014 }
1015 else
1016 {
1017 more++;
1018 }
1019 }
1020
1021 text[textpointer++] = '\n';
1022 text[textpointer++] = '\r';
1023 text[textpointer++] = '\021';
1024 text[textpointer++] = TXT_2BYTE;
1025 text[textpointer++] = TXT2BYTE_WarnSensorLinkLost;
1026 if(stateUsed->warnings.sensorLinkLost)
1027 {
1028 text[textpointer - 3] = '\025';
1029 if(lineFree)
1030 {
1031 textMain[textpointerMain++] = TXT_2BYTE;
1032 textMain[textpointerMain++] = text[textpointer - 1];
1033 textMain[textpointerMain] = 0;
1034 lineFree--;
1035 }
1036 else
1037 {
1038 more++;
1039 }
1040 }
1041
1042 /*
1043 text[textpointer++] = '\t';
1044 text[textpointer++] = '\021';
1045 text[textpointer++] = TXT_2BYTE;
1046 text[textpointer++] = TXT2BYTE_WarnBatteryLow;
1047 if(stateUsed->warnings.lowBattery)
1048 {
1049 text[textpointer - 3] = '\025';
1050 if(lineFree)
1051 {
1052 textMain[textpointerMain++] = TXT_2BYTE;
1053 textMain[textpointerMain++] = text[textpointer - 1];
1054 textMain[textpointerMain] = 0;
1055 lineFree--;
1056 }
1057 else
1058 {
1059 more++;
1060 }
1061 }
1062 */
1063 text[textpointer] = 0;
1064 /*
1065 if(more)
1066 {
1067 text[textpointer++] = '\002';
1068 text[textpointer++] = '+';
1069 if(more < 10)
1070 text[textpointer++] = '0' + more;
1071 else
1072 text[textpointer++] = 'X';
1073 text[textpointer] = 0;
1074 }
1075 */
1076 GFX_write_string(&FontT48,&t3c1,textMain,1);
1077 if(more)
1078 {
1079 GFX_write_string(&FontT48,&t3c2,text,1);
1080 }
1081 }
1082
1083
1084 void t3_change_customview(void)
1085 {
1086 t3_basics_change_customview(&t3_selection_customview, t3_customviews);
1087 }
1088
1089
1090 void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews)
1091 {
1092 const SDecoinfo * pDecoinfo;
1093 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
1094 pDecoinfo = &stateUsed->decolistBuehlmann;
1095 else
1096 pDecoinfo = &stateUsed->decolistVPM;
1097
1098 const uint8_t *pViews;
1099 pViews = tX_customviews;
1100
1101 while((*pViews != CVIEW_T3_END) && (*pViews != *tX_selection_customview))
1102 {pViews++;}
1103
1104 if(*pViews < CVIEW_T3_END)
1105 pViews++;
1106
1107 if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds)
1108 pViews++;
1109
1110 if(*pViews == CVIEW_T3_END)
1111 {
1112 *tX_selection_customview = tX_customviews[0];
1113 }
1114 else
1115 *tX_selection_customview = *pViews;
1116 }
1117
1118
1119 void t3_basics_colorscheme_mod(char *text)
1120 {
1121 if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard())
1122 {
1123 text[0] = '\027';
1124 }
1125 }
1126
1127
1128 point_t t3_compass_circle(uint8_t id, uint16_t degree)
1129 {
1130 float fCos, fSin;
1131 const float piMult = ((2 * 3.14159) / 360);
1132 // const int radius[4] = {95,105,115,60};
1133 const int radius[4] = {85,95,105,90};
1134 const point_t offset = {.x = 600, .y = 116};
1135
1136 static point_t r[4][360] = { 0 };
1137
1138 if(r[0][0].y == 0)
1139 {
1140 for(int i=0;i<360;i++)
1141 {
1142 fCos = cos(i * piMult);
1143 fSin = sin(i * piMult);
1144 for(int j=0;j<4;j++)
1145 {
1146 r[j][i].x = offset.x + (int)(fSin * radius[j]);
1147 r[j][i].y = offset.y + (int)(fCos * radius[j]);
1148 }
1149 }
1150 }
1151 if(id > 3) id = 0;
1152 if(degree > 359) degree = 0;
1153 return r[id][degree];
1154 }
1155
1156
1157 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, uint16_t ActualHeading, uint16_t UserSetHeading)
1158 {
1159 uint16_t LineHeading;
1160 point_t center;
1161 static int32_t LastHeading = 0;
1162 int32_t newHeading = 0;
1163 int32_t diff = 0;
1164 int32_t diff2 = 0;
1165
1166 int32_t diffAbs = 0;
1167 int32_t diffAbs2 = 0;
1168
1169 newHeading = ActualHeading;
1170
1171 diff = newHeading - LastHeading;
1172
1173 if(newHeading < LastHeading)
1174 diff2 = newHeading + 360 - LastHeading;
1175 else
1176 diff2 = newHeading - 360 - LastHeading;
1177
1178 diffAbs = diff;
1179 if(diffAbs < 0)
1180 diffAbs *= -1;
1181
1182 diffAbs2 = diff2;
1183 if(diffAbs2 < 0)
1184 diffAbs2 *= -1;
1185
1186 if(diffAbs <= diffAbs2)
1187 newHeading = LastHeading + (diff / 2);
1188 else
1189 newHeading = LastHeading + (diff2 / 2);
1190
1191 if(newHeading < 0)
1192 newHeading += 360;
1193 else
1194 if(newHeading >= 360)
1195 newHeading -= 360;
1196
1197 LastHeading = newHeading;
1198 ActualHeading = newHeading;
1199
1200 if (ActualHeading < 90)
1201 ActualHeading += 360;
1202
1203 while(ActualHeading > 359) ActualHeading -= 360;
1204
1205 LineHeading = 360 - ActualHeading;
1206 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font030); // North
1207 LineHeading += 90;
1208 if(LineHeading > 359) LineHeading -= 360;
1209 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Maintick
1210 LineHeading += 90;
1211 if(LineHeading > 359) LineHeading -= 360;
1212 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1213 LineHeading += 90;
1214 if(LineHeading > 359) LineHeading -= 360;
1215 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1216
1217 LineHeading = 360 - ActualHeading;
1218 LineHeading += 45;
1219 if(LineHeading > 359) LineHeading -= 360;
1220 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
1221 LineHeading += 90;
1222 if(LineHeading > 359) LineHeading -= 360;
1223 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1224 LineHeading += 90;
1225 if(LineHeading > 359) LineHeading -= 360;
1226 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1227 LineHeading += 90;
1228 if(LineHeading > 359) LineHeading -= 360;
1229 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1230
1231 LineHeading = 360 - ActualHeading;
1232 LineHeading += 22;
1233 if(LineHeading > 359) LineHeading -= 360;
1234 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
1235 LineHeading += 45;
1236 if(LineHeading > 359) LineHeading -= 360;
1237 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1238 LineHeading += 45;
1239 if(LineHeading > 359) LineHeading -= 360;
1240 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1241 LineHeading += 45;
1242 if(LineHeading > 359) LineHeading -= 360;
1243 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1244 LineHeading += 45;
1245 if(LineHeading > 359) LineHeading -= 360;
1246 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
1247 LineHeading += 45;
1248 if(LineHeading > 359) LineHeading -= 360;
1249 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1250 LineHeading += 45;
1251 if(LineHeading > 359) LineHeading -= 360;
1252 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1253 LineHeading += 45;
1254 if(LineHeading > 359) LineHeading -= 360;
1255 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1256
1257 if(UserSetHeading)
1258 {
1259 LineHeading = UserSetHeading + 360 - ActualHeading;
1260 if(LineHeading > 359) LineHeading -= 360;
1261 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading), t3_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick);
1262
1263 // R�ckpeilung, User Back Heading
1264 LineHeading = UserSetHeading + 360 + 180 - ActualHeading;
1265 if(LineHeading > 359) LineHeading -= 360;
1266 if(LineHeading > 359) LineHeading -= 360;
1267 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading), t3_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick);
1268 }
1269
1270 center.x = 600;
1271 center.y = 116;
1272 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030);
1273 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030);
1274 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030);
1275 }