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