Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r0c296cef29037819be204c45a23d4d38a52b2718 -re82ddb85a3b3a1fc5d591d8cca0d006597fd94cf --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 0c296cef29037819be204c45a23d4d38a52b2718) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision e82ddb85a3b3a1fc5d591d8cca0d006597fd94cf) @@ -60,6 +60,7 @@ static BOOL pendingStartDGFlushRequest; ///< Flag indicating HD has requested DG start flush. static BOOL pendingStartDGHeatDisinfectRequest; ///< Flag indicating HD has requested DG start heat disinfect. static BOOL pendingStartDGChemicalDisinfectRequest; ///< Flag indicating HD has requested DG start chemical disinfect. +static BOOL pendingStartDGChemicalDisinfectFlushRequest; ///< Flag indicating HD has requested DG start chemical disinfect flush. static OVERRIDE_U32_T filterFlushTimePeriod = { FILTER_FLUSH_TIME_MS, FILTER_FLUSH_TIME_MS, 0, 0 }; ///< Filter flush time period in ms. @@ -214,7 +215,14 @@ requestNewOperationMode( DG_MODE_CHEM ); } + else if ( TRUE == pendingStartDGChemicalDisinfectFlushRequest ) + { + pendingStartDGChemicalDisinfectFlushRequest = FALSE; + requestNewOperationMode( DG_MODE_CHFL ); + } + + return state; } @@ -547,6 +555,56 @@ /*********************************************************************//** * @brief + * The startDGChemicalDisinfectFlush function starts chemical disinfect flush mode. + * @details Inputs: standbyState + * @details Outputs: none + * @return: TRUE if the switch was successful + *************************************************************************/ +BOOL startDGChemicalDisinfectFlush( void ) +{ + BOOL status = FALSE; + + // If DG is in standby mode and the standby mode is in Idle, request chemical disinfect + // Chemical disinfect cannot be run in solo mode because the user has to confirm that the acid is inserted or removed + if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_IDLE == standbyState ) ) + { + DG_CMD_RESPONSE_T cmdResponse; + + cmdResponse.commandID = DG_CMD_START_CHEM_DISINFECT_FLUSH; + cmdResponse.rejected = FALSE; + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; + OPN_CLS_STATE_T concCap = getSwitchStatus( CONCENTRATE_CAP ); + OPN_CLS_STATE_T diaCap = getSwitchStatus( DIALYSATE_CAP ); + +#ifndef _RELEASE_ + if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) ) + { + concCap = STATE_CLOSED; + diaCap = STATE_CLOSED; + } +#endif + + // When chemical disinfect is about to be started, both caps must be closed + if ( ( STATE_OPEN == concCap ) || ( STATE_OPEN == diaCap ) ) + { + cmdResponse.rejected = TRUE; + cmdResponse.rejectCode = ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ? REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN : + REQUEST_REJECT_REASON_DG_CONCENTRATE_CAP_OPEN ); + } + else + { + pendingStartDGChemicalDisinfectFlushRequest = TRUE; + status = TRUE; + } + + sendCommandResponseMsg( &cmdResponse ); + } + + return status; +} + +/*********************************************************************//** + * @brief * The getCurrentStandbyState function returns the current state of standby mode. * @details Inputs: standbyState * @details Outputs: none