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