Mercurial > public > ostc4
annotate Discovery/Src/tHome.c @ 614:7d6a51bb21d1
Added "Set Marker" to T3 quick menu:
It is now possible to set a marker while in T?_Profile view using the quick menu access. Because the the string, which is used in the dive menu, is to long, a shorter string had to be added.
author | Ideenmodellierer |
---|---|
date | Wed, 20 Jan 2021 20:05:05 +0100 |
parents | beeb23d18443 |
children | 8fa2de4414a8 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tHome.c | |
5 /// \brief Control for Surface and Dive Templates | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 10-November-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 "tHome.h" | |
31 | |
32 #include "data_exchange_main.h" // for dataOutGetPointer() | |
33 #include "gfx_fonts.h" | |
34 #include "t3.h" | |
35 #include "t4_tetris.h" | |
36 #include "t5_gauge.h" | |
37 #include "t6_apnea.h" | |
38 #include "t7.h" | |
39 #include "tDebug.h" | |
40 #include "timer.h" // for timer_Stopwatch_Restart | |
41 #include "tMenu.h" | |
42 #include "tMenuEditGasOC.h" // for openEdit_DiveSelectBetterGas() | |
43 #include "tMenuEditSetpoint.h" // for openEdit_DiveSelectBetterSetpoint() | |
44 #include "simulation.h" | |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
45 #include "motion.h" |
38 | 46 |
47 /* Private types -------------------------------------------------------------*/ | |
48 | |
49 /* Exported variables --------------------------------------------------------*/ | |
50 _Bool warning_count_high_time = 0; | |
51 _Bool display_count_high_time = 0; | |
52 | |
53 uint8_t errorsInSettings = 0; | |
54 /* Private variables ---------------------------------------------------------*/ | |
55 static uint8_t warning_toogle_count; | |
56 static uint16_t display_toogle_count; | |
57 static uint16_t tHome_tick_count_cview; | |
58 static uint16_t tHome_tick_count_field; | |
576 | 59 static uint16_t tHome_tick_count_o2sens; |
38 | 60 |
379 | 61 const uint8_t cv_changelist[] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist, CVIEW_noneOrDebug, CVIEW_Decolist,CVIEW_sensors,CVIEW_sensors_mV, CVIEW_END}; |
594
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
62 const uint8_t cv_changelist_BS[] = {CVIEW_T3_Decostop, CVIEW_sensors, CVIEW_Compass, CVIEW_T3_MaxDepth,CVIEW_T3_StopWatch, CVIEW_T3_TTS, CVIEW_T3_GasList, CVIEW_T3_ppO2andGas, CVIEW_noneOrDebug, |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
63 CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_DecoTTS, |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
64 #ifdef ENABLE_T3_PROFILE_VIEW |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
65 CVIEW_T3_Profile, |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
66 #endif |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
67 CVIEW_T3_END}; |
38 | 68 |
69 /* Private function prototypes -----------------------------------------------*/ | |
70 | |
576 | 71 #define AUTORETURN_O2SENS (200u) /* return to sensor view after 20 seconds in case sensor is connected */ |
72 | |
73 | |
38 | 74 /* Exported functions --------------------------------------------------------*/ |
75 | |
76 void set_globalState_tHome(void) | |
77 { | |
78 if(stateUsed->mode == MODE_DIVE) | |
79 set_globalState(StD); | |
80 else | |
81 set_globalState(StS); | |
82 } | |
83 | |
84 | |
85 void tHome_init(void) | |
86 { | |
87 t7_init(); // standard + surface | |
88 t3_init(); // big font | |
89 t4_init(); // game | |
90 t5_init(); // gauge | |
91 t6_init(); // apnea | |
92 } | |
93 | |
94 | |
95 void tHome_init_compass(void) | |
96 { | |
97 init_t7_compass(); | |
98 } | |
99 | |
100 | |
101 void tHome_refresh(void) | |
102 { | |
103 SSettings* pSettings = settingsGetPointer(); | |
104 | |
105 warning_toogle_count++; | |
106 if(warning_toogle_count >= 2* pSettings->warning_blink_dsec) | |
107 warning_toogle_count = 0; | |
108 | |
109 if(warning_toogle_count >= pSettings->warning_blink_dsec) | |
110 warning_count_high_time = 1; | |
111 else | |
112 warning_count_high_time = 0; | |
113 | |
114 | |
115 display_toogle_count++; | |
116 if(display_toogle_count >= 2* pSettings->display_toogle_desc) | |
117 display_toogle_count = 0; | |
118 | |
119 if(display_toogle_count >= pSettings->display_toogle_desc) | |
120 display_count_high_time = 1; | |
121 else | |
122 display_count_high_time = 0; | |
123 | |
124 | |
125 if(pSettings->design == 6) | |
126 t6_refresh(); | |
127 else | |
128 if(pSettings->design == 5) | |
129 t5_refresh(); | |
130 else | |
131 if(pSettings->design == 4) | |
132 t4_refresh(); | |
133 else | |
134 if(pSettings->design == 3) | |
135 t3_refresh(); | |
136 else | |
137 if(pSettings->design == 7) | |
138 t7_refresh(); | |
139 else | |
140 { | |
141 pSettings->design = 7; | |
142 t7_refresh(); | |
143 } | |
144 } | |
145 | |
146 | |
147 void tHome_sleepmode_fun(void) | |
148 { | |
149 t7_refresh_sleepmode_fun(); | |
150 } | |
151 | |
152 | |
153 void tHomeDiveMenuControl(uint8_t sendAction) | |
154 { | |
155 if(sendAction == ACTION_BUTTON_NEXT) | |
156 { | |
157 if(settingsGetPointer()->design == 4) | |
158 return; | |
159 | |
160 switch(get_globalState()) | |
161 { | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
162 case StD: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
163 if(settingsGetPointer()->design == 6) |
38 | 164 { |
165 if(is_stateUsedSetToSim()) | |
166 set_globalState(StDSIM1); | |
167 else | |
168 set_globalState(StDQUIT); | |
169 break; | |
170 } | |
171 | |
172 if(settingsGetPointer()->design == 5) | |
173 { | |
174 if(t5_getCustomView() == CVIEW_Compass) | |
175 set_globalState(StDBEAR); | |
176 else | |
177 set_globalState(StDRAVG); | |
178 break; | |
179 } | |
180 | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
181 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
182 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
183 switch(t3_getCustomView()) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
184 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
185 case CVIEW_T3_Navigation: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
186 case CVIEW_Compass: set_globalState(StDBEAR); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
187 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
188 case CVIEW_T3_StopWatch: set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
189 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
190 case CVIEW_T3_GasList: if(stateUsed->warnings.betterGas) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
191 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
192 set_globalState(StDMGAS); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
193 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
194 break; |
613 | 195 case CVIEW_T3_Profile: set_globalState(StDMARK); |
196 break; | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
197 default: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
198 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
199 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
200 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
201 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
202 |
38 | 203 if(stateUsed->warnings.betterGas) |
204 set_globalState(StDMGAS); | |
205 else | |
206 if(stateUsed->warnings.betterSetpoint) | |
207 set_globalState(StDMSPT); | |
208 else | |
209 set_globalState(StDMENU); | |
210 break; | |
211 | |
212 case StDMGAS: | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
213 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
214 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
215 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
216 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
217 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
218 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
219 if(stateUsed->warnings.betterSetpoint) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
220 set_globalState(StDMSPT); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
221 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
222 set_globalState(StDMENU); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
223 } |
38 | 224 break; |
225 | |
226 case StDMSPT: | |
227 set_globalState(StDMENU); | |
228 break; | |
229 | |
230 case StDMENU: | |
231 if(is_stateUsedSetToSim()) | |
232 set_globalState(StDSIM1); | |
233 else | |
234 set_globalState(StD); | |
235 break; | |
236 | |
237 case StDSIM1: | |
238 set_globalState(StDSIM2); | |
239 break; | |
240 | |
241 case StDSIM2: | |
242 set_globalState(StDSIM3); | |
243 break; | |
244 | |
245 case StDSIM3: | |
246 set_globalState(StDSIM4); | |
247 break; | |
248 | |
249 case StDSIM4: | |
250 set_globalState(StD); | |
251 break; | |
252 | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
253 case StDBEAR: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
254 if(settingsGetPointer()->design == 5) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
255 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
256 set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
257 } |
38 | 258 |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
259 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
260 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
261 if(t3_getCustomView() == CVIEW_T3_Navigation) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
262 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
263 set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
264 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
265 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
266 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
267 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
268 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
269 } |
38 | 270 break; |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
271 case StDRAVG: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
272 if(settingsGetPointer()->design == 5) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
273 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
274 if(is_stateUsedSetToSim()) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
275 set_globalState(StDSIM1); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
276 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
277 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
278 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
279 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
280 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
281 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
282 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
283 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
284 break; |
38 | 285 case StDQUIT: // t6_apnea |
286 set_globalState(StD); | |
287 break; | |
288 | |
289 default: | |
290 set_globalState(StD); | |
291 } | |
292 } | |
293 | |
294 if(sendAction == ACTION_BUTTON_ENTER) | |
295 { | |
296 if(settingsGetPointer()->design == 4) | |
297 return; | |
298 | |
299 switch(get_globalState()) | |
300 { | |
301 case StDMGAS: | |
302 openEdit_DiveSelectBetterGas(); | |
303 set_globalState(StD); | |
304 break; | |
305 case StDMSPT: | |
306 openEdit_DiveSelectBetterSetpoint(); | |
307 set_globalState(StD); | |
308 break; | |
309 | |
310 case StDMENU: | |
311 openMenu_first_page_with_OC_gas_update(); | |
312 break; | |
313 | |
314 case StDSIM1: | |
315 Sim_Quit(); | |
316 break; | |
317 | |
318 case StDSIM2: | |
319 Sim_Ascend(); | |
320 break; | |
321 | |
322 case StDSIM3: | |
323 Sim_Descend(); | |
324 break; | |
325 | |
326 case StDSIM4: | |
327 Sim_Divetime(); | |
328 break; | |
329 | |
330 case StDBEAR: // t5_gauge | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
331 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; |
38 | 332 set_globalState(StD); |
333 break; | |
334 | |
335 case StDRAVG: // t5_gauge | |
336 timer_Stopwatch_Restart(); | |
337 set_globalState(StD); | |
338 break; | |
339 | |
340 case StDQUIT: // t6_apnea | |
341 set_globalState(StD); // used to end StDQUIT, is called before everything else because changes are made in the next lines | |
342 if(is_stateUsedSetToSim()) | |
343 Sim_Quit(); | |
344 else | |
345 dataOutGetPointer()->setEndDive = 1; | |
346 break; | |
613 | 347 case StDMARK: stateUsedWrite->events.manualMarker = 1; |
348 set_globalState(StD); | |
349 break; | |
38 | 350 |
351 default: | |
352 break; | |
353 } | |
354 } | |
355 } | |
356 | |
357 | |
358 void tHome_findNextStop(const uint16_t *list, uint8_t *depthOutMeter, uint16_t *lengthOutSeconds) | |
359 { | |
360 uint8_t ptr = DECOINFO_STRUCT_MAX_STOPS - 1; | |
361 | |
362 while(ptr && !list[ptr]) | |
363 ptr--; | |
364 | |
365 *lengthOutSeconds = list[ptr]; | |
366 if(!(*lengthOutSeconds)) | |
367 { | |
368 *depthOutMeter = 0; | |
369 } | |
370 else | |
371 if(ptr == 0) | |
372 { | |
373 *depthOutMeter = (uint8_t)((stateUsed->diveSettings.last_stop_depth_bar*10.0f) + 0.1f); | |
374 } | |
375 else | |
376 { | |
377 ptr -= 1; | |
378 *depthOutMeter = (uint8_t)(((stateUsed->diveSettings.input_second_to_last_stop_depth_bar + (stateUsed->diveSettings.input_next_stop_increment_depth_bar * ptr))*10.0f) + 0.1f); | |
379 } | |
380 } | |
381 | |
382 | |
383 void tHome_change_field_button_pressed(void) | |
384 { | |
385 tHome_tick_count_field = 0; | |
576 | 386 tHome_tick_count_o2sens = 0; |
38 | 387 if(settingsGetPointer()->design == 7) |
388 t7_change_field(); | |
389 } | |
390 | |
391 | |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
392 void tHome_change_customview_button_pressed(uint8_t action) |
38 | 393 { |
394 tHome_tick_count_cview = 0; | |
576 | 395 tHome_tick_count_o2sens = 0; |
396 | |
38 | 397 if(settingsGetPointer()->design == 7) |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
398 t7_change_customview(action); |
38 | 399 else |
400 if(settingsGetPointer()->design == 3) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
401 t3_change_customview(action); |
38 | 402 else |
403 if(settingsGetPointer()->design == 5) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
404 t5_change_customview(action); |
38 | 405 else |
406 if(settingsGetPointer()->design == 6) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
407 t6_change_customview(action); |
38 | 408 } |
409 | |
505 | 410 uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list) |
411 { | |
412 uint8_t cnt = 0; | |
413 | |
414 while((pcv_list[cnt] != CVIEW_END) && (pcv_list[cnt] != CVIEW_T3_END)) | |
415 { | |
416 cnt++; | |
417 if (cnt > 100) /* just in case an invalid list has been provided... */ | |
418 { | |
419 break; | |
420 } | |
421 } | |
422 cnt--; /* do not count end token */ | |
423 return cnt; | |
424 } | |
38 | 425 |
426 void tHome_tick(void) | |
427 { | |
428 uint16_t field = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; | |
429 uint16_t cview = settingsGetPointer()->tX_customViewTimeout; | |
430 | |
431 if(field) | |
432 { | |
433 tHome_tick_count_field++; | |
434 if(tHome_tick_count_field > (field * 10)) | |
435 { | |
436 tHome_tick_count_field = 0; | |
437 if(settingsGetPointer()->design == 7) | |
438 { | |
439 t7_set_field_to_primary(); | |
440 } | |
441 } | |
442 } | |
443 | |
444 if(cview) | |
445 { | |
446 tHome_tick_count_cview++; | |
447 if(tHome_tick_count_cview > (cview *10)) | |
448 { | |
449 tHome_tick_count_cview = 0; | |
450 if(settingsGetPointer()->design == 7) | |
451 { | |
452 t7_set_customview_to_primary(); | |
453 } | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
454 if(settingsGetPointer()->design == 3) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
455 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
456 t3_set_customview_to_primary(); |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
457 } |
38 | 458 } |
459 } | |
576 | 460 |
461 if((stateUsed->mode == MODE_SURFACE) && (stateUsed->diveSettings.ppo2sensors_deactivated != 0x07) && (stateUsed->diveSettings.ccrOption != 0)) | |
462 { | |
463 tHome_tick_count_o2sens++; | |
464 if(tHome_tick_count_o2sens > AUTORETURN_O2SENS) | |
465 { | |
466 tHome_tick_count_o2sens = 0; | |
467 t7_select_customview(CVIEW_sensors); | |
468 } | |
469 } | |
38 | 470 } |
471 | |
472 | |
473 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput) | |
474 { | |
475 uint32_t answer = 0; | |
476 | |
477 answer = 0; | |
478 answer += (dateInput->Year & 0x7F)<< 9; | |
479 answer += (dateInput->Month & 0x0F)<< 5; | |
480 answer += (dateInput->Date & 0x1F); | |
481 | |
482 return answer; | |
483 } | |
484 | |
485 | |
486 uint8_t tHome_gas_writer(uint8_t oxygen_percentage, uint8_t helium_percentage, char *text) | |
487 { | |
488 if(oxygen_percentage == 100) | |
489 return (uint8_t) snprintf(text,10,"Oxy"); | |
490 else if((oxygen_percentage == 21) && (!helium_percentage)) | |
491 return (uint8_t) snprintf(text,10,"Air"); | |
492 else if(!helium_percentage) | |
493 return (uint8_t) snprintf(text,10,"NX%02i",oxygen_percentage); | |
494 else if((oxygen_percentage + helium_percentage) == 100) | |
495 return (uint8_t) snprintf(text,10,"HX%02i",oxygen_percentage); | |
496 else | |
497 return (uint8_t) snprintf(text,10,"%02i/%02i",oxygen_percentage,helium_percentage); | |
498 } | |
499 | |
500 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn) | |
501 { | |
208 | 502 static uint8_t LastKnowRTEState = SPI_RX_STATE_INVALID; |
503 | |
99 | 504 if(!SPI_MIN_ERROR_SHOW) return 0; |
172
c659fda83e44
Minor: Button defaults, release date adjusted, use SPI_SHOW_SYNC_STATS
heinrichsweikamp
parents:
138
diff
changeset
|
505 if(DataEX_lost_connection_count()>=SPI_MIN_ERROR_SHOW && SPI_SHOW_SYNC_STATS){ |
38 | 506 |
99 | 507 char text[64]; |
38 | 508 |
82 | 509 SDataExchangeSlaveToMaster* dataIn=get_dataInPointer(); |
208 | 510 SDataReceiveFromMaster* pDataOut = dataOutGetPointer(); |
82 | 511 |
493
b560e474e319
Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents:
386
diff
changeset
|
512 snprintf(text,32,"spi err:\002 %ld/%ld",DataEX_lost_connection_count(),get_num_SPI_CALLBACKS()); |
99 | 513 Gfx_write_label_var(ScreenToWriteOn, 100,300, 0,&FontT24,CLUT_ButtonSymbols,text); |
82 | 514 |
104 | 515 // snprintf(text,32,"header:\002%X%X%X%X",dataIn->header.checkCode[0],dataIn->header.checkCode[1],dataIn->header.checkCode[2],dataIn->header.checkCode[3]); |
516 // Gfx_write_label_var(ScreenToWriteOn, 350,550, 0,&FontT24,CLUT_ButtonSymbols,text); | |
82 | 517 |
208 | 518 //snprintf(text,32,"footer:\002%X%X%X%X",dataIn->footer.checkCode[0],dataIn->footer.checkCode[1],dataIn->footer.checkCode[2],dataIn->footer.checkCode[3]); |
519 | |
520 /* data shifted => ignore received data */ | |
521 if((pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE] == SPI_RX_STATE_SHIFTED) || (pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE] == SPI_RX_STATE_OFFLINE)) | |
522 { | |
523 dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] = LastKnowRTEState; | |
524 } | |
525 else | |
526 { | |
527 LastKnowRTEState =dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE]; | |
528 } | |
529 snprintf(text,32,"RX State M|R:\002%X|%X",pDataOut->header.checkCode[SPI_HEADER_INDEX_RX_STATE], dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] ); | |
99 | 530 Gfx_write_label_var(ScreenToWriteOn, 600,800, 0,&FontT24,CLUT_ButtonSymbols,text); |
531 } | |
82 | 532 |
99 | 533 |
534 | |
535 // snprintf(text,32,"cpt:\002%i",get_num_SPI_CALLBACKS()); | |
536 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
82 | 537 |
538 // snprintf(text,10,"i2c:\002%i",get_DataEX_Error_place()); | |
539 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
38 | 540 |
541 return DataEX_lost_connection_count(); | |
542 } |