comparison Discovery/Src/tHome.c @ 576:1105cf7bbf6f

Return to o2 values: In surface mode the custom view will now reset to the o2 sensor display if sensors are connected and no button has been pressed for 20 seconds
author Ideenmodellierer
date Sun, 29 Nov 2020 22:55:31 +0100
parents 6960df7ddb09
children 280c11153080
comparison
equal deleted inserted replaced
575:86c4baa6ba29 576:1105cf7bbf6f
54 /* Private variables ---------------------------------------------------------*/ 54 /* Private variables ---------------------------------------------------------*/
55 static uint8_t warning_toogle_count; 55 static uint8_t warning_toogle_count;
56 static uint16_t display_toogle_count; 56 static uint16_t display_toogle_count;
57 static uint16_t tHome_tick_count_cview; 57 static uint16_t tHome_tick_count_cview;
58 static uint16_t tHome_tick_count_field; 58 static uint16_t tHome_tick_count_field;
59 static uint16_t tHome_tick_count_o2sens;
59 60
60 const uint8_t cv_changelist[] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist, CVIEW_noneOrDebug, CVIEW_Decolist,CVIEW_sensors,CVIEW_sensors_mV, CVIEW_END}; 61 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};
61 const uint8_t cv_changelist_BS[] = {CVIEW_T3_Decostop, CVIEW_sensors, CVIEW_Compass, CVIEW_T3_MaxDepth,CVIEW_T3_StopWatch, CVIEW_T3_TTS, CVIEW_T3_GasList, CVIEW_T3_ppO2andGas, CVIEW_noneOrDebug, CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_DecoTTS, CVIEW_T3_END}; 62 const uint8_t cv_changelist_BS[] = {CVIEW_T3_Decostop, CVIEW_sensors, CVIEW_Compass, CVIEW_T3_MaxDepth,CVIEW_T3_StopWatch, CVIEW_T3_TTS, CVIEW_T3_GasList, CVIEW_T3_ppO2andGas, CVIEW_noneOrDebug, CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_DecoTTS, CVIEW_T3_END};
62 63
63 /* Private function prototypes -----------------------------------------------*/ 64 /* Private function prototypes -----------------------------------------------*/
65
66 #define AUTORETURN_O2SENS (200u) /* return to sensor view after 20 seconds in case sensor is connected */
67
64 68
65 /* Exported functions --------------------------------------------------------*/ 69 /* Exported functions --------------------------------------------------------*/
66 70
67 void set_globalState_tHome(void) 71 void set_globalState_tHome(void)
68 { 72 {
367 371
368 372
369 void tHome_change_field_button_pressed(void) 373 void tHome_change_field_button_pressed(void)
370 { 374 {
371 tHome_tick_count_field = 0; 375 tHome_tick_count_field = 0;
376 tHome_tick_count_o2sens = 0;
372 if(settingsGetPointer()->design == 7) 377 if(settingsGetPointer()->design == 7)
373 t7_change_field(); 378 t7_change_field();
374 } 379 }
375 380
376 381
377 void tHome_change_customview_button_pressed(uint8_t action) 382 void tHome_change_customview_button_pressed(uint8_t action)
378 { 383 {
379 tHome_tick_count_cview = 0; 384 tHome_tick_count_cview = 0;
385 tHome_tick_count_o2sens = 0;
386
380 if(settingsGetPointer()->design == 7) 387 if(settingsGetPointer()->design == 7)
381 t7_change_customview(action); 388 t7_change_customview(action);
382 else 389 else
383 if(settingsGetPointer()->design == 3) 390 if(settingsGetPointer()->design == 3)
384 t3_change_customview(action); 391 t3_change_customview(action);
437 if(settingsGetPointer()->design == 3) 444 if(settingsGetPointer()->design == 3)
438 { 445 {
439 t3_set_customview_to_primary(); 446 t3_set_customview_to_primary();
440 } 447 }
441 } 448 }
449 }
450
451 if((stateUsed->mode == MODE_SURFACE) && (stateUsed->diveSettings.ppo2sensors_deactivated != 0x07) && (stateUsed->diveSettings.ccrOption != 0))
452 {
453 tHome_tick_count_o2sens++;
454 if(tHome_tick_count_o2sens > AUTORETURN_O2SENS)
455 {
456 tHome_tick_count_o2sens = 0;
457 t7_select_customview(CVIEW_sensors);
458 }
442 } 459 }
443 } 460 }
444 461
445 462
446 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput) 463 uint32_t tHome_DateCode(RTC_DateTypeDef *dateInput)