Mercurial > public > ostc4
annotate Discovery/Src/tHome.c @ 543:bce852cc3b91
Shortend t3 view names:
Some german strings did not fit into the line in the selection dialog => shortend string
author | Ideenmodellierer |
---|---|
date | Sun, 11 Oct 2020 18:33:19 +0200 |
parents | 6960df7ddb09 |
children | 1105cf7bbf6f |
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; | |
59 | |
379 | 60 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}; |
542
6960df7ddb09
Added new t3 view showing first deco stop and tts in parallel:
Ideenmodellierer
parents:
541
diff
changeset
|
61 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, CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_DecoTTS, CVIEW_T3_END}; |
38 | 62 |
63 /* Private function prototypes -----------------------------------------------*/ | |
64 | |
65 /* Exported functions --------------------------------------------------------*/ | |
66 | |
67 void set_globalState_tHome(void) | |
68 { | |
69 if(stateUsed->mode == MODE_DIVE) | |
70 set_globalState(StD); | |
71 else | |
72 set_globalState(StS); | |
73 } | |
74 | |
75 | |
76 void tHome_init(void) | |
77 { | |
78 t7_init(); // standard + surface | |
79 t3_init(); // big font | |
80 t4_init(); // game | |
81 t5_init(); // gauge | |
82 t6_init(); // apnea | |
83 } | |
84 | |
85 | |
86 void tHome_init_compass(void) | |
87 { | |
88 init_t7_compass(); | |
89 } | |
90 | |
91 | |
92 void tHome_refresh(void) | |
93 { | |
94 SSettings* pSettings = settingsGetPointer(); | |
95 | |
96 warning_toogle_count++; | |
97 if(warning_toogle_count >= 2* pSettings->warning_blink_dsec) | |
98 warning_toogle_count = 0; | |
99 | |
100 if(warning_toogle_count >= pSettings->warning_blink_dsec) | |
101 warning_count_high_time = 1; | |
102 else | |
103 warning_count_high_time = 0; | |
104 | |
105 | |
106 display_toogle_count++; | |
107 if(display_toogle_count >= 2* pSettings->display_toogle_desc) | |
108 display_toogle_count = 0; | |
109 | |
110 if(display_toogle_count >= pSettings->display_toogle_desc) | |
111 display_count_high_time = 1; | |
112 else | |
113 display_count_high_time = 0; | |
114 | |
115 | |
116 if(pSettings->design == 6) | |
117 t6_refresh(); | |
118 else | |
119 if(pSettings->design == 5) | |
120 t5_refresh(); | |
121 else | |
122 if(pSettings->design == 4) | |
123 t4_refresh(); | |
124 else | |
125 if(pSettings->design == 3) | |
126 t3_refresh(); | |
127 else | |
128 if(pSettings->design == 7) | |
129 t7_refresh(); | |
130 else | |
131 { | |
132 pSettings->design = 7; | |
133 t7_refresh(); | |
134 } | |
135 } | |
136 | |
137 | |
138 void tHome_sleepmode_fun(void) | |
139 { | |
140 t7_refresh_sleepmode_fun(); | |
141 } | |
142 | |
143 | |
144 void tHomeDiveMenuControl(uint8_t sendAction) | |
145 { | |
146 if(sendAction == ACTION_BUTTON_NEXT) | |
147 { | |
148 if(settingsGetPointer()->design == 4) | |
149 return; | |
150 | |
151 switch(get_globalState()) | |
152 { | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
153 case StD: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
154 if(settingsGetPointer()->design == 6) |
38 | 155 { |
156 if(is_stateUsedSetToSim()) | |
157 set_globalState(StDSIM1); | |
158 else | |
159 set_globalState(StDQUIT); | |
160 break; | |
161 } | |
162 | |
163 if(settingsGetPointer()->design == 5) | |
164 { | |
165 if(t5_getCustomView() == CVIEW_Compass) | |
166 set_globalState(StDBEAR); | |
167 else | |
168 set_globalState(StDRAVG); | |
169 break; | |
170 } | |
171 | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
172 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
173 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
174 switch(t3_getCustomView()) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
175 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
176 case CVIEW_T3_Navigation: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
177 case CVIEW_Compass: set_globalState(StDBEAR); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
178 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
179 case CVIEW_T3_StopWatch: set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
180 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
181 case CVIEW_T3_GasList: if(stateUsed->warnings.betterGas) |
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 set_globalState(StDMGAS); |
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 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
186 default: |
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 } |
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 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
191 |
38 | 192 if(stateUsed->warnings.betterGas) |
193 set_globalState(StDMGAS); | |
194 else | |
195 if(stateUsed->warnings.betterSetpoint) | |
196 set_globalState(StDMSPT); | |
197 else | |
198 set_globalState(StDMENU); | |
199 break; | |
200 | |
201 case StDMGAS: | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
202 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
203 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
204 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
205 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
206 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
207 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
208 if(stateUsed->warnings.betterSetpoint) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
209 set_globalState(StDMSPT); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
210 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
211 set_globalState(StDMENU); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
212 } |
38 | 213 break; |
214 | |
215 case StDMSPT: | |
216 set_globalState(StDMENU); | |
217 break; | |
218 | |
219 case StDMENU: | |
220 if(is_stateUsedSetToSim()) | |
221 set_globalState(StDSIM1); | |
222 else | |
223 set_globalState(StD); | |
224 break; | |
225 | |
226 case StDSIM1: | |
227 set_globalState(StDSIM2); | |
228 break; | |
229 | |
230 case StDSIM2: | |
231 set_globalState(StDSIM3); | |
232 break; | |
233 | |
234 case StDSIM3: | |
235 set_globalState(StDSIM4); | |
236 break; | |
237 | |
238 case StDSIM4: | |
239 set_globalState(StD); | |
240 break; | |
241 | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
242 case StDBEAR: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
243 if(settingsGetPointer()->design == 5) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
244 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
245 set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
246 } |
38 | 247 |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
248 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
249 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
250 if(t3_getCustomView() == CVIEW_T3_Navigation) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
251 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
252 set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
253 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
254 else |
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(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
257 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
258 } |
38 | 259 break; |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
260 case StDRAVG: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
261 if(settingsGetPointer()->design == 5) |
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 if(is_stateUsedSetToSim()) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
264 set_globalState(StDSIM1); |
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 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
267 break; |
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 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
270 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
271 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
272 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
273 break; |
38 | 274 case StDQUIT: // t6_apnea |
275 set_globalState(StD); | |
276 break; | |
277 | |
278 default: | |
279 set_globalState(StD); | |
280 } | |
281 } | |
282 | |
283 if(sendAction == ACTION_BUTTON_ENTER) | |
284 { | |
285 if(settingsGetPointer()->design == 4) | |
286 return; | |
287 | |
288 switch(get_globalState()) | |
289 { | |
290 case StDMGAS: | |
291 openEdit_DiveSelectBetterGas(); | |
292 set_globalState(StD); | |
293 break; | |
294 case StDMSPT: | |
295 openEdit_DiveSelectBetterSetpoint(); | |
296 set_globalState(StD); | |
297 break; | |
298 | |
299 case StDMENU: | |
300 openMenu_first_page_with_OC_gas_update(); | |
301 break; | |
302 | |
303 case StDSIM1: | |
304 Sim_Quit(); | |
305 break; | |
306 | |
307 case StDSIM2: | |
308 Sim_Ascend(); | |
309 break; | |
310 | |
311 case StDSIM3: | |
312 Sim_Descend(); | |
313 break; | |
314 | |
315 case StDSIM4: | |
316 Sim_Divetime(); | |
317 break; | |
318 | |
319 case StDBEAR: // t5_gauge | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
320 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; |
38 | 321 set_globalState(StD); |
322 break; | |
323 | |
324 case StDRAVG: // t5_gauge | |
325 timer_Stopwatch_Restart(); | |
326 set_globalState(StD); | |
327 break; | |
328 | |
329 case StDQUIT: // t6_apnea | |
330 set_globalState(StD); // used to end StDQUIT, is called before everything else because changes are made in the next lines | |
331 if(is_stateUsedSetToSim()) | |
332 Sim_Quit(); | |
333 else | |
334 dataOutGetPointer()->setEndDive = 1; | |
335 break; | |
336 | |
337 default: | |
338 break; | |
339 } | |
340 } | |
341 } | |
342 | |
343 | |
344 void tHome_findNextStop(const uint16_t *list, uint8_t *depthOutMeter, uint16_t *lengthOutSeconds) | |
345 { | |
346 uint8_t ptr = DECOINFO_STRUCT_MAX_STOPS - 1; | |
347 | |
348 while(ptr && !list[ptr]) | |
349 ptr--; | |
350 | |
351 *lengthOutSeconds = list[ptr]; | |
352 if(!(*lengthOutSeconds)) | |
353 { | |
354 *depthOutMeter = 0; | |
355 } | |
356 else | |
357 if(ptr == 0) | |
358 { | |
359 *depthOutMeter = (uint8_t)((stateUsed->diveSettings.last_stop_depth_bar*10.0f) + 0.1f); | |
360 } | |
361 else | |
362 { | |
363 ptr -= 1; | |
364 *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); | |
365 } | |
366 } | |
367 | |
368 | |
369 void tHome_change_field_button_pressed(void) | |
370 { | |
371 tHome_tick_count_field = 0; | |
372 if(settingsGetPointer()->design == 7) | |
373 t7_change_field(); | |
374 } | |
375 | |
376 | |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
377 void tHome_change_customview_button_pressed(uint8_t action) |
38 | 378 { |
379 tHome_tick_count_cview = 0; | |
380 if(settingsGetPointer()->design == 7) | |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
381 t7_change_customview(action); |
38 | 382 else |
383 if(settingsGetPointer()->design == 3) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
384 t3_change_customview(action); |
38 | 385 else |
386 if(settingsGetPointer()->design == 5) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
387 t5_change_customview(action); |
38 | 388 else |
389 if(settingsGetPointer()->design == 6) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
390 t6_change_customview(action); |
38 | 391 } |
392 | |
505 | 393 uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list) |
394 { | |
395 uint8_t cnt = 0; | |
396 | |
397 while((pcv_list[cnt] != CVIEW_END) && (pcv_list[cnt] != CVIEW_T3_END)) | |
398 { | |
399 cnt++; | |
400 if (cnt > 100) /* just in case an invalid list has been provided... */ | |
401 { | |
402 break; | |
403 } | |
404 } | |
405 cnt--; /* do not count end token */ | |
406 return cnt; | |
407 } | |
38 | 408 |
409 void tHome_tick(void) | |
410 { | |
411 uint16_t field = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; | |
412 uint16_t cview = settingsGetPointer()->tX_customViewTimeout; | |
413 | |
414 if(field) | |
415 { | |
416 tHome_tick_count_field++; | |
417 if(tHome_tick_count_field > (field * 10)) | |
418 { | |
419 tHome_tick_count_field = 0; | |
420 if(settingsGetPointer()->design == 7) | |
421 { | |
422 t7_set_field_to_primary(); | |
423 } | |
424 } | |
425 } | |
426 | |
427 if(cview) | |
428 { | |
429 tHome_tick_count_cview++; | |
430 if(tHome_tick_count_cview > (cview *10)) | |
431 { | |
432 tHome_tick_count_cview = 0; | |
433 if(settingsGetPointer()->design == 7) | |
434 { | |
435 t7_set_customview_to_primary(); | |
436 } | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
437 if(settingsGetPointer()->design == 3) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
438 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
439 t3_set_customview_to_primary(); |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
440 } |
38 | 441 } |
442 } | |
443 } | |
444 | |
445 | |
446 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput) | |
447 { | |
448 uint32_t answer = 0; | |
449 | |
450 answer = 0; | |
451 answer += (dateInput->Year & 0x7F)<< 9; | |
452 answer += (dateInput->Month & 0x0F)<< 5; | |
453 answer += (dateInput->Date & 0x1F); | |
454 | |
455 return answer; | |
456 } | |
457 | |
458 | |
459 uint8_t tHome_gas_writer(uint8_t oxygen_percentage, uint8_t helium_percentage, char *text) | |
460 { | |
461 if(oxygen_percentage == 100) | |
462 return (uint8_t) snprintf(text,10,"Oxy"); | |
463 else if((oxygen_percentage == 21) && (!helium_percentage)) | |
464 return (uint8_t) snprintf(text,10,"Air"); | |
465 else if(!helium_percentage) | |
466 return (uint8_t) snprintf(text,10,"NX%02i",oxygen_percentage); | |
467 else if((oxygen_percentage + helium_percentage) == 100) | |
468 return (uint8_t) snprintf(text,10,"HX%02i",oxygen_percentage); | |
469 else | |
470 return (uint8_t) snprintf(text,10,"%02i/%02i",oxygen_percentage,helium_percentage); | |
471 } | |
472 | |
473 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn) | |
474 { | |
208 | 475 static uint8_t LastKnowRTEState = SPI_RX_STATE_INVALID; |
476 | |
99 | 477 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
|
478 if(DataEX_lost_connection_count()>=SPI_MIN_ERROR_SHOW && SPI_SHOW_SYNC_STATS){ |
38 | 479 |
99 | 480 char text[64]; |
38 | 481 |
82 | 482 SDataExchangeSlaveToMaster* dataIn=get_dataInPointer(); |
208 | 483 SDataReceiveFromMaster* pDataOut = dataOutGetPointer(); |
82 | 484 |
493
b560e474e319
Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents:
386
diff
changeset
|
485 snprintf(text,32,"spi err:\002 %ld/%ld",DataEX_lost_connection_count(),get_num_SPI_CALLBACKS()); |
99 | 486 Gfx_write_label_var(ScreenToWriteOn, 100,300, 0,&FontT24,CLUT_ButtonSymbols,text); |
82 | 487 |
104 | 488 // 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]); |
489 // Gfx_write_label_var(ScreenToWriteOn, 350,550, 0,&FontT24,CLUT_ButtonSymbols,text); | |
82 | 490 |
208 | 491 //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]); |
492 | |
493 /* data shifted => ignore received data */ | |
494 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)) | |
495 { | |
496 dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] = LastKnowRTEState; | |
497 } | |
498 else | |
499 { | |
500 LastKnowRTEState =dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE]; | |
501 } | |
502 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 | 503 Gfx_write_label_var(ScreenToWriteOn, 600,800, 0,&FontT24,CLUT_ButtonSymbols,text); |
504 } | |
82 | 505 |
99 | 506 |
507 | |
508 // snprintf(text,32,"cpt:\002%i",get_num_SPI_CALLBACKS()); | |
509 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
82 | 510 |
511 // snprintf(text,10,"i2c:\002%i",get_DataEX_Error_place()); | |
512 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
38 | 513 |
514 return DataEX_lost_connection_count(); | |
515 } |