Index: firmware/App/Modes/ModeGenIdle.c =================================================================== diff -u -r8fe65bf6222137cc7182ccacff3a5f2fb2f03753 -r1e22b6ff6f42ddc57ad6c17e56057ab8a3765680 --- firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 8fe65bf6222137cc7182ccacff3a5f2fb2f03753) +++ firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 1e22b6ff6f42ddc57ad6c17e56057ab8a3765680) @@ -20,6 +20,7 @@ #include "ConductivitySensors.h" #include "DrainPump.h" #include "FPGA.h" +#include "HDDefs.h" #include "Heaters.h" #include "ModeFill.h" #include "ModeGenIdle.h" @@ -53,11 +54,14 @@ // ********** private data ********** static DG_GEN_IDLE_MODE_STATE_T genIdleState; ///< Currently active generation idle state. +// NOTE: the bad fill state must be initialized here and not in the transition function since in case of a bad fill, the transition function is called +// several times to drain and fill and handle a bad fill. static DG_GEN_IDLE_MODE_BAD_FILL_STATE_T badFillState = DG_HANDLE_BAD_FILL_STATE_START; ///< Initialize bad fill sub-state. static U32 hdLostCommStartTime_ms; ///< Lost communication with HD start time in ms. static U32 genIdlePublicationTimerCounter; ///< Used to schedule bad fill sub-states publication to CAN bus. static U32 targetFillVolumeML; ///< Save the target fill volume before calling startFillCmd(). static BOOL handleBadFillFlag; ///< Internal signal flag to handle bad fill. +static HD_OP_MODE_T hdMode; ///< HD operations mode. static OVERRIDE_U32_T badFillSubstatesPublishInterval = { BAD_FILL_SUBSTATES_PUB_INTERVAL, ///< Interval (in ms) at which to publish bad fill sub-states to CAN bus. BAD_FILL_SUBSTATES_PUB_INTERVAL, 0, 0 }; @@ -104,6 +108,12 @@ // Re-initialize each time we transition to generation idle mode initGenIdleMode(); + // TODO should we write to RAM that disinfect has been voided all the time during the treatment? + if ( MODE_TREA == hdMode ) + { + setDisinfectStatus( FALSE ); + } + // Set initial actuator states setValveState( VSP, VALVE_STATE_CLOSED ); setValveState( VPI, VALVE_STATE_OPEN ); @@ -163,6 +173,18 @@ /*********************************************************************//** * @brief + * The setHDOperationMode function sets HD operation mode value. + * @details Inputs: none + * @details Outputs: hdMode + * @return none + *************************************************************************/ +void setHDOperationMode( U32 mode ) +{ + hdMode = (HD_OP_MODE_T)mode; +} + +/*********************************************************************//** + * @brief * The setBadAvgConductivityDetectedFlag function sets a flag to indicate * that bad average conductivity is detected. * @details Inputs: none @@ -173,6 +195,7 @@ { handleBadFillFlag = badAvgConducitivyflag; } + /*********************************************************************//** * @brief * The execGenIdleMode function executes the generation idle mode state machine.