Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r1b110e3b2462fda74aa8f2811aad9ce61cb80309 -r2e0901de8e802fe4c567b0164238bf324014c1cf --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 1b110e3b2462fda74aa8f2811aad9ce61cb80309) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 2e0901de8e802fe4c567b0164238bf324014c1cf) @@ -86,6 +86,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 ********** @@ -98,6 +99,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 ); @@ -137,6 +139,7 @@ //Testing bypassStateDelayStartTimeMS = 0; delayBypassStateFlag = TRUE; + dialysateToDialyzerFlowRate = 0.0F; //Initialize balancing chamber module initBalanceChamber(); @@ -373,6 +376,9 @@ checkDialysateTemperature(); #endif + // Update dialysate flow rate only when in the Dialysate Delivery state + updateDialysateToDialyzerFlowRate(); + //Check temperature drift between D30 and D28 checkDialysateTemperatureSensors(); @@ -825,6 +831,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 @@ -965,6 +995,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 ) );