Mercurial > public > ostc4
changeset 1070:4499227a2db8 Icon_Integration
Added compile option for o2/diluent pressure display:
Some external devices (like the RedBare rebreather) provide pressure sensor information o2 and diluent bottles. A data channel from RTE to main CPU has been defined and a visualization has been added to the lower left corner (llc). Pressure will be displayed in the gas list as well => for o2 display the definition of a 100% o2 gas is needed. Diluent will be assigned to the first gas. The ADVANCED_GAS compile switch needs to be activated for this feature
| author | Ideenmodellierer |
|---|---|
| date | Thu, 19 Feb 2026 13:17:25 +0100 |
| parents | e0ba2b29dc1f |
| children | b4a79464caf7 |
| files | Common/Inc/configuration.h Common/Inc/data_exchange.h Discovery/Inc/data_exchange_main.h Discovery/Inc/t7.h Discovery/Inc/tStructure.h Discovery/Src/data_exchange_main.c Discovery/Src/simulation.c Discovery/Src/t7.c |
| diffstat | 8 files changed, 88 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Common/Inc/configuration.h Tue Feb 17 20:46:45 2026 +0100 +++ b/Common/Inc/configuration.h Thu Feb 19 13:17:25 2026 +0100 @@ -111,5 +111,7 @@ /* Enable to have the possibility to switch between four individual sets of settings */ /* #define ENABLE_SETTING_PROFILES */ +/* Enable to have advanced gas information lite bottle size and pressure available */ +/* #define ENABLE_ADVANCED_GAS */ #endif
--- a/Common/Inc/data_exchange.h Tue Feb 17 20:46:45 2026 +0100 +++ b/Common/Inc/data_exchange.h Thu Feb 19 13:17:25 2026 +0100 @@ -58,6 +58,8 @@ #define GNSS_ALIVE_STATE_TIME (0x02u) /* Time information valid */ #define GNSS_ALIVE_BACKUP_POS (0x04u) /* Backup position not older than x hours */ +#define PRESSURE_BOTTLE_CNT (0x2u) /* Number of bottle information (max 255 bar) */ + enum MODE { MODE_SURFACE = 0, @@ -196,7 +198,8 @@ uint8_t externalInterface_SensorID; /* Used to identify how to read the sensor data array */ uint8_t sensor_data[EXTIF_SENSOR_INFO_SIZE]; /* sensor specific data array. Content may vary from sensor type to sensor type */ uint8_t sensor_map[EXT_INTERFACE_SENSOR_CNT]; - uint8_t SPARE_OldWireless[5]; /* 64 - 12 for extADC - 6 for CO2 - 34 for sensor (+dummmy) - sensor map*/ + uint8_t pressure_bottle[PRESSURE_BOTTLE_CNT]; + uint8_t SPARE_OldWireless[3]; /* 64 - 12 for extADC - 6 for CO2 - 34 for sensor (+dummmy) - sensor map - pressure*/ // PIC data uint8_t button_setting[4]; /* see dependency to SlaveData->buttonPICdata */ uint8_t SPARE1;
--- a/Discovery/Inc/data_exchange_main.h Tue Feb 17 20:46:45 2026 +0100 +++ b/Discovery/Inc/data_exchange_main.h Thu Feb 19 13:17:25 2026 +0100 @@ -51,6 +51,7 @@ uint8_t DataEX_check_RTE_version__needs_update(void); void setAvgDepth(SDiveState *pStateReal); uint8_t DataEX_external_ADC_Present(void); +void DataEX_helper_Get_ID_Of_O2_Diluent(uint8_t* pIdO2, uint8_t* pIdDiluent); SDataReceiveFromMaster * dataOutGetPointer(void);
--- a/Discovery/Inc/t7.h Tue Feb 17 20:46:45 2026 +0100 +++ b/Discovery/Inc/t7.h Thu Feb 19 13:17:25 2026 +0100 @@ -49,7 +49,7 @@ LLC_GF, LCC_GF_SURF, LLC_ScrubberTime, -#ifdef ENABLE_BOTTLE_SENSOR +#if defined (ENABLE_BOTTLE_SENSOR) || defined (ENABLE_ADVANCED_GAS) LCC_BottleBar, #endif #ifdef ENABLE_PSCR_MODE
--- a/Discovery/Inc/tStructure.h Tue Feb 17 20:46:45 2026 +0100 +++ b/Discovery/Inc/tStructure.h Thu Feb 19 13:17:25 2026 +0100 @@ -133,8 +133,10 @@ #define StMOG_GasType _MB(2,1,255,2,0) #define StMOG_ChangeDepth _MB(2,1,255,3,0) #define StMOG_SetToMOD _MB(2,1,255,4,0) -#define StMOG_CalcDeco _MB(2,1,255,5,0) -/* #define StMOG_Bottle _MB(2,1,255,5,0) */ + +#ifdef ENABLE_ADVANCED_GAS +#define StMOG_Bottle _MB(2,1,255,5,0) +#endif #define StMOG_MOD _MB(2,1,255,9,0)
--- a/Discovery/Src/data_exchange_main.c Tue Feb 17 20:46:45 2026 +0100 +++ b/Discovery/Src/data_exchange_main.c Thu Feb 19 13:17:25 2026 +0100 @@ -632,6 +632,27 @@ } +void DataEX_helper_Get_ID_Of_O2_Diluent(uint8_t* pIdO2, uint8_t* pIdDiluent) +{ + const SDiveState *pStateReal = stateRealGetPointer(); + uint8_t index = 0; + + *pIdO2 = 0xff; + *pIdDiluent = 0xff; + + for (index = NUM_GASES; index <= NUM_GASES*2; index++) /* search for o2 and start gas in diluent table */ + { + if(pStateReal->diveSettings.gas[index].note.ub.first) + { + *pIdDiluent = index; + } + if(pStateReal->diveSettings.gas[index].oxygen_percentage >= 99) + { + *pIdO2 = index; + } + } +} + static uint8_t DataEX_helper_Check_And_Correct_Value_deviceData(SDeviceLine *lineWrite, int32_t from, int32_t to, uint8_t defaulttofrom) { uint8_t retval = 0; @@ -847,6 +868,9 @@ static uint16_t getDeviceDataAfterStartOfMainCPU = 20; static uint16_t lastcounterSecondsShallowDepth = 0; + static uint8_t pressureIdO2 = 0xFF; + static uint8_t pressureIdDiluent = 0xFF; + SDiveState *pStateReal = stateRealGetPointerWrite(); uint8_t idx; float meter = 0; @@ -1007,7 +1031,6 @@ if(pStateReal->data_old__lost_connection_to_slave == 0) { - pStateReal->lifeData.extIf_sensor_Id = dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].externalInterface_SensorID; if(pStateReal->lifeData.extIf_sensor_Id < 3) { @@ -1016,7 +1039,6 @@ } memcpy(pStateReal->lifeData.extIf_sensor_map, dataIn.data[(dataIn.boolADCO2Data && DATA_BUFFER_ADC)].sensor_map, EXT_INTERFACE_SENSOR_CNT); - meter = getSampleDepth(&dataIn, pStateReal); pStateReal->pressure_uTick_old = pStateReal->pressure_uTick_new; @@ -1027,6 +1049,22 @@ pStateReal->lifeData.timeBinaryFormat = dataIn.data[dataIn.boolTimeData].localtime_rtc_tr; memcpy(&pStateReal->lifeData.gnssData, &dataIn.data[0].gnssInfo, sizeof(dataIn.data[0].gnssInfo)); + + if((dataIn.data[dataIn.boolPressureData].pressure_bottle[0] != 0) || (dataIn.data[dataIn.boolPressureData].pressure_bottle[1] != 0)) + { + if((pressureIdO2 == 0xFF) || (pressureIdDiluent == 0xFF)) + { + DataEX_helper_Get_ID_Of_O2_Diluent(&pressureIdO2, &pressureIdDiluent); + } + if(pressureIdO2 != 0xFF) + { + pStateReal->lifeData.bottle_bar[pressureIdO2] = dataIn.data[dataIn.boolPressureData].pressure_bottle[0]; + } + if(pressureIdDiluent != 0xFF) + { + pStateReal->lifeData.bottle_bar[pressureIdDiluent] = dataIn.data[dataIn.boolPressureData].pressure_bottle[1]; + } + } } if(pStateReal->data_old__lost_connection_to_slave == 0)
--- a/Discovery/Src/simulation.c Tue Feb 17 20:46:45 2026 +0100 +++ b/Discovery/Src/simulation.c Thu Feb 19 13:17:25 2026 +0100 @@ -225,6 +225,12 @@ pDiveState->lifeData.bottle_bar[pDiveState->lifeData.actualGas.GasIdInSettings] = pRealState->lifeData.bottle_bar[pRealState->lifeData.actualGas.GasIdInSettings]; pDiveState->lifeData.bottle_bar_age_MilliSeconds[pDiveState->lifeData.actualGas.GasIdInSettings] = pRealState->lifeData.bottle_bar_age_MilliSeconds[pRealState->lifeData.actualGas.GasIdInSettings]; #endif +#ifdef ENABLE_ADVANCED_GAS + for(index = 0; index < NUM_GASES * 2; index++) + { + pDiveState->lifeData.bottle_bar[index] = pRealState->lifeData.bottle_bar[index]; + } +#endif } else if(pDiveState->lifeData.depth_meter <= (float)(decom_get_actual_deco_stop(pDiveState) + 0.001)) {
--- a/Discovery/Src/t7.c Tue Feb 17 20:46:45 2026 +0100 +++ b/Discovery/Src/t7.c Thu Feb 19 13:17:25 2026 +0100 @@ -3255,7 +3255,10 @@ #ifdef ENABLE_BOTTLE_SENSOR uint16_t agedColor = 0; #endif - +#ifdef ENABLE_ADVANCED_GAS + static uint8_t gasIdO2 = 0; + static uint8_t gasIdDiluent = 0; +#endif SDivetime Stopwatch = {0,0,0,0}; float fAverageDepth, fAverageDepthAbsolute; const SDecoinfo * pDecoinfoStandard; @@ -3390,6 +3393,32 @@ snprintf(text,TEXTSIZE,"%d\016\016\017", stateUsed->lifeData.bottle_bar[stateUsed->lifeData.actualGas.GasIdInSettings]); break; #endif + +#ifdef ENABLE_ADVANCED_GAS + case LCC_BottleBar: + headerText[2] = TXT_AtemGasVorrat; + tinyHeaderFont = 1; + if(isLoopMode(stateUsed->diveSettings.diveMode)) + { + if((gasIdO2 == 0) && (gasIdDiluent == 0)) + { + DataEX_helper_Get_ID_Of_O2_Diluent(&gasIdO2, &gasIdDiluent); + } + if(gasIdO2 != 0) + { + textpointer = snprintf(text,TEXTSIZE,"\020\016\016%u",stateUsed->lifeData.bottle_bar[gasIdO2]); + } + if(gasIdDiluent != 0) + { + textpointer = snprintf(&text[textpointer],TEXTSIZE,"\n\r%u",stateUsed->lifeData.bottle_bar[gasIdDiluent]); + } + } + else + { + snprintf(text,TEXTSIZE,"%d\016\016\017", stateUsed->lifeData.bottle_bar[stateUsed->lifeData.actualGas.GasIdInSettings]); + } + break; +#endif #ifdef ENABLE_CO2_SUPPORT case LCC_CO2: headerText[2] = TXT_CO2Sensor;
