Fix - missing safe shutdown when PerformSteps returns UiCmdStop

- When STOP is pressed during PerformSteps() in the BeforeTest transition,
Transition() returned immediately and skipped the common shutdown logic.
This caused FM pumps and valves to remain in their previous state.
- Perform the required safe shutdown (FM pump off and default valve setup)
before returning UiCmdStop or Error.
This commit is contained in:
Marek Frniak 2026-07-14 14:41:33 +02:00
parent 0075362f92
commit 37c89a4c9c
3 changed files with 37 additions and 8 deletions

View File

@ -710,8 +710,37 @@ namespace TBF.Rig.Sequences
regVPosOps,
"SequenceBase : Transition : TestStart - Default action");
if (evnt == Event.Error || evnt == Event.UiCmdStop) return evnt;
}
///
/// Bugfix: PerformSteps() may return Error or UiCmdStop before the common
/// transition shutdown code is reached.
///
if (evnt == Event.Error || evnt == Event.UiCmdStop)
{
log.WarnFormat(
"Transition(context={0}): PerformSteps returned {1}, performing safe shutdown (FM pump off, default valves).",
context,
evnt);
if (inPath.Pump is GenericDevices.IPumpFM)
(inPath.Pump as GenericDevices.IPumpFM).TurnOff();
State.Create("SequenceBase : Transition : STOP/ERROR - Setting default valves")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoardMain.SetValvesOp(
StateMachine.DefaultValvesOpen,
StateMachine.DefaultValvesClose))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
}
while (!e.Contains(Event.ValvesSet));
return evnt;
}
}
else if (context == TransitionContext.AfterTestWithOverlap && nextInPath != null && nextBenchPath != null && nextOutPath != null)
{
log.WarnFormat("Transition(., context={0}), overlapped action (next flow regulation)", context);

View File

@ -1327,13 +1327,13 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
if (stopCycle) retVal = Event.ErrorFlagsStop;
stopTest:
stopTest:
/*GenesisHeadBatch.BatchHolder.Value.RemoveAllMeters();*/
StopRecordingStatistics(); /// Make sure graph files are closed
///
/// Quit this sequence
///
///
/// Quit this sequence
///
if (isLastRepetition || retVal == Event.UiCmdStop
|| retVal == Event.OpArgumentError
|| retVal == Event.RecoverableError
@ -1341,7 +1341,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|| retVal == Event.Error
|| retVal == Event.ConfigurationError)
{
cBrd.StopAll(false);
cBrd.StopAll(retVal == Event.UiCmdStop ? true : false);
}
return new List<Event> { retVal };

View File

@ -1360,7 +1360,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|| retVal == Event.Error
|| retVal == Event.ConfigurationError)
{
cBrd.StopAll(false);
cBrd.StopAll(retVal == Event.UiCmdStop ? true : false);
}
return new List<Event> { retVal };