Mercurial > public > ostc4
annotate Discovery/Src/tHome.c @ 696:cc542448fb28
Merge
author | heinrichsweikamp |
---|---|
date | Fri, 19 Aug 2022 11:30:24 +0200 |
parents | 980d7f8d5530 |
children | 4a6bffaa38b3 |
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" |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
46 #include "logbook_miniLive.h" |
38 | 47 |
48 /* Private types -------------------------------------------------------------*/ | |
49 | |
50 /* Exported variables --------------------------------------------------------*/ | |
51 _Bool warning_count_high_time = 0; | |
52 _Bool display_count_high_time = 0; | |
53 | |
54 uint8_t errorsInSettings = 0; | |
55 /* Private variables ---------------------------------------------------------*/ | |
56 static uint8_t warning_toogle_count; | |
57 static uint16_t display_toogle_count; | |
58 static uint16_t tHome_tick_count_cview; | |
59 static uint16_t tHome_tick_count_field; | |
576 | 60 static uint16_t tHome_tick_count_o2sens; |
38 | 61 |
379 | 62 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
|
63 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
|
64 CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_DecoTTS, |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
65 #ifdef ENABLE_T3_PROFILE_VIEW |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
66 CVIEW_T3_Profile, |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
67 #endif |
280c11153080
Added compile switch for new T3 View Profile
Ideenmodellierer
parents:
576
diff
changeset
|
68 CVIEW_T3_END}; |
38 | 69 |
70 /* Private function prototypes -----------------------------------------------*/ | |
71 | |
576 | 72 #define AUTORETURN_O2SENS (200u) /* return to sensor view after 20 seconds in case sensor is connected */ |
73 | |
74 | |
38 | 75 /* Exported functions --------------------------------------------------------*/ |
76 | |
77 void set_globalState_tHome(void) | |
78 { | |
79 if(stateUsed->mode == MODE_DIVE) | |
80 set_globalState(StD); | |
81 else | |
82 set_globalState(StS); | |
83 } | |
84 | |
85 | |
86 void tHome_init(void) | |
87 { | |
88 t7_init(); // standard + surface | |
89 t3_init(); // big font | |
90 t4_init(); // game | |
91 t5_init(); // gauge | |
92 t6_init(); // apnea | |
93 } | |
94 | |
95 | |
96 void tHome_init_compass(void) | |
97 { | |
98 init_t7_compass(); | |
99 } | |
100 | |
101 | |
102 void tHome_refresh(void) | |
103 { | |
104 SSettings* pSettings = settingsGetPointer(); | |
105 | |
106 warning_toogle_count++; | |
107 if(warning_toogle_count >= 2* pSettings->warning_blink_dsec) | |
108 warning_toogle_count = 0; | |
109 | |
110 if(warning_toogle_count >= pSettings->warning_blink_dsec) | |
111 warning_count_high_time = 1; | |
112 else | |
113 warning_count_high_time = 0; | |
114 | |
115 | |
116 display_toogle_count++; | |
117 if(display_toogle_count >= 2* pSettings->display_toogle_desc) | |
118 display_toogle_count = 0; | |
119 | |
120 if(display_toogle_count >= pSettings->display_toogle_desc) | |
121 display_count_high_time = 1; | |
122 else | |
123 display_count_high_time = 0; | |
124 | |
125 | |
126 if(pSettings->design == 6) | |
127 t6_refresh(); | |
128 else | |
129 if(pSettings->design == 5) | |
130 t5_refresh(); | |
131 else | |
132 if(pSettings->design == 4) | |
133 t4_refresh(); | |
134 else | |
135 if(pSettings->design == 3) | |
136 t3_refresh(); | |
137 else | |
138 if(pSettings->design == 7) | |
139 t7_refresh(); | |
140 else | |
141 { | |
142 pSettings->design = 7; | |
143 t7_refresh(); | |
144 } | |
145 } | |
146 | |
147 | |
148 void tHome_sleepmode_fun(void) | |
149 { | |
150 t7_refresh_sleepmode_fun(); | |
151 } | |
152 | |
153 | |
154 void tHomeDiveMenuControl(uint8_t sendAction) | |
155 { | |
156 if(sendAction == ACTION_BUTTON_NEXT) | |
157 { | |
158 if(settingsGetPointer()->design == 4) | |
159 return; | |
160 | |
161 switch(get_globalState()) | |
162 { | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
163 case StD: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
164 if(settingsGetPointer()->design == 6) |
38 | 165 { |
166 if(is_stateUsedSetToSim()) | |
167 set_globalState(StDSIM1); | |
168 else | |
169 set_globalState(StDQUIT); | |
170 break; | |
171 } | |
172 | |
173 if(settingsGetPointer()->design == 5) | |
174 { | |
175 if(t5_getCustomView() == CVIEW_Compass) | |
176 set_globalState(StDBEAR); | |
177 else | |
178 set_globalState(StDRAVG); | |
179 break; | |
180 } | |
181 | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
182 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
183 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
184 switch(t3_getCustomView()) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
185 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
186 case CVIEW_T3_Navigation: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
187 case CVIEW_Compass: set_globalState(StDBEAR); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
188 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
189 case CVIEW_T3_StopWatch: set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
190 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
191 case CVIEW_T3_GasList: if(stateUsed->warnings.betterGas) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
192 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
193 set_globalState(StDMGAS); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
194 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
195 break; |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
196 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
197 case CVIEW_sensors: if(is_stateUsedSetToSim()) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
198 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
199 set_globalState(StDSIM1); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
200 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
201 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
202 #endif |
628
db2bcd2f6778
Added compile switch for T3_PROFILE menu operation option
Ideenmodellierer
parents:
619
diff
changeset
|
203 #ifdef ENABLE_T3_PROFILE_VIEW |
613 | 204 case CVIEW_T3_Profile: set_globalState(StDMARK); |
628
db2bcd2f6778
Added compile switch for T3_PROFILE menu operation option
Ideenmodellierer
parents:
619
diff
changeset
|
205 #endif |
613 | 206 break; |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
207 default: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
208 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
209 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
210 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
211 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
212 |
38 | 213 if(stateUsed->warnings.betterGas) |
214 set_globalState(StDMGAS); | |
215 else | |
216 if(stateUsed->warnings.betterSetpoint) | |
217 set_globalState(StDMSPT); | |
218 else | |
219 set_globalState(StDMENU); | |
220 break; | |
221 | |
222 case StDMGAS: | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
223 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
224 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
225 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
226 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
227 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
228 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
229 if(stateUsed->warnings.betterSetpoint) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
230 set_globalState(StDMSPT); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
231 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
232 set_globalState(StDMENU); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
233 } |
38 | 234 break; |
235 | |
236 case StDMSPT: | |
237 set_globalState(StDMENU); | |
238 break; | |
239 | |
240 case StDMENU: | |
241 if(is_stateUsedSetToSim()) | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
242 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
243 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
244 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
245 set_globalState(StDSIM1); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
246 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
247 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
248 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
249 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
250 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x01) == 0) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
251 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
252 set_globalState(StDSIM1); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
253 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
254 else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x02) == 0) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
255 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
256 set_globalState(StDSIM3); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
257 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
258 else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
259 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
260 set_globalState(StDSIM5); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
261 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
262 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
263 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
264 set_globalState(StD); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
265 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
266 #endif |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
267 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
268 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
269 |
38 | 270 else |
271 set_globalState(StD); | |
272 break; | |
273 | |
274 case StDSIM1: | |
275 set_globalState(StDSIM2); | |
276 break; | |
277 | |
278 case StDSIM2: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
279 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
280 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
281 set_globalState(StDSIM3); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
282 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
283 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
284 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
285 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
286 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x02) == 0) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
287 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
288 set_globalState(StDSIM3); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
289 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
290 else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
291 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
292 set_globalState(StDSIM5); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
293 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
294 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
295 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
296 set_globalState(StD); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
297 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
298 #endif |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
299 } |
38 | 300 break; |
301 | |
302 case StDSIM3: | |
303 set_globalState(StDSIM4); | |
304 break; | |
305 | |
306 case StDSIM4: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
307 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
308 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
309 set_globalState(StD); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
310 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
311 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
312 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
313 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
314 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
315 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
316 set_globalState(StDSIM5); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
317 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
318 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
319 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
320 set_globalState(StD); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
321 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
322 #endif |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
323 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
324 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
325 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
326 case StDSIM5: |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
327 set_globalState(StDSIM6); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
328 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
329 |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
330 case StDSIM6: |
38 | 331 set_globalState(StD); |
332 break; | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
333 #endif |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
334 case StDBEAR: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
335 if(settingsGetPointer()->design == 5) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
336 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
337 set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
338 } |
38 | 339 |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
340 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
341 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
342 if(t3_getCustomView() == CVIEW_T3_Navigation) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
343 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
344 set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
345 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
346 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
347 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
348 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
349 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
350 } |
38 | 351 break; |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
352 case StDRAVG: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
353 if(settingsGetPointer()->design == 5) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
354 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
355 if(is_stateUsedSetToSim()) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
356 set_globalState(StDSIM1); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
357 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
358 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
359 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
360 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
361 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
362 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
363 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
364 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
365 break; |
38 | 366 case StDQUIT: // t6_apnea |
367 set_globalState(StD); | |
368 break; | |
369 | |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
370 case StDMARK: |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
371 if((settingsGetPointer()->design == 3) && (MiniLiveLogbook_getNextMarkerIndex(0) != 0)) |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
372 { |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
373 set_globalState(StDCHECK); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
374 } |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
375 else |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
376 { |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
377 set_globalState(StD); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
378 } |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
379 break; |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
380 |
38 | 381 default: |
382 set_globalState(StD); | |
383 } | |
384 } | |
385 | |
386 if(sendAction == ACTION_BUTTON_ENTER) | |
387 { | |
388 if(settingsGetPointer()->design == 4) | |
389 return; | |
390 | |
391 switch(get_globalState()) | |
392 { | |
393 case StDMGAS: | |
394 openEdit_DiveSelectBetterGas(); | |
395 set_globalState(StD); | |
396 break; | |
397 case StDMSPT: | |
398 openEdit_DiveSelectBetterSetpoint(); | |
399 set_globalState(StD); | |
400 break; | |
401 | |
402 case StDMENU: | |
403 openMenu_first_page_with_OC_gas_update(); | |
404 break; | |
405 | |
406 case StDSIM1: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
407 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
408 { |
38 | 409 Sim_Quit(); |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
410 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
411 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
412 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
413 Sim_IncreasePPO(0); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
414 } |
38 | 415 break; |
416 | |
417 case StDSIM2: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
418 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
419 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
420 Sim_Ascend(); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
421 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
422 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
423 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
424 Sim_DecreasePPO(0); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
425 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
426 |
38 | 427 break; |
428 | |
429 case StDSIM3: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
430 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
431 { |
38 | 432 Sim_Descend(); |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
433 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
434 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
435 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
436 Sim_IncreasePPO(1); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
437 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
438 |
38 | 439 break; |
440 | |
441 case StDSIM4: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
442 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
443 { |
38 | 444 Sim_Divetime(); |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
445 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
446 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
447 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
448 Sim_DecreasePPO(1); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
449 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
450 |
38 | 451 break; |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
452 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
453 case StDSIM5: |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
454 Sim_IncreasePPO(2); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
455 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
456 case StDSIM6: |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
457 Sim_DecreasePPO(2); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
458 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
459 #endif |
38 | 460 case StDBEAR: // t5_gauge |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
210
diff
changeset
|
461 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; |
38 | 462 set_globalState(StD); |
463 break; | |
464 | |
465 case StDRAVG: // t5_gauge | |
466 timer_Stopwatch_Restart(); | |
467 set_globalState(StD); | |
468 break; | |
469 | |
470 case StDQUIT: // t6_apnea | |
471 set_globalState(StD); // used to end StDQUIT, is called before everything else because changes are made in the next lines | |
472 if(is_stateUsedSetToSim()) | |
473 Sim_Quit(); | |
474 else | |
475 dataOutGetPointer()->setEndDive = 1; | |
476 break; | |
613 | 477 case StDMARK: stateUsedWrite->events.manualMarker = 1; |
478 set_globalState(StD); | |
479 break; | |
38 | 480 |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
481 case StDCHECK: MiniLiveLogbook_checkMarker(); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
482 break; |
38 | 483 default: |
484 break; | |
485 } | |
486 } | |
487 } | |
488 | |
489 | |
490 void tHome_findNextStop(const uint16_t *list, uint8_t *depthOutMeter, uint16_t *lengthOutSeconds) | |
491 { | |
492 uint8_t ptr = DECOINFO_STRUCT_MAX_STOPS - 1; | |
493 | |
494 while(ptr && !list[ptr]) | |
495 ptr--; | |
496 | |
497 *lengthOutSeconds = list[ptr]; | |
498 if(!(*lengthOutSeconds)) | |
499 { | |
500 *depthOutMeter = 0; | |
501 } | |
502 else | |
503 if(ptr == 0) | |
504 { | |
505 *depthOutMeter = (uint8_t)((stateUsed->diveSettings.last_stop_depth_bar*10.0f) + 0.1f); | |
506 } | |
507 else | |
508 { | |
509 ptr -= 1; | |
510 *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); | |
511 } | |
512 } | |
513 | |
514 | |
515 void tHome_change_field_button_pressed(void) | |
516 { | |
517 tHome_tick_count_field = 0; | |
576 | 518 tHome_tick_count_o2sens = 0; |
38 | 519 if(settingsGetPointer()->design == 7) |
520 t7_change_field(); | |
521 } | |
522 | |
523 | |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
524 void tHome_change_customview_button_pressed(uint8_t action) |
38 | 525 { |
526 tHome_tick_count_cview = 0; | |
576 | 527 tHome_tick_count_o2sens = 0; |
528 | |
38 | 529 if(settingsGetPointer()->design == 7) |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
530 t7_change_customview(action); |
38 | 531 else |
532 if(settingsGetPointer()->design == 3) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
533 t3_change_customview(action); |
38 | 534 else |
535 if(settingsGetPointer()->design == 5) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
536 t5_change_customview(action); |
38 | 537 else |
538 if(settingsGetPointer()->design == 6) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
539 t6_change_customview(action); |
38 | 540 } |
541 | |
505 | 542 uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list) |
543 { | |
544 uint8_t cnt = 0; | |
545 | |
546 while((pcv_list[cnt] != CVIEW_END) && (pcv_list[cnt] != CVIEW_T3_END)) | |
547 { | |
548 cnt++; | |
549 if (cnt > 100) /* just in case an invalid list has been provided... */ | |
550 { | |
551 break; | |
552 } | |
553 } | |
554 cnt--; /* do not count end token */ | |
555 return cnt; | |
556 } | |
38 | 557 |
558 void tHome_tick(void) | |
559 { | |
560 uint16_t field = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; | |
561 uint16_t cview = settingsGetPointer()->tX_customViewTimeout; | |
562 | |
563 if(field) | |
564 { | |
565 tHome_tick_count_field++; | |
566 if(tHome_tick_count_field > (field * 10)) | |
567 { | |
568 tHome_tick_count_field = 0; | |
569 if(settingsGetPointer()->design == 7) | |
570 { | |
571 t7_set_field_to_primary(); | |
572 } | |
573 } | |
574 } | |
575 | |
576 if(cview) | |
577 { | |
578 tHome_tick_count_cview++; | |
579 if(tHome_tick_count_cview > (cview *10)) | |
580 { | |
581 tHome_tick_count_cview = 0; | |
582 if(settingsGetPointer()->design == 7) | |
583 { | |
584 t7_set_customview_to_primary(); | |
585 } | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
586 if(settingsGetPointer()->design == 3) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
587 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
588 t3_set_customview_to_primary(); |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
589 } |
38 | 590 } |
591 } | |
576 | 592 |
685
980d7f8d5530
Bugfix automatic switch to o2 sensor custom view:
Ideenmodellierer
parents:
633
diff
changeset
|
593 if((stateUsed->mode == MODE_SURFACE) && (stateUsed->diveSettings.ppo2sensors_deactivated != 0x07) && (stateUsed->diveSettings.ccrOption != 0) && (!t7_customview_disabled(CVIEW_sensors))) |
576 | 594 { |
595 tHome_tick_count_o2sens++; | |
596 if(tHome_tick_count_o2sens > AUTORETURN_O2SENS) | |
597 { | |
598 tHome_tick_count_o2sens = 0; | |
599 t7_select_customview(CVIEW_sensors); | |
600 } | |
601 } | |
38 | 602 } |
603 | |
604 | |
605 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput) | |
606 { | |
607 uint32_t answer = 0; | |
608 | |
609 answer = 0; | |
610 answer += (dateInput->Year & 0x7F)<< 9; | |
611 answer += (dateInput->Month & 0x0F)<< 5; | |
612 answer += (dateInput->Date & 0x1F); | |
613 | |
614 return answer; | |
615 } | |
616 | |
617 | |
618 uint8_t tHome_gas_writer(uint8_t oxygen_percentage, uint8_t helium_percentage, char *text) | |
619 { | |
620 if(oxygen_percentage == 100) | |
621 return (uint8_t) snprintf(text,10,"Oxy"); | |
622 else if((oxygen_percentage == 21) && (!helium_percentage)) | |
623 return (uint8_t) snprintf(text,10,"Air"); | |
624 else if(!helium_percentage) | |
625 return (uint8_t) snprintf(text,10,"NX%02i",oxygen_percentage); | |
626 else if((oxygen_percentage + helium_percentage) == 100) | |
627 return (uint8_t) snprintf(text,10,"HX%02i",oxygen_percentage); | |
628 else | |
629 return (uint8_t) snprintf(text,10,"%02i/%02i",oxygen_percentage,helium_percentage); | |
630 } | |
631 | |
632 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn) | |
633 { | |
208 | 634 static uint8_t LastKnowRTEState = SPI_RX_STATE_INVALID; |
635 | |
99 | 636 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
|
637 if(DataEX_lost_connection_count()>=SPI_MIN_ERROR_SHOW && SPI_SHOW_SYNC_STATS){ |
38 | 638 |
99 | 639 char text[64]; |
38 | 640 |
82 | 641 SDataExchangeSlaveToMaster* dataIn=get_dataInPointer(); |
208 | 642 SDataReceiveFromMaster* pDataOut = dataOutGetPointer(); |
82 | 643 |
493
b560e474e319
Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents:
386
diff
changeset
|
644 snprintf(text,32,"spi err:\002 %ld/%ld",DataEX_lost_connection_count(),get_num_SPI_CALLBACKS()); |
99 | 645 Gfx_write_label_var(ScreenToWriteOn, 100,300, 0,&FontT24,CLUT_ButtonSymbols,text); |
82 | 646 |
104 | 647 // 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]); |
648 // Gfx_write_label_var(ScreenToWriteOn, 350,550, 0,&FontT24,CLUT_ButtonSymbols,text); | |
82 | 649 |
208 | 650 //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]); |
651 | |
652 /* data shifted => ignore received data */ | |
653 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)) | |
654 { | |
655 dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] = LastKnowRTEState; | |
656 } | |
657 else | |
658 { | |
659 LastKnowRTEState =dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE]; | |
660 } | |
661 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 | 662 Gfx_write_label_var(ScreenToWriteOn, 600,800, 0,&FontT24,CLUT_ButtonSymbols,text); |
663 } | |
82 | 664 |
99 | 665 |
666 | |
667 // snprintf(text,32,"cpt:\002%i",get_num_SPI_CALLBACKS()); | |
668 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
82 | 669 |
670 // snprintf(text,10,"i2c:\002%i",get_DataEX_Error_place()); | |
671 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
38 | 672 |
673 return DataEX_lost_connection_count(); | |
674 } |