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