# HG changeset patch # User Ideenmodellierer # Date 1607802778 -3600 # Node ID 64bf41faab83c34ae5c0016ba06dcec99e78f777 # Parent 011d8f9f5ddbee88987d5b3874802d32db4fbacf Show Fallback if no valid sensor value is available: In previous version fallback was shown when communication to HUD was lost. Now it will be displayed in case no sensor value ist judged as valid. In case of a fallback event ppo2 warnings as well as the data readings are no longer displayed. diff -r 011d8f9f5ddb -r 64bf41faab83 Discovery/Inc/t3.h --- a/Discovery/Inc/t3.h Sat Dec 12 19:18:57 2020 +0100 +++ b/Discovery/Inc/t3.h Sat Dec 12 20:52:58 2020 +0100 @@ -35,9 +35,10 @@ /* Exported functions --------------------------------------------------------*/ void t3_init(void); void t3_refresh(void); -void t3_change_customview(uint8_t action); +uint8_t t3_change_customview(uint8_t action); uint8_t t3_GetEnabled_customviews(void); uint8_t t3_getCustomView(void); void t3_set_customview_to_primary(void); +uint8_t t3_customview_disabled(uint8_t view); #endif /* T3_H */ diff -r 011d8f9f5ddb -r 64bf41faab83 Discovery/Inc/tCCR.h --- a/Discovery/Inc/tCCR.h Sat Dec 12 19:18:57 2020 +0100 +++ b/Discovery/Inc/tCCR.h Sat Dec 12 20:52:58 2020 +0100 @@ -31,6 +31,9 @@ /* Includes ------------------------------------------------------------------*/ #include + +#define IGNORE_O2_VOLTAGE_LEVEL_MV (1.0f) + /* Exported functions --------------------------------------------------------*/ void tCCR_init(void); diff -r 011d8f9f5ddb -r 64bf41faab83 Discovery/Src/check_warning.c --- a/Discovery/Src/check_warning.c Sat Dec 12 19:18:57 2020 +0100 +++ b/Discovery/Src/check_warning.c Sat Dec 12 20:52:58 2020 +0100 @@ -133,7 +133,7 @@ static int8_t check_ppO2(SDiveState * pDiveState) { - if(pDiveState->mode != MODE_DIVE) + if((pDiveState->mode != MODE_DIVE) || (pDiveState->warnings.fallback)) { pDiveState->warnings.ppO2Low = 0; pDiveState->warnings.ppO2High = 0; diff -r 011d8f9f5ddb -r 64bf41faab83 Discovery/Src/t3.c --- a/Discovery/Src/t3.c Sat Dec 12 19:18:57 2020 +0100 +++ b/Discovery/Src/t3.c Sat Dec 12 20:52:58 2020 +0100 @@ -689,6 +689,8 @@ void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) { + static uint8_t last_customview = CVIEW_END; + char text[512]; uint16_t textpointer = 0; @@ -757,6 +759,14 @@ { heading = (uint16_t)stateUsed->lifeData.compass_heading; } + if(last_customview != tX_selection_customview) /* check if current selection is disabled and should be skipped */ + { + if(t3_customview_disabled(tX_selection_customview)) + { + tX_selection_customview = t3_change_customview(ACTION_BUTTON_ENTER); + } + last_customview = tX_selection_customview; + } switch(tX_selection_customview) { @@ -1413,7 +1423,7 @@ } if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && - ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0))) + ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || stateUsed->warnings.fallback)) { cv_disabled = 1; } @@ -1421,10 +1431,11 @@ return cv_disabled; } -void t3_change_customview(uint8_t action) +uint8_t t3_change_customview(uint8_t action) { t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action); + return t3_selection_customview; } diff -r 011d8f9f5ddb -r 64bf41faab83 Discovery/Src/t7.c --- a/Discovery/Src/t7.c Sat Dec 12 19:18:57 2020 +0100 +++ b/Discovery/Src/t7.c Sat Dec 12 20:52:58 2020 +0100 @@ -1594,7 +1594,7 @@ } if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && - ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0))) + ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0) || (stateUsed->warnings.fallback))) { cv_disabled = 1; } @@ -1708,6 +1708,7 @@ { t7_change_customview(ACTION_BUTTON_ENTER); } + last_customview = selection_customview; } switch(selection_customview) { diff -r 011d8f9f5ddb -r 64bf41faab83 Discovery/Src/tCCR.c --- a/Discovery/Src/tCCR.c Sat Dec 12 19:18:57 2020 +0100 +++ b/Discovery/Src/tCCR.c Sat Dec 12 20:52:58 2020 +0100 @@ -193,8 +193,6 @@ if(!sensorActive[2]) *outOfBouds3 = 1; - - return; } else { @@ -264,6 +262,7 @@ } } } + } @@ -272,6 +271,7 @@ int8_t sensorOutOfBound[3]; uint16_t result = 0; uint8_t count = 0; + uint8_t retVal = 0; test_O2_sensor_values_outOfBounds(&sensorOutOfBound[0], &sensorOutOfBound[1], &sensorOutOfBound[2]); @@ -284,9 +284,14 @@ } } if(count == 0) // all sensors out of bounds! - return 0; + { + set_warning_fallback(); + } else - return (uint8_t)(result / count); + { + retVal = (uint8_t)(result / count); + } + return retVal; }