Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -rb61c8330905634762e69ed10fb6614a77552fd54 -ra56235b9faf8b3d4948c9d522c463a19e596a870 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision b61c8330905634762e69ed10fb6614a77552fd54) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision a56235b9faf8b3d4948c9d522c463a19e596a870) @@ -926,7 +926,7 @@ state = VALVE_STATE_IDLE; } // Check if the valve's transition time has timed out - else if ( ( TRUE == didTimeout( valvesStatus[ valve ].transitionStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) && ( FALSE == getCPLDACPowerLossDetected() ) ) + else if ( ( TRUE == didTimeout( valvesStatus[ valve ].transitionStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) && ( getCPLDACPowerLossDetected() != TRUE ) ) { // Go back to Idle state and set the valve position to not in position because it was not able to get to the target position valvesStatus[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION; @@ -1188,7 +1188,7 @@ for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { // Check the valve is in Idle state, otherwise the position should not be checked - if ( ( valvesStatus[ valve ].execState == VALVE_STATE_IDLE ) && ( FALSE == getCPLDACPowerLossDetected() ) ) + if ( ( valvesStatus[ valve ].execState == VALVE_STATE_IDLE ) && ( getCPLDACPowerLossDetected() != TRUE) ) { U32 maxDeviation = MAX_DEVIATION_FROM_TARGET_IN_COUNTS; @@ -1211,7 +1211,6 @@ { valvesStatus[ valve ].positionOutOfRangeCounter++; } - if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) { // If the valve's deviation from target was more than the counts for the define period of time trigger the alarm. @@ -1225,16 +1224,15 @@ activateSafetyShutdown(); } } + else if ( ( TRUE == isValveCloseToCommandedPosition( valve, commandedPositionEnum ) ) && ( valvesStatus[ valve ].positionOutOfRangeCounter > 0 ) ) + { + valvesStatus[ valve ].positionOutOfRangeCounter = 0; + } } - else if ( ( TRUE == isValveCloseToCommandedPosition( valve, commandedPositionEnum ) ) && ( valvesStatus[ valve ].positionOutOfRangeCounter > 0 ) ) - { - valvesStatus[ valve ].positionOutOfRangeCounter = 0; - } } else { valvesStatus[ valve ].positionOutOfRangeCounter = 0; - } } }