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