Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r8cebc7f282f403c99f712d422454c15414b6fc73 -rd39ef6232e746a4f2d425135208602670fae60bd --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 8cebc7f282f403c99f712d422454c15414b6fc73) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision d39ef6232e746a4f2d425135208602670fae60bd) @@ -89,6 +89,9 @@ static U32 lgLoadCellReadingsIdx = 0; ///< Index for next sample in large load cell rolling average sample array. static F32 lgLoadCellReadingsTotal[ NUM_OF_DG_RESERVOIRS ]; ///< Rolling total - used to calc large load cell moving average. +// 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. static DG_RESERVOIR_ID_T dgActiveReservoirSet = DG_RESERVOIR_2; ///< Active reservoir commanded. @@ -415,6 +418,21 @@ /*********************************************************************//** * @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; +} + +/*********************************************************************//** + * @brief * The getLoadCellWeight function gets the current load cell weight. * @details Inputs: loadCellWeightInGrams * @details Outputs: none @@ -584,6 +602,20 @@ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_HD_INVALID_RESERVOIR_ID, resID ); } } + +/*********************************************************************//** + * @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 -r8cebc7f282f403c99f712d422454c15414b6fc73 -rd39ef6232e746a4f2d425135208602670fae60bd --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 8cebc7f282f403c99f712d422454c15414b6fc73) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision d39ef6232e746a4f2d425135208602670fae60bd) @@ -37,6 +37,12 @@ #define FILL_RESERVOIR_TO_VOLUME_LOW_FLOW_ML 1300 ///< Fill reservoir to this volume (in mL) during treatment if dialysate flow is slow. #define SLOW_DIALYSATE_FLOW_ML_MIN 250 ///< Threshold for slow dialysate flow designation. +/// 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 reservoirs data message. typedef struct { @@ -113,6 +119,7 @@ DG_RESERVOIR_ID_T getDGActiveReservoir( void ); DG_RESERVOIR_ID_T getDGInactiveReservoir( void ); BOOL hasDGCompletedReservoirSwitch( void ); +F32 getDGDialysateFlowRateMlMin( void ); F32 getLoadCellWeight( LOAD_CELL_ID_T loadCellID ); F32 getReservoirWeight( DG_RESERVOIR_ID_T resID ); F32 getReservoirWeightLargeFilter( DG_RESERVOIR_ID_T resID ); @@ -123,6 +130,7 @@ void setDialysateTemperatureReadings( F32 temp1, F32 temp2 ); void setDGDialysateTemperatures( F32 primaryHtrTemp, F32 trimmerHtrTemp ); void setDGReservoirsData( DG_RESERVOIR_ID_T resID, U32 fillVol, U32 drainVol ); +void setDialysateFlowData( F32 flowRate ); 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 -r8cebc7f282f403c99f712d422454c15414b6fc73 -rd39ef6232e746a4f2d425135208602670fae60bd --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 8cebc7f282f403c99f712d422454c15414b6fc73) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision d39ef6232e746a4f2d425135208602670fae60bd) @@ -1146,6 +1146,10 @@ handleDGTemperatureData( message ); break; + case MSG_ID_DG_DIALYSATE_FLOW_METER_DATA: + handleDialysateFlowData( message ); + break; + case MSG_ID_DG_OP_MODE: handleDGOpMode( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r8cebc7f282f403c99f712d422454c15414b6fc73 -rd39ef6232e746a4f2d425135208602670fae60bd --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 8cebc7f282f403c99f712d422454c15414b6fc73) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision d39ef6232e746a4f2d425135208602670fae60bd) @@ -2260,8 +2260,28 @@ // TODO - how to know if DG stops sending these? } -/*********************************************************************//** - * @brief +/*********************************************************************//** + * @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 ); + } +} + +/*********************************************************************//** + * @brief * The handleDGReservoirData function handles a reservoir data broadcast * message from the DG. * @details Inputs: none Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r8cebc7f282f403c99f712d422454c15414b6fc73 -rd39ef6232e746a4f2d425135208602670fae60bd --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 8cebc7f282f403c99f712d422454c15414b6fc73) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision d39ef6232e746a4f2d425135208602670fae60bd) @@ -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 );