Mercurial > public > ostc4
diff Discovery/Src/data_exchange_main.c @ 702:6d7c812fc173
Added digital o2 sensor to settings and data exchange:
Added functionality to pass the o2 signals from a digital sensor (via UART)
author | Ideenmodellierer |
---|---|
date | Fri, 28 Oct 2022 20:29:37 +0200 |
parents | 52d68cf9994c |
children | 74cfd91199bd |
line wrap: on
line diff
--- a/Discovery/Src/data_exchange_main.c Fri Oct 28 19:39:20 2022 +0200 +++ b/Discovery/Src/data_exchange_main.c Fri Oct 28 20:29:37 2022 +0200 @@ -393,11 +393,16 @@ - if(settings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) + if((settings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (settings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG)) { externalInterface_Cmd |= EXT_INTERFACE_ADC_ON | EXT_INTERFACE_33V_ON; } + if((settings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL) || (settings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG)) + { + externalInterface_Cmd |= EXT_INTERFACE_33V_ON | EXT_INTERFACE_UART_O2; + } + #ifdef ENABLE_SENTINEL_MODE if(settings->ppo2sensors_source == O2_SENSOR_SOURCE_SENTINEL) { @@ -947,7 +952,14 @@ } else { - pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] * pSettings->ppo2sensors_calibCoeff[idx]; + if((idx == 0) && ((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG))) + { + pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] / 100.0; + } + else + { + pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] * pSettings->ppo2sensors_calibCoeff[idx]; + } } }