Mercurial > public > ostc4
changeset 582:64bf41faab83
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.
author | Ideenmodellierer |
---|---|
date | Sat, 12 Dec 2020 20:52:58 +0100 |
parents | 011d8f9f5ddb |
children | 3860b8fa4b29 |
files | Discovery/Inc/t3.h Discovery/Inc/tCCR.h Discovery/Src/check_warning.c Discovery/Src/t3.c Discovery/Src/t7.c Discovery/Src/tCCR.c |
diffstat | 6 files changed, 30 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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 */
--- 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 <stdint.h> + +#define IGNORE_O2_VOLTAGE_LEVEL_MV (1.0f) + /* Exported functions --------------------------------------------------------*/ void tCCR_init(void);
--- 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;
--- 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; }
--- 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) {
--- 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; }