Mercurial > public > ostc4
annotate Discovery/Src/tHome.c @ 820:7322adb00305
Split definition of custom views:
In the previous version the T7 and T3 custom views were defined using the same enum. As result an ID shift may happen causing errors in the selection of the big font views.
The second reason to split the definition is that shift operations are used in uint32_t variable (limit 32). The total number of current views is 27 => splitting will avoid ID problems in case new views are added.
author | Ideenmodellierer |
---|---|
date | Sun, 24 Sep 2023 18:43:12 +0200 |
parents | c4ee952b9425 |
children | 8d6c35655d4d |
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 |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
777
diff
changeset
|
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_Timer, 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); | |
816
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
810
diff
changeset
|
89 |
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
810
diff
changeset
|
90 clearDisabledMenuLines(); |
38 | 91 } |
92 | |
93 | |
94 void tHome_init(void) | |
95 { | |
96 t7_init(); // standard + surface | |
97 t3_init(); // big font | |
98 t4_init(); // game | |
99 t5_init(); // gauge | |
100 t6_init(); // apnea | |
101 } | |
102 | |
103 | |
104 void tHome_init_compass(void) | |
105 { | |
106 init_t7_compass(); | |
107 } | |
108 | |
109 | |
110 void tHome_refresh(void) | |
111 { | |
112 SSettings* pSettings = settingsGetPointer(); | |
113 | |
114 warning_toogle_count++; | |
115 if(warning_toogle_count >= 2* pSettings->warning_blink_dsec) | |
116 warning_toogle_count = 0; | |
117 | |
118 if(warning_toogle_count >= pSettings->warning_blink_dsec) | |
119 warning_count_high_time = 1; | |
120 else | |
121 warning_count_high_time = 0; | |
122 | |
123 | |
124 display_toogle_count++; | |
125 if(display_toogle_count >= 2* pSettings->display_toogle_desc) | |
126 display_toogle_count = 0; | |
127 | |
128 if(display_toogle_count >= pSettings->display_toogle_desc) | |
129 display_count_high_time = 1; | |
130 else | |
131 display_count_high_time = 0; | |
132 | |
133 | |
134 if(pSettings->design == 6) | |
135 t6_refresh(); | |
136 else | |
137 if(pSettings->design == 5) | |
138 t5_refresh(); | |
139 else | |
140 if(pSettings->design == 4) | |
141 t4_refresh(); | |
142 else | |
143 if(pSettings->design == 3) | |
144 t3_refresh(); | |
145 else | |
146 if(pSettings->design == 7) | |
147 t7_refresh(); | |
148 else | |
149 { | |
150 pSettings->design = 7; | |
151 t7_refresh(); | |
152 } | |
153 } | |
154 | |
155 | |
156 void tHome_sleepmode_fun(void) | |
157 { | |
158 t7_refresh_sleepmode_fun(); | |
159 } | |
160 | |
161 | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
162 static void checkSetStateSim(SSettings *settings) |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
163 { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
164 if (is_stateUsedSetToSim()) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
165 if (settings->design != 3) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
166 set_globalState(StDSIM1); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
167 } else { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
168 #ifdef ENABLE_T3_PPO_SIM |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
169 if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x01 == 0) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
170 set_globalState(StDSIM1); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
171 } else if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x02 == 0) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
172 set_globalState(StDSIM3); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
173 } else if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x04 == 0) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
174 set_globalState(StDSIM5); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
175 } else { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
176 set_globalState(StD); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
177 } |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
178 #endif |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
179 } |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
180 } else { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
181 set_globalState(StD); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
182 } |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
183 } |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
184 |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
185 |
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
186 static void checkSetStateCompassSim(SSettings *settings) |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
187 { |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
188 if (settings->design == 7 && t7_isCompassShowing()) { |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
189 set_globalState(StDBEAR); |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
190 } else { |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
191 checkSetStateSim(settings); |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
192 } |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
193 } |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
194 |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
195 |
38 | 196 void tHomeDiveMenuControl(uint8_t sendAction) |
197 { | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
198 SSettings *settings = settingsGetPointer(); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
199 |
38 | 200 if(sendAction == ACTION_BUTTON_NEXT) |
201 { | |
202 if(settingsGetPointer()->design == 4) | |
203 return; | |
204 | |
205 switch(get_globalState()) | |
206 { | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
207 case StD: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
208 if(settingsGetPointer()->design == 6) |
38 | 209 { |
210 if(is_stateUsedSetToSim()) | |
211 set_globalState(StDSIM1); | |
212 else | |
213 set_globalState(StDQUIT); | |
214 break; | |
215 } | |
216 | |
217 if(settingsGetPointer()->design == 5) | |
218 { | |
219 if(t5_getCustomView() == CVIEW_Compass) | |
220 set_globalState(StDBEAR); | |
221 else | |
222 set_globalState(StDRAVG); | |
223 break; | |
224 } | |
225 | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
226 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
227 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
228 switch(t3_getCustomView()) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
229 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
230 case CVIEW_T3_Navigation: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
231 case CVIEW_Compass: set_globalState(StDBEAR); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
232 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
233 case CVIEW_T3_StopWatch: set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
234 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
235 case CVIEW_T3_GasList: if(stateUsed->warnings.betterGas) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
236 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
237 set_globalState(StDMGAS); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
238 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
239 break; |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
240 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
241 case CVIEW_sensors: if(is_stateUsedSetToSim()) |
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 set_globalState(StDSIM1); |
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 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
246 #endif |
628
db2bcd2f6778
Added compile switch for T3_PROFILE menu operation option
Ideenmodellierer
parents:
619
diff
changeset
|
247 #ifdef ENABLE_T3_PROFILE_VIEW |
613 | 248 case CVIEW_T3_Profile: set_globalState(StDMARK); |
628
db2bcd2f6778
Added compile switch for T3_PROFILE menu operation option
Ideenmodellierer
parents:
619
diff
changeset
|
249 #endif |
613 | 250 break; |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
251 default: |
739 | 252 set_globalState(StDMENU); |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
253 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
254 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
255 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
256 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
257 |
38 | 258 if(stateUsed->warnings.betterGas) |
259 set_globalState(StDMGAS); | |
260 else | |
261 if(stateUsed->warnings.betterSetpoint) | |
262 set_globalState(StDMSPT); | |
263 else | |
264 set_globalState(StDMENU); | |
265 break; | |
266 | |
267 case StDMGAS: | |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
268 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
269 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
270 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
271 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
272 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
273 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
274 if(stateUsed->warnings.betterSetpoint) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
275 set_globalState(StDMSPT); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
276 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
277 set_globalState(StDMENU); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
278 } |
38 | 279 break; |
280 | |
281 case StDMSPT: | |
282 set_globalState(StDMENU); | |
283 break; | |
284 | |
285 case StDMENU: | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
286 if (settings->design == 7 && isLoopMode(settings->dive_mode)) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
287 set_globalState(StDBAILOUT); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
288 |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
289 break; |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
290 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
291 |
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
292 checkSetStateCompassSim(settings); |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
293 |
38 | 294 break; |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
295 case StDBAILOUT: |
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
296 if (settingsGetPointer()->dive_mode == DIVEMODE_CCR && isLoopMode(stateUsed->diveSettings.diveMode) && findSwitchToSetpoint()) { |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
297 set_globalState(StDSETPOINT); |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
298 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
299 break; |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
300 } |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
301 |
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
302 checkSetStateCompassSim(settings); |
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
303 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
304 break; |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
305 case StDSETPOINT: |
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
306 checkSetStateCompassSim(settings); |
38 | 307 |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
308 break; |
38 | 309 case StDSIM1: |
310 set_globalState(StDSIM2); | |
311 break; | |
312 | |
313 case StDSIM2: | |
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(StDSIM3); |
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 & 0x02) == 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(StDSIM3); |
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 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0) |
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(StDSIM5); |
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 else |
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 set_globalState(StD); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
332 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
333 #endif |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
334 } |
38 | 335 break; |
336 | |
337 case StDSIM3: | |
338 set_globalState(StDSIM4); | |
339 break; | |
340 | |
341 case StDSIM4: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
342 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
343 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
344 set_globalState(StD); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
345 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
346 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
347 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
348 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
349 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
350 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
351 set_globalState(StDSIM5); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
352 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
353 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
354 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
355 set_globalState(StD); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
356 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
357 #endif |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
358 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
359 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
360 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
361 case StDSIM5: |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
362 set_globalState(StDSIM6); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
363 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
364 |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
365 case StDSIM6: |
38 | 366 set_globalState(StD); |
367 break; | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
368 #endif |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
369 case StDBEAR: |
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
370 if (settingsGetPointer()->design == 7) { |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
371 checkSetStateSim(settings); |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
372 |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
373 break; |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
374 } |
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
375 |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
376 if(settingsGetPointer()->design == 5) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
377 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
378 set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
379 } |
38 | 380 |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
381 if(settingsGetPointer()->design == 3) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
382 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
383 if(t3_getCustomView() == CVIEW_T3_Navigation) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
384 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
385 set_globalState(StDRAVG); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
386 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
387 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
388 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
389 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
390 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
391 } |
38 | 392 break; |
516
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
393 case StDRAVG: |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
394 if(settingsGetPointer()->design == 5) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
395 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
396 if(is_stateUsedSetToSim()) |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
397 set_globalState(StDSIM1); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
398 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
399 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
400 break; |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
401 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
402 else |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
403 { |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
404 set_globalState(StD); |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
405 } |
bd66f4910993
Added quick menu function to big font view:
Ideenmodellierer
parents:
505
diff
changeset
|
406 break; |
38 | 407 case StDQUIT: // t6_apnea |
408 set_globalState(StD); | |
409 break; | |
410 | |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
411 case StDMARK: |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
412 if((settingsGetPointer()->design == 3) && (MiniLiveLogbook_getNextMarkerIndex(0) != 0)) |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
413 { |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
414 set_globalState(StDCHECK); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
415 } |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
416 else |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
417 { |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
418 set_globalState(StD); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
419 } |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
420 break; |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
421 |
38 | 422 default: |
423 set_globalState(StD); | |
424 } | |
425 } | |
426 | |
427 if(sendAction == ACTION_BUTTON_ENTER) | |
428 { | |
429 if(settingsGetPointer()->design == 4) | |
430 return; | |
431 | |
432 switch(get_globalState()) | |
433 { | |
434 case StDMGAS: | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
435 openEdit_DiveSelectBetterGas(false); |
38 | 436 set_globalState(StD); |
437 break; | |
438 case StDMSPT: | |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
439 openEdit_DiveSelectBetterSetpoint(false); |
38 | 440 set_globalState(StD); |
441 break; | |
442 | |
443 case StDMENU: | |
444 openMenu_first_page_with_OC_gas_update(); | |
445 break; | |
446 | |
447 case StDSIM1: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
448 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
449 { |
38 | 450 Sim_Quit(); |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
451 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
452 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
453 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
454 Sim_IncreasePPO(0); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
455 } |
38 | 456 break; |
457 | |
458 case StDSIM2: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
459 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
460 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
461 Sim_Ascend(); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
462 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
463 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
464 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
465 Sim_DecreasePPO(0); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
466 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
467 |
38 | 468 break; |
469 | |
470 case StDSIM3: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
471 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
472 { |
38 | 473 Sim_Descend(); |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
474 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
475 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
476 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
477 Sim_IncreasePPO(1); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
478 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
479 |
38 | 480 break; |
481 | |
482 case StDSIM4: | |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
483 if(settingsGetPointer()->design != 3) |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
484 { |
38 | 485 Sim_Divetime(); |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
486 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
487 else |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
488 { |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
489 Sim_DecreasePPO(1); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
490 } |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
491 |
38 | 492 break; |
633
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
493 #ifdef ENABLE_T3_PPO_SIM |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
494 case StDSIM5: |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
495 Sim_IncreasePPO(2); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
496 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
497 case StDSIM6: |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
498 Sim_DecreasePPO(2); |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
499 break; |
68d95049f11a
Added menu structure to allow ppo2 modification in simulator mode:
Ideenmodellierer
parents:
628
diff
changeset
|
500 #endif |
773
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
501 case StDBAILOUT: |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
502 if (isLoopMode(stateUsed->diveSettings.diveMode)) { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
503 tMEGas_check_switch_to_bailout(); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
504 |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
505 openEdit_DiveSelectBetterGas(true); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
506 } else { |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
507 checkSwitchToLoop(); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
508 |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
509 openEdit_DiveSelectBetterSetpoint(true); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
510 } |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
511 |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
512 set_globalState(StD); |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
513 |
2c243233c999
Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
heinrichsweikamp
parents:
739
diff
changeset
|
514 break; |
775
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
515 case StDSETPOINT: |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
516 checkSwitchSetpoint(); |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
517 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
518 set_globalState(StD); |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
519 |
46c6d2380d4e
Add a shortcuts to change the setpoint to the loop to the 'normal' display when diving. It is only shown when diving in CCR mode and on the loop.
heinrichsweikamp
parents:
774
diff
changeset
|
520 break; |
777
6a8cf91e5b22
This is only showing if one of the compass views is visible. It should make it possible to verify that a correct heading is set as the user can see the compass readout when pushing the button. (mikeller)
heinrichsweikamp
parents:
775
diff
changeset
|
521 case StDBEAR: // t5_gauge, t7 |
774
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
773
diff
changeset
|
522 setCompassHeading((uint16_t)stateUsed->lifeData.compass_heading); |
38 | 523 set_globalState(StD); |
524 break; | |
525 | |
526 case StDRAVG: // t5_gauge | |
527 timer_Stopwatch_Restart(); | |
528 set_globalState(StD); | |
529 break; | |
530 | |
531 case StDQUIT: // t6_apnea | |
532 set_globalState(StD); // used to end StDQUIT, is called before everything else because changes are made in the next lines | |
533 if(is_stateUsedSetToSim()) | |
534 Sim_Quit(); | |
535 else | |
536 dataOutGetPointer()->setEndDive = 1; | |
537 break; | |
613 | 538 case StDMARK: stateUsedWrite->events.manualMarker = 1; |
539 set_globalState(StD); | |
540 break; | |
38 | 541 |
619
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
542 case StDCHECK: MiniLiveLogbook_checkMarker(); |
8fa2de4414a8
Added t3 quick menu for marker synchronisation:
Ideenmodellierer
parents:
613
diff
changeset
|
543 break; |
38 | 544 default: |
545 break; | |
546 } | |
547 } | |
548 } | |
549 | |
550 | |
551 void tHome_findNextStop(const uint16_t *list, uint8_t *depthOutMeter, uint16_t *lengthOutSeconds) | |
552 { | |
553 uint8_t ptr = DECOINFO_STRUCT_MAX_STOPS - 1; | |
554 | |
555 while(ptr && !list[ptr]) | |
556 ptr--; | |
557 | |
558 *lengthOutSeconds = list[ptr]; | |
559 if(!(*lengthOutSeconds)) | |
560 { | |
561 *depthOutMeter = 0; | |
562 } | |
563 else | |
564 if(ptr == 0) | |
565 { | |
566 *depthOutMeter = (uint8_t)((stateUsed->diveSettings.last_stop_depth_bar*10.0f) + 0.1f); | |
567 } | |
568 else | |
569 { | |
570 ptr -= 1; | |
571 *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); | |
572 } | |
573 } | |
574 | |
575 | |
576 void tHome_change_field_button_pressed(void) | |
577 { | |
578 tHome_tick_count_field = 0; | |
576 | 579 tHome_tick_count_o2sens = 0; |
38 | 580 if(settingsGetPointer()->design == 7) |
581 t7_change_field(); | |
582 } | |
583 | |
584 | |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
585 void tHome_change_customview_button_pressed(uint8_t action) |
38 | 586 { |
587 tHome_tick_count_cview = 0; | |
576 | 588 tHome_tick_count_o2sens = 0; |
589 | |
38 | 590 if(settingsGetPointer()->design == 7) |
361
b111fc4250e9
Pass action to customer vie update function.
Ideenmodellierer
parents:
289
diff
changeset
|
591 t7_change_customview(action); |
38 | 592 else |
593 if(settingsGetPointer()->design == 3) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
594 t3_change_customview(action); |
38 | 595 else |
596 if(settingsGetPointer()->design == 5) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
597 t5_change_customview(action); |
38 | 598 else |
599 if(settingsGetPointer()->design == 6) | |
386
39c147e47c1c
Added key direction awarness to t3, t5 and t6 views:
ideenmodellierer
parents:
384
diff
changeset
|
600 t6_change_customview(action); |
38 | 601 } |
602 | |
505 | 603 uint8_t tHome_getNumberOfAvailableCVs(const uint8_t* pcv_list) |
604 { | |
605 uint8_t cnt = 0; | |
606 | |
607 while((pcv_list[cnt] != CVIEW_END) && (pcv_list[cnt] != CVIEW_T3_END)) | |
608 { | |
609 cnt++; | |
610 if (cnt > 100) /* just in case an invalid list has been provided... */ | |
611 { | |
612 break; | |
613 } | |
614 } | |
615 cnt--; /* do not count end token */ | |
616 return cnt; | |
617 } | |
38 | 618 |
619 void tHome_tick(void) | |
620 { | |
621 uint16_t field = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; | |
622 uint16_t cview = settingsGetPointer()->tX_customViewTimeout; | |
623 | |
624 if(field) | |
625 { | |
626 tHome_tick_count_field++; | |
627 if(tHome_tick_count_field > (field * 10)) | |
628 { | |
629 tHome_tick_count_field = 0; | |
630 if(settingsGetPointer()->design == 7) | |
631 { | |
632 t7_set_field_to_primary(); | |
633 } | |
634 } | |
635 } | |
636 | |
637 if(cview) | |
638 { | |
639 tHome_tick_count_cview++; | |
640 if(tHome_tick_count_cview > (cview *10)) | |
641 { | |
642 tHome_tick_count_cview = 0; | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
777
diff
changeset
|
643 if (settingsGetPointer()->design == 7 && !t7_isTimerRunning(false)) { |
38 | 644 t7_set_customview_to_primary(); |
645 } | |
541
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
646 if(settingsGetPointer()->design == 3) |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
647 { |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
648 t3_set_customview_to_primary(); |
6fbf7cd391cb
Added default view selection and auto return to view to t3 visualization:
Ideenmodellierer
parents:
516
diff
changeset
|
649 } |
38 | 650 } |
651 } | |
576 | 652 |
810
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
653 if((stateUsed->mode == MODE_SURFACE) && (!t7_customview_disabled(CVIEW_sensors))) |
576 | 654 { |
655 tHome_tick_count_o2sens++; | |
656 if(tHome_tick_count_o2sens > AUTORETURN_O2SENS) | |
657 { | |
658 tHome_tick_count_o2sens = 0; | |
810
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
659 if((stateUsed->chargeStatus == CHARGER_off) |
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
660 || (stateUsed->lifeData.ppO2Sensor_bar[0] != 0.0) |
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
661 || (stateUsed->lifeData.ppO2Sensor_bar[1] != 0.0) |
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
662 || (stateUsed->lifeData.ppO2Sensor_bar[2] != 0.0)) |
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
663 { |
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
664 t7_select_customview(CVIEW_sensors); |
e6827fcd7604
Only jump to Sensor view during charging if sensors are connected:
Ideenmodellierer
parents:
805
diff
changeset
|
665 } |
576 | 666 } |
667 } | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
777
diff
changeset
|
668 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
777
diff
changeset
|
669 t7_tick(); |
38 | 670 } |
671 | |
672 | |
673 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput) | |
674 { | |
675 uint32_t answer = 0; | |
676 | |
677 answer = 0; | |
678 answer += (dateInput->Year & 0x7F)<< 9; | |
679 answer += (dateInput->Month & 0x0F)<< 5; | |
680 answer += (dateInput->Date & 0x1F); | |
681 | |
682 return answer; | |
683 } | |
684 | |
685 | |
686 uint8_t tHome_gas_writer(uint8_t oxygen_percentage, uint8_t helium_percentage, char *text) | |
687 { | |
688 if(oxygen_percentage == 100) | |
689 return (uint8_t) snprintf(text,10,"Oxy"); | |
690 else if((oxygen_percentage == 21) && (!helium_percentage)) | |
691 return (uint8_t) snprintf(text,10,"Air"); | |
692 else if(!helium_percentage) | |
693 return (uint8_t) snprintf(text,10,"NX%02i",oxygen_percentage); | |
694 else if((oxygen_percentage + helium_percentage) == 100) | |
695 return (uint8_t) snprintf(text,10,"HX%02i",oxygen_percentage); | |
696 else | |
697 return (uint8_t) snprintf(text,10,"%02i/%02i",oxygen_percentage,helium_percentage); | |
698 } | |
699 | |
700 uint8_t tHome_show_lost_connection_count(GFX_DrawCfgScreen *ScreenToWriteOn) | |
701 { | |
208 | 702 static uint8_t LastKnowRTEState = SPI_RX_STATE_INVALID; |
703 | |
99 | 704 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
|
705 if(DataEX_lost_connection_count()>=SPI_MIN_ERROR_SHOW && SPI_SHOW_SYNC_STATS){ |
38 | 706 |
99 | 707 char text[64]; |
38 | 708 |
82 | 709 SDataExchangeSlaveToMaster* dataIn=get_dataInPointer(); |
208 | 710 SDataReceiveFromMaster* pDataOut = dataOutGetPointer(); |
82 | 711 |
493
b560e474e319
Added possibility to switch between "classic" bigfont views and a selection with a new information combination
Ideenmodellierer
parents:
386
diff
changeset
|
712 snprintf(text,32,"spi err:\002 %ld/%ld",DataEX_lost_connection_count(),get_num_SPI_CALLBACKS()); |
99 | 713 Gfx_write_label_var(ScreenToWriteOn, 100,300, 0,&FontT24,CLUT_ButtonSymbols,text); |
82 | 714 |
104 | 715 // 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]); |
716 // Gfx_write_label_var(ScreenToWriteOn, 350,550, 0,&FontT24,CLUT_ButtonSymbols,text); | |
82 | 717 |
208 | 718 //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]); |
719 | |
720 /* data shifted => ignore received data */ | |
721 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)) | |
722 { | |
723 dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE] = LastKnowRTEState; | |
724 } | |
725 else | |
726 { | |
727 LastKnowRTEState =dataIn->header.checkCode[SPI_HEADER_INDEX_RX_STATE]; | |
728 } | |
729 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 | 730 Gfx_write_label_var(ScreenToWriteOn, 600,800, 0,&FontT24,CLUT_ButtonSymbols,text); |
731 } | |
82 | 732 |
99 | 733 |
734 | |
735 // snprintf(text,32,"cpt:\002%i",get_num_SPI_CALLBACKS()); | |
736 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
82 | 737 |
738 // snprintf(text,10,"i2c:\002%i",get_DataEX_Error_place()); | |
739 // Gfx_write_label_var(ScreenToWriteOn, 600,800, 90,&FontT24,CLUT_ButtonSymbols,text); | |
38 | 740 |
741 return DataEX_lost_connection_count(); | |
742 } |