Index: firmware/App/Controllers/ConductivitySensors.h =================================================================== diff -u -r30fd485858736c08d8bc4fe8bcb94cf1b545492e -r05e516dc17597cee29c89e5eee25caed055f1151 --- firmware/App/Controllers/ConductivitySensors.h (.../ConductivitySensors.h) (revision 30fd485858736c08d8bc4fe8bcb94cf1b545492e) +++ firmware/App/Controllers/ConductivitySensors.h (.../ConductivitySensors.h) (revision 05e516dc17597cee29c89e5eee25caed055f1151) @@ -46,6 +46,8 @@ void initConductivitySensors( void ); void execConductivitySensors( void ); +void checkWaterConductivity( F32 conductivity, U32 state ); + DATA_ARRAY_GET_PROTOTYPE ( F32, getConductivityValue, sensor ); BOOL testSetConductivityOverride( U32 sensor, F32 value ); Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r30fd485858736c08d8bc4fe8bcb94cf1b545492e -r05e516dc17597cee29c89e5eee25caed055f1151 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 30fd485858736c08d8bc4fe8bcb94cf1b545492e) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 05e516dc17597cee29c89e5eee25caed055f1151) @@ -1408,6 +1408,21 @@ /************************************************************************* * @brief + * The getFPGACPiErrorCount function gets inlet water conductivity sensor + * error count + * @details + * Inputs : fpgaSensorReadings.fpgaCPiErrorCnt + * Outputs : none + * @param none + * @return Inlet water conductivity sensor read error count + *************************************************************************/ +U08 getFPGACPiErrorCount ( void ) +{ + return fpgaSensorReadings.fpgaCPiErrorCnt; +} + +/************************************************************************* + * @brief * The getFPGACPi function gets inlet water conductivity value * @details * Inputs : fpgaSensorReadings.fpgaCPi @@ -1419,3 +1434,47 @@ { return fpgaSensorReadings.fpgaCPi; } + +/************************************************************************* + * @brief + * The getFPGACPoReadCount function gets outlet water conductivity sensor + * read count + * @details + * Inputs : fpgaSensorReadings.fpgaCPoReadCnt + * Outputs : none + * @param none + * @return Last outlet water conductivity sensor read count + *************************************************************************/ +U08 getFPGACPoReadCount ( void ) +{ + return fpgaSensorReadings.fpgaCPoReadCnt; +} + +/************************************************************************* + * @brief + * The getFPGACPoErrorCount function gets outlet water conductivity sensor + * error count + * @details + * Inputs : fpgaSensorReadings.fpgaCPoErrorCnt + * Outputs : none + * @param none + * @return Outlet water conductivity sensor read error count + *************************************************************************/ +U08 getFPGACPoErrorCount ( void ) +{ + return fpgaSensorReadings.fpgaCPoErrorCnt; +} + +/************************************************************************* + * @brief + * The getFPGACPo function gets outlet water conductivity value + * @details + * Inputs : fpgaSensorReadings.fpgaCPo + * Outputs : none + * @param none + * @return Last Outlet water conductivity value + *************************************************************************/ +U32 getFPGACPo ( void ) +{ + return fpgaSensorReadings.fpgaCPo; +} Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r30fd485858736c08d8bc4fe8bcb94cf1b545492e -r05e516dc17597cee29c89e5eee25caed055f1151 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 30fd485858736c08d8bc4fe8bcb94cf1b545492e) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 05e516dc17597cee29c89e5eee25caed055f1151) @@ -78,6 +78,11 @@ U16 getFPGATrimmerColdJunctionTemp ( void ); U08 getFPGACPiReadCount ( void ); +U08 getFPGACPiErrorCount ( void ); U32 getFPGACPi ( void ); + +U08 getFPGACPoReadCount ( void ); +U08 getFPGACPoErrorCount ( void ); +U32 getFPGACPo ( void ); #endif Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r05e516dc17597cee29c89e5eee25caed055f1151 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 05e516dc17597cee29c89e5eee25caed055f1151) @@ -94,6 +94,14 @@ U32 fillToVolumeMl; U32 drainToVolumeMl; } RESERVOIR_DATA_T; + +typedef struct +{ + F32 cpi; + F32 cpo; + F32 cd1; + F32 cd2; +} CONDUCTIVITY_DATA_T; typedef struct { @@ -661,6 +669,43 @@ return result; } + + +/************************************************************************* + * @brief + * The broadcastConductivityData function sends out conductivity data. + * @details + * Inputs : none + * Outputs : conductivity data msg constructed and queued + * @param inlet : water inlet conductivity data. + * @param outlet : water outlet conductivity data. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastConductivityData( F32 inlet, F32 outlet, F32 cd1, F32 cd2 ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + CONDUCTIVITY_DATA_T payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_CONDUCTIVITY_DATA; + msg.hdr.payloadLen = sizeof( CONDUCTIVITY_DATA_T ); + + payload.cpi = inlet; + payload.cpo = outlet; + payload.cd1 = cd1; + payload.cd2 = cd2; + + memcpy( payloadPtr, &payload, sizeof( CONDUCTIVITY_DATA_T ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + // *********************************************************************** // **************** Message Handling Helper Functions ******************** Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r05e516dc17597cee29c89e5eee25caed055f1151 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 05e516dc17597cee29c89e5eee25caed055f1151) @@ -89,7 +89,10 @@ BOOL broadcastHeatersData ( U32 mainPrimaryDC, U32 smallPrimaryDC, U32 trimmerDC ); // MSG_ID_TEMPERATURE_SENSORS_READINGS -BOOL broadcastTemperatureSensorsData ( U08 *sensorsValue, U32 byteLength ); +BOOL broadcastTemperatureSensorsData ( U08 *sensorsValue, U32 byteLength ); + +// MSG_ID_DG_CONDUCTIVITY_DATA +BOOL broadcastConductivityData( F32 inlet, F32 outlet, F32 cd1, F32 cd2 ); // *********** public test support message functions ********** Index: firmware/source/sys_main.c =================================================================== diff -u -r3cc737c39b4440e18abab95ef2f8b6aef13acba9 -r05e516dc17597cee29c89e5eee25caed055f1151 --- firmware/source/sys_main.c (.../sys_main.c) (revision 3cc737c39b4440e18abab95ef2f8b6aef13acba9) +++ firmware/source/sys_main.c (.../sys_main.c) (revision 05e516dc17597cee29c89e5eee25caed055f1151) @@ -63,6 +63,7 @@ #include "DGCommon.h" #include "AlarmMgmt.h" #include "CommBuffers.h" +#include "ConductivitySensors.h" #include "CPLD.h" #include "DrainPump.h" #include "FPGA.h" @@ -171,6 +172,7 @@ initValves(); initHeaters(); initTemperatureSensors(); + initConductivitySensors(); initROPump(); initDrainPump(); initRTC();