Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -ra42ea76ae1c0d4db5f88a6d01e7807afc555f33a -r0a476de4b530495d3c6d96ea7dad20d9d35a9bb4 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision a42ea76ae1c0d4db5f88a6d01e7807afc555f33a) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 0a476de4b530495d3c6d96ea7dad20d9d35a9bb4) @@ -287,13 +287,10 @@ if ( TRUE == activate ) { isBalChamberSwitchingOnRequested = TRUE; - isBalChamberSwitchingOffRequested = FALSE; - } else { isBalChamberSwitchingOffRequested = TRUE; - isBalChamberSwitchingOnRequested = FALSE; } } @@ -591,6 +588,9 @@ { //Alarm when pressure is not in range SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; } } @@ -721,11 +721,17 @@ { // When fill initiated, pressure is not dropped to the expected range, possible valve failures. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; } else if ( TRUE != isPressureStabilizedDuringFill ) { // Alarm when switching time expired, but still pressure not in range which indicates fill is not yet completed. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; } else { @@ -754,9 +760,6 @@ //Clear the request flag to indicate that the request was processed. isBalChamberSwitchingOffRequested = FALSE; - // Clear the flag to indicate that balancing chamber switching is inactive - isBalChamberSwitchingActive = FALSE; - // Move to the idle state state = BAL_CHAMBER_STATE_IDLE; } @@ -823,6 +826,9 @@ { //Alarm when pressure is not in range SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; } } return state; @@ -903,11 +909,17 @@ { // When fill initiated, pressure is not dropped to the expected range, possible valve failures. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; } else if ( TRUE != isPressureStabilizedDuringFill ) { // Alarm when switching time expired, but still pressure not in range which indicates fill is not completed. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; } else { @@ -942,9 +954,6 @@ // Clear the request flag to indicate that the request was processed. isBalChamberSwitchingOffRequested = FALSE; - // Clear flag to indicate that balancing chamber switching is inactive - isBalChamberSwitchingActive = FALSE; - // Move to the idle state state = BAL_CHAMBER_STATE_IDLE; } @@ -967,6 +976,9 @@ // Keep Clearing the off request flag in case an off request was made while we were already in the idle state isBalChamberSwitchingOffRequested = FALSE; + // Clear flag to indicate that balancing chamber switching is inactive + isBalChamberSwitchingActive = FALSE; + // Check if a request made was to activate the balancing chamber switching. if ( TRUE == isBalChamberSwitchingOnRequested ) {