Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r5b919b77ea248b5fec3511857ed910ecfc0a1955 -r8eb118992bbb2f40666c68be20de57c5eb34b5dc --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 5b919b77ea248b5fec3511857ed910ecfc0a1955) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 8eb118992bbb2f40666c68be20de57c5eb34b5dc) @@ -7,8 +7,8 @@ * * @file Valves.c * -* @author (last) Darren Cox -* @date (last) 12-Jan-2023 +* @author (last) Dara Navaei +* @date (last) 18-Jan-2023 * * @author (original) Dara Navaei * @date (original) 07-Aug-2020 @@ -1208,6 +1208,10 @@ 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. + // Also, set the state to Idle so in the fault mode, the valve can transition to Pos C. The exec state is directly set here + // because this is a monitor function that is called in the controller function. + valvesStatus[ valve ].execState = VALVE_STATE_IDLE; SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); } else if ( ( abs( currentPosition - commandedPosition ) < MAX_DEVIATION_FROM_TARGET_IN_COUNTS ) &&