Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r5d3e28c19ae10a99a5ce1fc5c010ac944975a6a1 -receb190a5d66fdbee779478ac8bb50a846ed9241 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 5d3e28c19ae10a99a5ce1fc5c010ac944975a6a1) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision eceb190a5d66fdbee779478ac8bb50a846ed9241) @@ -8,7 +8,7 @@ * @file ModeStandby.c * * @author (last) Dara Navaei -* @date (last) 27-Sep-2022 +* @date (last) 21-Dec-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -62,6 +62,7 @@ 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 pendingStartDGHeatDisinfectActiveCoolRequest; ///< Flag indicating HD has requested DG start heat disinfect active cool. +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. @@ -203,19 +204,16 @@ else if ( TRUE == pendingStartDGFlushRequest ) { pendingStartDGFlushRequest = FALSE; - requestNewOperationMode( DG_MODE_FLUS ); } else if ( TRUE == pendingStartDGHeatDisinfectRequest ) { pendingStartDGHeatDisinfectRequest = FALSE; - requestNewOperationMode( DG_MODE_HEAT ); } else if ( TRUE == pendingStartDGChemicalDisinfectRequest ) { pendingStartDGChemicalDisinfectRequest = FALSE; - requestNewOperationMode( DG_MODE_CHEM ); } else if ( TRUE == pendingStartDGHeatDisinfectActiveCoolRequest ) @@ -224,6 +222,11 @@ requestNewOperationMode( DG_MODE_HCOL ); } + else if ( TRUE == pendingStartDGChemicalDisinfectFlushRequest ) + { + pendingStartDGChemicalDisinfectFlushRequest = FALSE; + requestNewOperationMode( DG_MODE_CHFL ); + } return state; } @@ -319,6 +322,7 @@ { stopSampleWaterRequest = FALSE; setValveState( VSP, VALVE_STATE_CLOSED ); + setValveState( VPI, VALVE_STATE_CLOSED ); state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; } @@ -639,6 +643,61 @@ /*********************************************************************//** * @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; + DG_CMD_RESPONSE_T cmdResponse; + + cmdResponse.commandID = DG_CMD_START_CHEM_DISINFECT_FLUSH; + cmdResponse.rejected = FALSE; + cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; + + // If DG is in standby mode and the standby mode is in Idle, request chemical disinfect flush + // Chemical disinfect flush 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 ) ) + { + 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 flush 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; + } + } + else + { + cmdResponse.rejected = TRUE; + cmdResponse.rejectCode = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + } + + sendCommandResponseMsg( &cmdResponse ); + + return status; +} + +/*********************************************************************//** + * @brief * The getCurrentStandbyState function returns the current state of standby mode. * @details Inputs: standbyState * @details Outputs: none