# HG changeset patch # User Ideenmodellierer # Date 1714922848 -7200 # Node ID ba1aebc6d5af89c3cd510c0ed0f780b6c210541c # Parent af035b8833827973bb0619b13113d6ef9ca8f07d Developer feature debug warning: The debug warnings are only available to developers who activate the feature via compile switch. After that it is possible to define a condition and a content of a warning which will be shown if a special situation occure (visualized in the main view as already done for other warnings like ppo2). In the first implementation details regarding the error state of the DiveO2 will be shown in case the sensor reports a problem. Feel free to change the implementation in case you want to observe another behavior. diff -r af035b883382 -r ba1aebc6d5af Common/Inc/configuration.h --- a/Common/Inc/configuration.h Sun May 05 17:20:56 2024 +0200 +++ b/Common/Inc/configuration.h Sun May 05 17:27:28 2024 +0200 @@ -48,6 +48,9 @@ /* Enable to have access to the debug view options (turn on / off via menu instead of compile switch) */ /* #define HAVE_DEBUG_VIEW */ +/* Enable to have event based warnings being displayed as warning messages when the occure */ +#define HAVE_DEBUG_WARNINGS + /* Enable to have access to the motion control selection menu */ /* #define ENABLE_MOTION_CONTROL */ diff -r af035b883382 -r ba1aebc6d5af Common/Inc/data_central.h --- a/Common/Inc/data_central.h Sun May 05 17:20:56 2024 +0200 +++ b/Common/Inc/data_central.h Sun May 05 17:27:28 2024 +0200 @@ -276,6 +276,9 @@ #ifdef ENABLE_BOTTLE_SENSOR int8_t newPressure; #endif +#ifdef HAVE_DEBUG_WARNINGS + int8_t debug; +#endif } SWarnings; diff -r af035b883382 -r ba1aebc6d5af Discovery/Src/check_warning.c --- a/Discovery/Src/check_warning.c Sun May 05 17:20:56 2024 +0200 +++ b/Discovery/Src/check_warning.c Sun May 05 17:27:28 2024 +0200 @@ -72,6 +72,10 @@ static int8_t check_co2(SDiveState * pDiveState); #endif static int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2); +#ifdef HAVE_DEBUG_WARNINGS +static int8_t check_debug(SDiveState * pDiveState); +#endif + /* Exported functions --------------------------------------------------------*/ @@ -101,6 +105,9 @@ #ifdef ENABLE_CO2_SUPPORT pDiveState->warnings.numWarnings += check_co2(pDiveState); #endif +#ifdef HAVE_DEBUG_WARNINGS + pDiveState->warnings.numWarnings += check_debug(pDiveState); +#endif } @@ -597,6 +604,27 @@ } #endif +#ifdef HAVE_DEBUG_WARNINGS +static int8_t check_debug(SDiveState * pDiveState) +{ + uint8_t index = 0; + + pDiveState->warnings.debug = 0; + + if((settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL) || (settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG)) + { + for(index=0; index<3; index++) + { + if(((pDiveState->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR))) + { + pDiveState->warnings.debug = 1; + } + } + } + return pDiveState->warnings.debug; +} +#endif + uint8_t debounce_warning_fallback(uint16_t debounceStepms) { uint8_t retVal = 0; diff -r af035b883382 -r ba1aebc6d5af Discovery/Src/t3.c --- a/Discovery/Src/t3.c Sun May 05 17:20:56 2024 +0200 +++ b/Discovery/Src/t3.c Sun May 05 17:27:28 2024 +0200 @@ -1514,6 +1514,7 @@ { char text[256], textMain[256]; uint8_t textpointer, textpointerMain, lineFree, more; + uint8_t index = 0; snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); GFX_write_string(&FontT42,&t3c1,text,0); @@ -1635,7 +1636,19 @@ more++; } } - +#ifdef HAVE_DEBUG_WARNINGS + if(lineFree && stateUsed->warnings.debug) + { + for(index=0; index<3; index++) + { + if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR))) + { + textpointer += snprintf(&text[textpointer],32,"\001Debug: %lx\n",((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status); + } + } + lineFree--; + } +#endif text[textpointer] = 0; textMain[textpointerMain] = 0; diff -r af035b883382 -r ba1aebc6d5af Discovery/Src/t7.c --- a/Discovery/Src/t7.c Sun May 05 17:20:56 2024 +0200 +++ b/Discovery/Src/t7.c Sun May 05 17:27:28 2024 +0200 @@ -1419,6 +1419,9 @@ count++; } #endif +#ifdef HAVE_DEBUG_WARNINGS + count += stateUsed->warnings.debug; +#endif return count; } @@ -1490,6 +1493,7 @@ { char text[256]; uint8_t textpointer, lineFree; + uint8_t index = 0; text[0] = '\025'; text[1] = '\f'; @@ -1576,6 +1580,19 @@ lineFree--; } #endif +#ifdef HAVE_DEBUG_WARNINGS + if(lineFree && stateUsed->warnings.debug) + { + for(index=0; index<3; index++) + { + if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR))) + { + textpointer += snprintf(&text[textpointer],32,"\001Debug: %lx\n",((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status); + } + } + lineFree--; + } +#endif /* if(lineFree && stateUsed->warnings.lowBattery) {