Index: firmware/App/Modes/ModeGenIdle.c =================================================================== diff -u -r5109bb981cab2025fcb9de33e303d046085efa18 -r728c213b3958b98a416772d3857f08e390fd04fe --- firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 5109bb981cab2025fcb9de33e303d046085efa18) +++ firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 728c213b3958b98a416772d3857f08e390fd04fe) @@ -60,6 +60,7 @@ 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 BOOL handleBadFillFlag; ///< Internal signal flag to handle bad fill. +static BOOL handleEmptyBottleFlag; ///< Internal siganl flag to handle empty bottle flag. static OVERRIDE_U32_T genIdleDataPublicationInterval = { BAD_FILL_SUBSTATES_PUB_INTERVAL, BAD_FILL_SUBSTATES_PUB_INTERVAL, 0, 0 }; ///< Interval (in ms) at which to publish bad fill sub-states to CAN bus. @@ -187,7 +188,7 @@ * The setBadAvgConductivityDetectedFlag function sets a flag to indicate * that bad average conductivity is detected. * @details Inputs: none - * @details Outputs: none + * @details Outputs: handleBadFillFlag, badFillState * @param flag to TRUE if bad avg conductivity otherwise FALSE *************************************************************************/ void setBadAvgConductivityDetectedFlag( BOOL badAvgConducitivyflag ) @@ -198,6 +199,19 @@ /*********************************************************************//** * @brief + * The setEmptyBottleDetectedFlag function sets a flag to indicate + * that empty bottle flag has been detected. + * @details Inputs: none + * @details Outputs: handleEmptyBottleFlag + * @param flag to TRUE if empty bottle flag is TRUE otherwise FALSE + *************************************************************************/ +void setEmptyBottleDetectedFlag( BOOL emptyBottleFlag ) +{ + handleEmptyBottleFlag = emptyBottleFlag; +} + +/*********************************************************************//** + * @brief * The execGenIdleMode function executes the generation idle mode state machine. * @details Inputs: genIdleState * @details Outputs: Check water quality, generation idle mode state machine executed @@ -278,14 +292,22 @@ * @brief * The handleFlushWaterState function executes the flush water state * generation idle mode state machine. - * @details Inputs: none - * @details Outputs: none + * @details Inputs: handleEmptyBottleFlag + * @details Outputs: handleEmptyBottleFlag * @return the next state *************************************************************************/ static DG_GEN_IDLE_MODE_STATE_T handleFlushWaterState( void ) { DG_GEN_IDLE_MODE_STATE_T result = DG_GEN_IDLE_MODE_STATE_FLUSH_WATER; + if ( TRUE == handleEmptyBottleFlag ) + { + // Empty bottle flag is TRUE and HD is on pause. So HD will not request a fill and it is + // commanded to fill. + handleEmptyBottleFlag = FALSE; + requestNewOperationMode( DG_MODE_FILL ); + } + return result; }