Index: firmware/App/Controllers/DialysateFlow.c =================================================================== diff -u -r66c7171351e2f3e489008ace7ab18178b71e35ce -rce20c155091cd03f6ec01c0316a428b8b612492f --- firmware/App/Controllers/DialysateFlow.c (.../DialysateFlow.c) (revision 66c7171351e2f3e489008ace7ab18178b71e35ce) +++ firmware/App/Controllers/DialysateFlow.c (.../DialysateFlow.c) (revision ce20c155091cd03f6ec01c0316a428b8b612492f) @@ -78,8 +78,34 @@ /*********************************************************************//** * @brief + * The execDialysateFlowMeterSelfTest function executes the dialysate flow + * sensor's self-test. + * @details Inputs: none + * @details Outputs: none + * @return PressuresSelfTestResult (SELF_TEST_STATUS_T) + *************************************************************************/ +SELF_TEST_STATUS_T execDialysateFlowMeterSelfTest( void ) +{ + SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; + + BOOL calStatus = processCalibrationData(); + + if ( TRUE == calStatus ) + { + result = SELF_TEST_STATUS_PASSED; + } + else + { + result = SELF_TEST_STATUS_FAILED; + } + + return result; +} + +/*********************************************************************//** + * @brief * The execDialysateFlowMeterMonitor function executes the Dialysate flow monitor. - * The Dialysate flow sensor is read, filtered, converted to L/min and calibrated (TODO). + * The Dialysate flow sensor is read, filtered, converted to L/min and calibrated. * @details Inputs: measuredFlowReadingsSum, flowFilterCounter, * measuredDialysateFlowRateLPM * @details Outputs: measuredFlowReadingsSum, flowFilterCounter, @@ -183,7 +209,8 @@ DIALYSATE_FLOW_METER_DATA_T dialysateFlowData; dialysateFlowData.measuredDialysateFlowRate = getMeasuredDialysateFlowRate(); - broadcastDialysateFlowData( &dialysateFlowData ); + broadcastData( MSG_ID_DG_DIALYSATE_FLOW_METER_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&dialysateFlowData, + sizeof( DIALYSATE_FLOW_METER_DATA_T ) ); dialysateFlowDataPublicationTimerCounter = 0; } } Index: firmware/App/Controllers/DialysateFlow.h =================================================================== diff -u -r1c2f96bf994157b11c0c32ddaf96fc91a9a1da1d -rce20c155091cd03f6ec01c0316a428b8b612492f --- firmware/App/Controllers/DialysateFlow.h (.../DialysateFlow.h) (revision 1c2f96bf994157b11c0c32ddaf96fc91a9a1da1d) +++ firmware/App/Controllers/DialysateFlow.h (.../DialysateFlow.h) (revision ce20c155091cd03f6ec01c0316a428b8b612492f) @@ -43,6 +43,8 @@ void initDialysateFlowMeter( void ); +SELF_TEST_STATUS_T execDialysateFlowMeterSelfTest( void ); + void execDialysateFlowMeterMonitor( void ); F32 getMeasuredDialysateFlowRate( void ); Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -recf20c9111729fe3264aa381ccb06cdd695bf98a -rce20c155091cd03f6ec01c0316a428b8b612492f --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision ecf20c9111729fe3264aa381ccb06cdd695bf98a) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision ce20c155091cd03f6ec01c0316a428b8b612492f) @@ -19,6 +19,7 @@ #include "ConcentratePumps.h" #include "ConductivitySensors.h" #include "CPLD.h" +#include "DialysateFlow.h" #include "DrainPump.h" #include "Fans.h" #include "FPGA.h" @@ -193,6 +194,11 @@ postState = handlePOSTStatus( testStatus ); break; + case DG_POST_STATE_DIALYSATE_FLOW_SENSOR: + testStatus = execDialysateFlowMeterSelfTest(); + postState = handlePOSTStatus( testStatus ); + break; + case DG_POST_STATE_WATCHDOG: testStatus = execWatchdogTest(); postState = handlePOSTStatus( testStatus ); Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r92d1230313c92c7480b9ae80a37b7a594232f59d -rce20c155091cd03f6ec01c0316a428b8b612492f --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 92d1230313c92c7480b9ae80a37b7a594232f59d) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision ce20c155091cd03f6ec01c0316a428b8b612492f) @@ -617,32 +617,6 @@ /*********************************************************************//** * @brief - * The broadcastDialysateFlowData function sends out dialysate flow data. - * @details Inputs: measuredDialysateFlowRate - * @details Outputs: dialysate flow data message constructed and queued - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL broadcastDialysateFlowData( const DIALYSATE_FLOW_METER_DATA_T * const flowData ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_DIALYSATE_FLOW_METER_DATA; - msg.hdr.payloadLen = sizeof( DIALYSATE_FLOW_METER_DATA_T ); - - memcpy( payloadPtr, flowData, sizeof( DIALYSATE_FLOW_METER_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; -} - -/*********************************************************************//** - * @brief * The broadcastConcentratePumpData function sends out concentrate pumps' data. * @details Inputs: none * @details Outputs: concentrate pump data msg constructed and queued Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r92d1230313c92c7480b9ae80a37b7a594232f59d -rce20c155091cd03f6ec01c0316a428b8b612492f --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 92d1230313c92c7480b9ae80a37b7a594232f59d) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision ce20c155091cd03f6ec01c0316a428b8b612492f) @@ -87,9 +87,6 @@ // MSG_ID_DG_VALVES_STATES BOOL broadcastValvesStates( U16 valvesStates ); -// MSG_ID_DG_DIALYSATE_FLOW_METER_DATA -BOOL broadcastDialysateFlowData( const DIALYSATE_FLOW_METER_DATA_T * const flowData ); - // MSG_ID_RO_PUMP_DATA BOOL broadcastROPumpData( RO_PUMP_DATA_T *pumpData );