Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r667b74fa0fcd8368f83fc8f8df5166eabea2bf4b -r1cd9bf024ebcb865fbab3eeb8dc987b8a3c89f6a --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 667b74fa0fcd8368f83fc8f8df5166eabea2bf4b) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 1cd9bf024ebcb865fbab3eeb8dc987b8a3c89f6a) @@ -87,6 +87,7 @@ //Testing static U32 bypassStateDelayStartTimeMS; ///< Delay balancing chamber switching for a second to preapre pump steady state. static BOOL delayBypassStateFlag; ///< To indicate change in treatment parameters +static F32 dialysateToDialyzerFlowRate; ///< Current dialysate to dialyzer flow rate (ml/min) // ********** private function prototypes ********** @@ -99,6 +100,7 @@ static DD_GEND_MODE_STATE_T handleGenDIsolatedUFState( void ); static F32 getGenDialysateTargetTemperature( void ); static void calculateTargetDialysateTemp( void ); +static void updateDialysateToDialyzerFlowRate( void ); static void checkDialysateTemperature( void ); static void monitorChamberLevelStatus( void ); static void publishGenDialysateModeData( void ); @@ -138,6 +140,7 @@ //Testing bypassStateDelayStartTimeMS = 0; delayBypassStateFlag = TRUE; + dialysateToDialyzerFlowRate = 0.0F; //Initialize balancing chamber module initBalanceChamber(); @@ -396,6 +399,9 @@ checkDialysateTemperature(); #endif + // Update dialysate flow rate only when in the Dialysate Delivery state + updateDialysateToDialyzerFlowRate(); + //Check temperature drift between D30 and D28 checkDialysateTemperatureSensors(); @@ -855,6 +861,30 @@ /*********************************************************************//** * @brief + * The updateDialysateToDialyzerFlowRate function updates the current dialysate + * to dialyzer flow rate only when in the dialysate delivery state, otherwise + * the flow rate is set to zero + * @details \b Inputs: genDialysateState + * @details \b Outputs: dialysateToDialyzerFlowRate + * @return none + *************************************************************************/ +void updateDialysateToDialyzerFlowRate( void ) +{ + // Check the current Gen Dialysate Mode state + if ( DD_GEND_DIALYSATE_DELIVERY_STATE == genDialysateState ) + { + // Update the dialysate flow rate to the TD request + dialysateToDialyzerFlowRate = getTDDialysateFlowrate(); + } + else + { + // Set the dialysate flow rate to zero + dialysateToDialyzerFlowRate = 0.0F; + } +} + +/*********************************************************************//** + * @brief * The getDialGoodToDeliverStatus function gets the dialysate good to deliver * status. * @details \b Inputs: isDialysateGoodtoDeliver @@ -995,6 +1025,7 @@ data.d18Pressure = getFilteredPressure( D18_PRES ); data.d51Pressure = getFilteredPressure( D51_PRES ); data.isDialysateGoodtoDeliver = (BOOL)getDialGoodToDeliverStatus(); + data.currentQd = dialysateToDialyzerFlowRate; broadcastData( MSG_ID_DD_GEN_DIALYSATE_MODE_DATA, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&data, sizeof( GEN_DIALYSATE_MODE_DATA_T ) );