comparison Discovery/Src/tHome.c @ 773:2c243233c999

Menu shortcut for bailout / return to circuit when diving in CCR mode (mikeller)
author heinrichsweikamp
date Wed, 10 May 2023 16:24:57 +0200
parents 4a6bffaa38b3
children 6169309d6eb9
comparison
equal deleted inserted replaced
772:b7e43b28bee1 773:2c243233c999
155 { 155 {
156 t7_refresh_sleepmode_fun(); 156 t7_refresh_sleepmode_fun();
157 } 157 }
158 158
159 159
160 static void checkSetStateSim(SSettings *settings)
161 {
162 if (is_stateUsedSetToSim()) {
163 if (settings->design != 3) {
164 set_globalState(StDSIM1);
165 } else {
166 #ifdef ENABLE_T3_PPO_SIM
167 if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x01 == 0) {
168 set_globalState(StDSIM1);
169 } else if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x02 == 0) {
170 set_globalState(StDSIM3);
171 } else if (stateUsed->diveSettings.ppo2sensors_deactivated & 0x04 == 0) {
172 set_globalState(StDSIM5);
173 } else {
174 set_globalState(StD);
175 }
176 #endif
177 }
178 } else {
179 set_globalState(StD);
180 }
181 }
182
183
160 void tHomeDiveMenuControl(uint8_t sendAction) 184 void tHomeDiveMenuControl(uint8_t sendAction)
161 { 185 {
186 SSettings *settings = settingsGetPointer();
187
162 if(sendAction == ACTION_BUTTON_NEXT) 188 if(sendAction == ACTION_BUTTON_NEXT)
163 { 189 {
164 if(settingsGetPointer()->design == 4) 190 if(settingsGetPointer()->design == 4)
165 return; 191 return;
166 192
243 case StDMSPT: 269 case StDMSPT:
244 set_globalState(StDMENU); 270 set_globalState(StDMENU);
245 break; 271 break;
246 272
247 case StDMENU: 273 case StDMENU:
248 if(is_stateUsedSetToSim()) 274 if (settings->design == 7 && isLoopMode(settings->dive_mode)) {
249 { 275 set_globalState(StDBAILOUT);
250 if(settingsGetPointer()->design != 3) 276
251 { 277 break;
252 set_globalState(StDSIM1); 278 }
253 } 279
254 else 280 checkSetStateSim(settings);
255 { 281
256 #ifdef ENABLE_T3_PPO_SIM 282 break;
257 if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x01) == 0) 283 case StDBAILOUT:
258 { 284 checkSetStateSim(settings);
259 set_globalState(StDSIM1); 285
260 } 286 break;
261 else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x02) == 0)
262 {
263 set_globalState(StDSIM3);
264 }
265 else if((stateUsed->diveSettings.ppo2sensors_deactivated & 0x04) == 0)
266 {
267 set_globalState(StDSIM5);
268 }
269 else
270 {
271 set_globalState(StD);
272 }
273 #endif
274 }
275 }
276
277 else
278 set_globalState(StD);
279 break;
280
281 case StDSIM1: 287 case StDSIM1:
282 set_globalState(StDSIM2); 288 set_globalState(StDSIM2);
283 break; 289 break;
284 290
285 case StDSIM2: 291 case StDSIM2:
396 return; 402 return;
397 403
398 switch(get_globalState()) 404 switch(get_globalState())
399 { 405 {
400 case StDMGAS: 406 case StDMGAS:
401 openEdit_DiveSelectBetterGas(); 407 openEdit_DiveSelectBetterGas(false);
402 set_globalState(StD); 408 set_globalState(StD);
403 break; 409 break;
404 case StDMSPT: 410 case StDMSPT:
405 openEdit_DiveSelectBetterSetpoint(); 411 openEdit_DiveSelectBetterSetpoint(false);
406 set_globalState(StD); 412 set_globalState(StD);
407 break; 413 break;
408 414
409 case StDMENU: 415 case StDMENU:
410 openMenu_first_page_with_OC_gas_update(); 416 openMenu_first_page_with_OC_gas_update();
462 break; 468 break;
463 case StDSIM6: 469 case StDSIM6:
464 Sim_DecreasePPO(2); 470 Sim_DecreasePPO(2);
465 break; 471 break;
466 #endif 472 #endif
473 case StDBAILOUT:
474 if (isLoopMode(stateUsed->diveSettings.diveMode)) {
475 tMEGas_check_switch_to_bailout();
476
477 openEdit_DiveSelectBetterGas(true);
478 } else {
479 checkSwitchToLoop();
480
481 openEdit_DiveSelectBetterSetpoint(true);
482 }
483
484 set_globalState(StD);
485
486 break;
467 case StDBEAR: // t5_gauge 487 case StDBEAR: // t5_gauge
468 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading; 488 stateUsedWrite->diveSettings.compassHeading = (uint16_t)stateUsed->lifeData.compass_heading;
469 set_globalState(StD); 489 set_globalState(StD);
470 break; 490 break;
471 491