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