Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r031627883dbd40abd52312d64a1a3b811478d1c3 -r8f4112033e1c247f629202cdc97389ffd5cb0170 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 031627883dbd40abd52312d64a1a3b811478d1c3) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 8f4112033e1c247f629202cdc97389ffd5cb0170) @@ -94,6 +94,9 @@ static F32 dgROPumpFlowRateMlMin = 0.0; ///< Latest RO water flow rate reported by the DG. static U32 dgROPumpPressureSetPtPSI = 0; ///< Latest RO pump target pressure reported by the DG. static U32 dgDrainPumpSpeedSetPtRPM = 0; ///< Latest Drain pump target speed reported by the DG. + +// DG Dialysate flow rate +static F32 dgDialysateFlowRateMlMin = 0.0; ///< Latest dialysate flow rate reported by the DG. // Reservoir data static DG_RESERVOIR_ID_T dgActiveReservoir = DG_RESERVOIR_2; ///< Latest active reservoir reported by the DG. @@ -472,6 +475,21 @@ F32 result = dgROPumpFlowRateMlMin; return result; +} + +/*********************************************************************//** + * @brief + * The getDGDialysateFlowRateMlMin function gets the latest dialysate flow + * rate reported by the DG. + * @details Inputs: dgDialysateFlowRateMlMin + * @details Outputs: none + * @return Latest dialysate flow rate reported by DG. + *************************************************************************/ +F32 getDGDialysateFlowRateMlMin( void ) +{ + F32 result = dgDialysateFlowRateMlMin; + + return result; } /*********************************************************************//** @@ -694,6 +712,20 @@ dgROPumpPressureSetPtPSI = presSetPt; dgROPumpFlowRateMlMin = flowRate * ML_PER_LITER; } + +/*********************************************************************//** + * @brief + * The setDialysateFlowData function sets the latest dialysate flow data + * reported by the DG. + * @details Inputs: none + * @details Outputs: dgDialysateFlowRateMlMin + * @param flowRate latest dialysate flow rate (LPM) reported by DG + * @return none + *************************************************************************/ +void setDialysateFlowData( F32 flowRate ) +{ + dgDialysateFlowRateMlMin = flowRate; +} /*********************************************************************//** * @brief Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -rf2cecb1dae0cfccc768b321f1d0cdec9a73c5824 -r8f4112033e1c247f629202cdc97389ffd5cb0170 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision f2cecb1dae0cfccc768b321f1d0cdec9a73c5824) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 8f4112033e1c247f629202cdc97389ffd5cb0170) @@ -55,6 +55,12 @@ F32 setPWMDutyCyclePct; ///< RO pump set PWM duty cycle percent } DG_RO_PUMP_DATA_PAYLOAD_T; +/// Dialysate flow meter data struct. +typedef struct +{ + F32 measuredDialysateFlowRate; ///< Dialysate flow meter rate average measurement +} DIALYSATE_FLOW_METER_DATA_T; + /// Payload record structure for a drain pump data message. typedef struct { @@ -149,7 +155,8 @@ BOOL hasDGCompletedReservoirSwitch( void ); F32 getDGPressure( DG_PRESSURE_SENSORS_T sensorID ); U32 getDGROPumpPressureSetPt( void ); -F32 getDGROPumpFlowRateMlMin( void ); +F32 getDGROPumpFlowRateMlMin( void ); +F32 getDGDialysateFlowRateMlMin( void ); U32 getDGDrainPumpRPMSetPt( void ); F32 getLoadCellWeight( LOAD_CELL_ID_T loadCellID ); F32 getReservoirWeight( DG_RESERVOIR_ID_T resID ); @@ -162,7 +169,8 @@ void setDGDialysateTemperatures( F32 primaryHtrTemp, F32 trimmerHtrTemp ); void setDGReservoirsData( DG_RESERVOIR_ID_T resID, U32 fillVol, U32 drainVol ); void setDGPressures( F32 roIn, F32 roOut, F32 drainIn, F32 drainOut ); -void setDGROPumpData( U32 presSetPt, F32 flowRate ); +void setDGROPumpData( U32 presSetPt, F32 flowRate ); +void setDialysateFlowData( F32 flowRate ); void setDGDrainPumpData( U32 rpmSetPt ); void setNewLoadCellReadings( F32 res1Primary, F32 res1Backup, F32 res2Primary, F32 res2Backup ); void setDGDisinfectsStates( DG_DISINFECT_UI_STATES_T states ); Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r46617afb446c35270b59e21085b270433d13d113 -r8f4112033e1c247f629202cdc97389ffd5cb0170 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 46617afb446c35270b59e21085b270433d13d113) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 8f4112033e1c247f629202cdc97389ffd5cb0170) @@ -1148,6 +1148,10 @@ case MSG_ID_RO_PUMP_DATA: handleROPumpData( message ); + break; + + case MSG_ID_DG_DIALYSATE_FLOW_METER_DATA: + handleDialysateFlowData( message ); break; case MSG_ID_DG_PRESSURES_DATA: Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r5070f8552a200e15dcc2ca0532db10fba9dc8c6b -r8f4112033e1c247f629202cdc97389ffd5cb0170 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5070f8552a200e15dcc2ca0532db10fba9dc8c6b) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 8f4112033e1c247f629202cdc97389ffd5cb0170) @@ -2278,6 +2278,26 @@ memcpy( &payload, message->payload, sizeof(DG_RO_PUMP_DATA_PAYLOAD_T) ); setDGROPumpData( payload.setPtPSI, payload.measFlowRateMlMin ); } +} + +/*********************************************************************//** + * @brief + * The handleDialysateFlowData function handles dialysate flow data broadcast + * message from the DG. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleDialysateFlowData( MESSAGE_T *message ) +{ + if ( message->hdr.payloadLen == sizeof(DIALYSATE_FLOW_METER_DATA_T) ) + { + DIALYSATE_FLOW_METER_DATA_T payload; + + memcpy( &payload, message->payload, sizeof(DIALYSATE_FLOW_METER_DATA_T) ); + setDialysateFlowData( payload.measuredDialysateFlowRate ); + } } /*********************************************************************//** Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r5070f8552a200e15dcc2ca0532db10fba9dc8c6b -r8f4112033e1c247f629202cdc97389ffd5cb0170 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5070f8552a200e15dcc2ca0532db10fba9dc8c6b) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 8f4112033e1c247f629202cdc97389ffd5cb0170) @@ -137,7 +137,10 @@ void handleDGTemperatureData( MESSAGE_T *message ); // MSG_ID_RO_PUMP_DATA: -void handleROPumpData( MESSAGE_T *message ); +void handleROPumpData( MESSAGE_T *message ); + +// MSG_ID_DG_DIALYSATE_FLOW_METER_DATA: +void handleDialysateFlowData( MESSAGE_T *message ); // MSG_ID_DRAIN_PUMP_DATA: void handleDrainPumpData( MESSAGE_T *message );