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