Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r766708fceb0bdf1af8c7897df29d4f5036bfd3db -rbda2ec522a874f07b4433a31a6a6607c55dadda5 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 766708fceb0bdf1af8c7897df29d4f5036bfd3db) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision bda2ec522a874f07b4433a31a6a6607c55dadda5) @@ -19,12 +19,15 @@ #include "reg_het.h" #include "gio.h" -#include "Valves.h" #include "FPGA.h" -#include "Timers.h" -#include "TaskPriority.h" +#include "SafetyShutdown.h" #include "SystemCommMessages.h" +#include "TaskPriority.h" +#include "Timers.h" +#include "Valves.h" + + /** * @addtogroup Valves * @{ @@ -821,7 +824,9 @@ // If we are in Pos B, enable current relaxation if ( commandedPositionEnum == VALVE_POSITION_B_OPEN ) { + // Enable current relaxation setFPGAValveSetPoint( valve, currentPosition, TRUE ); + valvesStatus[ valve ].hasTransitionBeenRequested = TRUE; } // Go back to Idle state @@ -836,6 +841,11 @@ #ifndef DISABLE_VALVE_ALARMS SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_VALVE_TRANSITION_TIMEOUT, (U32)valve ); #endif + // If the valve transition timeout is active and the valve's commanded positions is position C, activate safety shutdown + if ( isAlarmActive( ALARM_ID_HD_VALVE_TRANSITION_TIMEOUT ) && valvesStatus[ valve ].commandedPosition == VALVE_POSITION_C_CLOSE ) + { + activateSafetyShutdown(); + } } // Check if the valve is close to the temporary target position and if it is, assign the next target position else if ( abs( currentPosition - targetPosition ) < MAX_DEVIATION_FROM_TARGET_IN_COUNTS )