Index: firmware/App/Monitors/Conductivity.c =================================================================== diff -u -rff93c14403f911ff4f28815c8c89f87395079123 -rb91d956a773bcf1319f816f36b270b31c68948de --- firmware/App/Monitors/Conductivity.c (.../Conductivity.c) (revision ff93c14403f911ff4f28815c8c89f87395079123) +++ firmware/App/Monitors/Conductivity.c (.../Conductivity.c) (revision b91d956a773bcf1319f816f36b270b31c68948de) @@ -178,17 +178,8 @@ #ifdef __TEENSY_CONDUCTIVITY_DRIVER__ execConductivityTeensy(); #else - readConductivitySensorData(); + execConductivitySensors(); #endif - //control conductivity sensor - // TODO : need more clarity on why and when to execute following control. -#if 0 - handleConductivitySensorsReset(); - handleConductivitySensorsInitProcedure(); - execConductivitySensorWrite(); - execConductivitySensorRead(); -#endif - filterConductivitySensors(); calcRORejectionRatio(); // TODO: should this be called here or inside filter function filterRORejectionRatioReadings(); @@ -259,7 +250,7 @@ #ifdef __TEENSY_CONDUCTIVITY_DRIVER__ F32 rawCond = getTeensyConductivityValue( sensor ); #else - F32 rawCond = getConductivityValue( sensor ); + F32 calculatedConductivity = getConductivityValue( sensor ); #endif // TODO - calibrate @@ -268,8 +259,8 @@ { filteredConductivityReadings[ sensor ].conductivityReadingsTotal -= filteredConductivityReadings[ sensor ].conductivityReadings[ filteredConductivityReadings[ sensor ].conductivityReadingsIdx ]; } - filteredConductivityReadings[ sensor ].conductivityReadings[ filteredConductivityReadings[ sensor ].conductivityReadingsIdx ] = rawCond; - filteredConductivityReadings[ sensor ].conductivityReadingsTotal += rawCond; + filteredConductivityReadings[ sensor ].conductivityReadings[ filteredConductivityReadings[ sensor ].conductivityReadingsIdx ] = calculatedConductivity; + filteredConductivityReadings[ sensor ].conductivityReadingsTotal += calculatedConductivity; filteredConductivityReadings[ sensor ].conductivityReadingsIdx = INC_WRAP( filteredConductivityReadings[ sensor ].conductivityReadingsIdx, 0, SIZE_OF_FLOW_ROLLING_AVG - 1 ); filteredConductivityReadings[ sensor ].conductivityReadingsCount = INC_CAP( filteredConductivityReadings[ sensor ].conductivityReadingsCount, SIZE_OF_FLOW_ROLLING_AVG ); filteredcurrentConductivityReadings[ sensor ].data = filteredConductivityReadings[ sensor ].conductivityReadingsTotal / (F32)filteredConductivityReadings[ sensor ].conductivityReadingsCount; @@ -321,9 +312,9 @@ for ( sensor = FIRST_DD_COND_SENSOR; sensor < NUM_OF_CONDUCTIVITY_SENSORS; sensor++ ) { #ifdef __TEENSY_CONDUCTIVITY_DRIVER__ - F32 rawTemp = getTeensyConductivityTemperatureValue( sensor ); + F32 calculatedTemperature = getTeensyConductivityTemperatureValue( sensor ); #else - F32 rawTemp = getConductivityTemperatureValue( sensor ); + F32 calculatedTemperature = getConductivityTemperatureValue( sensor ); #endif // TODO - calibrate @@ -332,8 +323,8 @@ { filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsTotal -= filteredConductivityTemperatureReadings[sensor].conductivityTempReadings[ filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsIdx ]; } - filteredConductivityTemperatureReadings[sensor].conductivityTempReadings[ filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsIdx ] = rawTemp; - filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsTotal += rawTemp; + filteredConductivityTemperatureReadings[sensor].conductivityTempReadings[ filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsIdx ] = calculatedTemperature; + filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsTotal += calculatedTemperature; filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsIdx = INC_WRAP( filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsIdx, 0, SIZE_OF_FLOW_ROLLING_AVG - 1 ); filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsCount = INC_CAP( filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsCount, SIZE_OF_FLOW_ROLLING_AVG ); filteredcurrentTemperatureReadings[sensor].data = filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsTotal / (F32)filteredConductivityTemperatureReadings[sensor].conductivityTempReadingsCount;