Index: firmware/App/Drivers/ConductivitySensors.c =================================================================== diff -u -rb04db69f541f245e543df343257bcbdb73fbbc3d -r20d45b98f5e2de8c6d3b9da7d74c5a9db87a6618 --- firmware/App/Drivers/ConductivitySensors.c (.../ConductivitySensors.c) (revision b04db69f541f245e543df343257bcbdb73fbbc3d) +++ firmware/App/Drivers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 20d45b98f5e2de8c6d3b9da7d74c5a9db87a6618) @@ -74,7 +74,7 @@ F32 rawTemperature; ///< Raw Temperature in C from the conductivity sensor. F32 rawResistance; ///< Raw Resistance in kOhms from the conductivity sensor. F32 calculatedTemperature; ///< Calculated temperature in C. - F32 calculatedResistance; ///< Calculated resistance in Ohms + F32 calculatedResistance; ///< Calculated resistance in Ohms. U08 condReadCount; ///< Last conductivity read count. U08 condErrorCount; ///< Last conductivity error count. U08 tempReadCount; ///< Last temperature read count. @@ -972,7 +972,97 @@ currentTemperatureReadings[ sensorNum ].data = calculatedTemperature; } +/*********************************************************************//** + * @brief + * The getConductivityReadCount function gets the conductivity read count + * for a given conductivity sensor id. + * @details \b Inputs: FPGA + * @details \b Outputs: none + * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if given sensor is invalid. + * @param sensorId conductivity sensor id + * @return last known read count. + *************************************************************************/ +U08 getConductivityReadCount( CONDUCTIVITY_SENSORS_T sensor ) +{ + U08 readCount = 0; + switch( sensor ) + { + case D17_COND: + readCount = getFPGAD17CondReadCount(); + break; + case D27_COND: + readCount = getFPGAD27CondReadCount(); + break; + case D29_COND: + readCount = getFPGAD29CondReadCount(); + break; + case D43_COND: + readCount = getFPGAD43CondReadCount(); + break; + case D74_COND: + readCount = getFPGAD74CondReadCount(); + break; + case P9_COND: + readCount = getFPGAP9CondReadCount(); + break; + case P18_COND: + readCount = getFPGAP18CondReadCount(); + break; + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_CONDUCTIVITY_SENSOR_ID1, sensor ) + break; + } + + return readCount; +} + +/*********************************************************************//** + * @brief + * The getConductivityTemperatureReadCount function gets the temperature + * read count for a given conductivity sensor id. + * @details \b Inputs: FPGA + * @details \b Outputs: none + * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if given sensor is invalid. + * @param sensorId conductivity sensor id + * @return last known read count. + *************************************************************************/ +U08 getConductivityTemperatureReadCount( CONDUCTIVITY_SENSORS_T sensor ) +{ + U08 readCount = 0; + + switch( sensor ) + { + case D17_COND: + readCount = getFPGAD17TempReadCount(); + break; + case D27_COND: + readCount = getFPGAD27TempReadCount(); + break; + case D29_COND: + readCount = getFPGAD29TempReadCount(); + break; + case D43_COND: + readCount = getFPGAD43TempReadCount(); + break; + case D74_COND: + readCount = getFPGAD74TempReadCount(); + break; + case P9_COND: + readCount = getFPGAP9TempReadCount(); + break; + case P18_COND: + readCount = getFPGAP18TempReadCount(); + break; + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_CONDUCTIVITY_SENSOR_ID1, sensor ) + break; + } + + return readCount; +} + + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/