Index: firmware/App/Controllers/ConductivitySensors.c =================================================================== diff -u -rb5a2c2e9c4c33fc76ad515fd3c00ce5b937c3112 -r7e2931d9a468ca3b6e1f2bb88ef0910960dfdb29 --- firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision b5a2c2e9c4c33fc76ad515fd3c00ce5b937c3112) +++ firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 7e2931d9a468ca3b6e1f2bb88ef0910960dfdb29) @@ -33,6 +33,7 @@ #define SIEMENS_TO_MICROSIEMENS_CONVERSION 1000000 ///< Siemens to microSiemens conversion factor. +#define COND_CPI_SENSOR_PROBE_TYPE 100 ///< 1 K cell constant conductivity probe. #define COND_CPO_SENSOR_PROBE_TYPE 10 ///< 0.1 K cell constant conductivity probe. #define COND_SENSOR_DECIMAL_CONVERSION 100 ///< Conductivity value from FPGA has two decimal place. #define COND_SENSOR_TEMPERATURE_COEF 0.02 ///< Linear temperature coefficient of variation at 25 Celcius for fresh water. @@ -63,6 +64,7 @@ #define EMSTAT_PICO_MEASUREMENT_OFFSET 0x8000000 ///< Measurement offset for emstat pico measurement data. #define EMSTAT_PICO_GOOD_STATUS 0x10 ///< Measurement good status. +#define EMSTAT_PICO_FIFO_EMPTY_MASK 0x8000 ///< Emstat Pico buffer empty indication bit. #define ASCII_CODE_LETTER_A 0x41 ///< ASCII code in hex for letter A. #define ASCII_CODE_NUMBER_ZERO 0x30 ///< ASCII code in hex for number zero. @@ -114,7 +116,7 @@ static U32 hexStrToDec( U08 const * const valuePtr, U08 size ); static U32 prefixStrToSIFactor( U08 prefix ); static void processMeasurementDataPackage( U32 sensorId ); -static void processCD1CD2SensorRead( U08 fpgaReadCount, U08 fpgaErrorCount ); +static void processCD1CD2SensorRead( U16 fpgaReadCount, U08 fpgaErrorCount ); static U32 getConductivityDataPublishInterval( void ); /*********************************************************************//** @@ -140,6 +142,7 @@ compensatedConductivityValues[ i ].override = OVERRIDE_RESET; } + setFPGACPiProbeType( COND_CPI_SENSOR_PROBE_TYPE ); setFPGACPoProbeType( COND_CPO_SENSOR_PROBE_TYPE ); initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_CONDUCTIVITY_SENSOR_ERROR, MAX_CONDUCTIVITY_SENSOR_FAILURES, MAX_CONDUCTIVITY_SENSOR_FAILURE_WINDOW_MS ); @@ -464,11 +467,11 @@ * @param sensorId Conductivity sensor id to process * @return none *************************************************************************/ -static void processCD1CD2SensorRead( U08 fpgaReadCount, U08 fpgaErrorCount ) +static void processCD1CD2SensorRead( U16 fpgaReadCount, U08 fpgaErrorCount ) { if ( fpgaErrorCount == 0 ) { - if ( fpgaReadCount > 0 ) + if ( ( fpgaReadCount > 0 ) && ( ( fpgaReadCount & EMSTAT_PICO_FIFO_EMPTY_MASK ) == 0 ) ) { U08 const emstatByte = getFPGAEmstatOutByte(); switch ( emstatByte )