Index: firmware/App/Modes/ModeHeatDisinfectActiveCool.c =================================================================== diff -u -r73c6b6fb7bbb934277157ce1e218358c573a6af1 -r0b121a7c92a8d86f8369b7094b0bce21389f3747 --- firmware/App/Modes/ModeHeatDisinfectActiveCool.c (.../ModeHeatDisinfectActiveCool.c) (revision 73c6b6fb7bbb934277157ce1e218358c573a6af1) +++ firmware/App/Modes/ModeHeatDisinfectActiveCool.c (.../ModeHeatDisinfectActiveCool.c) (revision 0b121a7c92a8d86f8369b7094b0bce21389f3747) @@ -5,6 +5,7 @@ #include "ModeHeatDisinfectActiveCool.h" #include "OperationModes.h" #include "ROPump.h" +#include "Switches.h" #include "TaskGeneral.h" #include "TemperatureSensors.h" #include "Timers.h" @@ -36,10 +37,12 @@ static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolStartState( void ); static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolCoolDownROFilterState( void ); +static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolCompleteState( void ); static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolCancelBasicPathState( void ); static void failHeatDisinfectActiveCool( void ); static void publishHeatDisinfectActiveCoolData( void ); +static void monitorModeHeatDisinfectActiveCool( void ); /*********************************************************************//** * @brief @@ -92,7 +95,7 @@ U32 execHeatDisinfectActiveCoolMode( void ) { // TODO the inlet water check? - // TODO check the caps to be closed + monitorModeHeatDisinfectActiveCool(); switch( heatDisinfectActiveCoolState ) { @@ -109,6 +112,7 @@ break; case DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_COMPLETE: + heatDisinfectActiveCoolState = handleHeatDisinfectActiveCoolCompleteState(); break; default: @@ -252,6 +256,23 @@ /*********************************************************************//** * @brief + * The handleHeatDisinfectActiveCoolCompleteState function handles the + * heat disinfect active cool complete state. + * @details Inputs: none + * @details Outputs: none + * @return next state of the heat disinfect active cool state machine + *************************************************************************/ +static DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T handleHeatDisinfectActiveCoolCompleteState( void ) +{ + DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_T state = DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_COMPLETE; + + stopDGHeatDisinfectActiveCool(); + + return state; +} + +/*********************************************************************//** + * @brief * The handleHeatDisinfectActiveCoolCancelBasicPathState function handles the * heat disinfect active cool cancel mode basic path state. The state sets * the state to complete and raises an alarm. @@ -312,5 +333,33 @@ } } +/*********************************************************************//** + * @brief + * The monitorModeHeatDisinfectActiveCool function monitors the status of + * the caps and sets the state of the state machine to water cancellation + * path if the caps are not closed during the run. + * @details Inputs: none + * @details Outputs: heatDisinfectActiceCoolPrevState, + * heatDisinfectActiceCoolPrevState, alarmDetectedPendingTrigger + * @return: none + *************************************************************************/ +static void monitorModeHeatDisinfectActiveCool( void ) +{ +#ifndef _RELEASE_ + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) != SW_CONFIG_ENABLE_VALUE ) +#endif + { + if ( ( STATE_OPEN == getSwitchStatus( CONCENTRATE_CAP ) ) || ( STATE_OPEN == getSwitchStatus( DIALYSATE_CAP ) ) ) + { + // Set the variables to fail and go to cancel water path. Set the pending alarm to no alarm so the cancel water path + // will not be raising the alarm at end of the cancel water path. The recoverable alarm is raised here in this function + U32 cap = (U32)( STATE_OPEN == getSwitchStatus( CONCENTRATE_CAP ) ? CONCENTRATE_CAP : DIALYSATE_CAP ); + heatDisinfectActiceCoolPrevState = heatDisinfectActiveCoolState; + heatDisinfectActiveCoolState = DG_HEAT_DISINFECT_ACTIVE_COOL_STATE_CANCEL_BASIC_PATH; + alarmDetectedPendingTrigger = ALARM_ID_DG_DIALYSATE_OR_CONC_CAP_NOT_IN_PROPER_POSITION; + } + } +} + /**@}*/