Index: firmware/App/Controllers/ConductivitySensors.c =================================================================== diff -u -r721bd715bef050760e5c0f79044d1cba642c8354 -re6a5b70e931c5447c87c79b83e8acd9834e84bec --- firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 721bd715bef050760e5c0f79044d1cba642c8354) +++ firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision e6a5b70e931c5447c87c79b83e8acd9834e84bec) @@ -85,6 +85,8 @@ #define COND_SENSORS_FPGA_ERROR_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Conductivity sensors FPGA error timeout in milliseconds. #define COND_SENSORS_BAD_CHAR_TIME_OUT_MS ( 2 * MS_PER_SECOND ) ///< Conductivity sensor bad received character timeout in milliseconds. +#define MIN_CPI_CPO_COND_VALUES_AFTER_CALS_US_PER_CM 20.0F ///< Minimum allowed CPi and CPo conductivity values after calculations in uS/cm. + #pragma pack(push,1) /// Emstat pico measurement data package structure typedef struct @@ -730,9 +732,19 @@ F32 temperature = getTemperatureValue( readPackage->sensors[ boardSensorIndex ].condSnsrTempSnsr ); F32 conductivity = ( 1.0F / resistance ) * SIEMENS_TO_MICROSIEMENS_CONVERSION; F32 compensatedCond = calcCompensatedConductivity( sensorId, conductivity, temperature ); + F32 calAppliedCond = getCalibrationAppliedConductivityValue( sensorId, compensatedCond ); + if ( ( CONDUCTIVITYSENSORS_CPI_SENSOR == sensorId ) || ( CONDUCTIVITYSENSORS_CPO_SENSOR == sensorId ) ) + { + // If the CPi or CPo sensors values < 20 uS/cm after compensation and calibration, they are set to 20 uS/cm. + if ( calAppliedCond < MIN_CPI_CPO_COND_VALUES_AFTER_CALS_US_PER_CM ) + { + calAppliedCond = MIN_CPI_CPO_COND_VALUES_AFTER_CALS_US_PER_CM; + } + } + condSensorStatus[ sensorId ].internalErrorCount = 0; - condSensorStatus[ sensorId ].compensatedCondValue.data = getCalibrationAppliedConductivityValue( sensorId, compensatedCond ); + condSensorStatus[ sensorId ].compensatedCondValue.data = calAppliedCond; condSensorStatus[ sensorId ].rawCondValue = conductivity; }