From 9cd3e4b7c159558e474d531d692d8c0f09427edd Mon Sep 17 00:00:00 2001 From: Asbelos Date: Tue, 4 Jan 2022 20:09:56 +0000 Subject: [PATCH] ON handler fake recursion --- RMFT2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RMFT2.cpp b/RMFT2.cpp index 01dfabb..d0fb54d 100644 --- a/RMFT2.cpp +++ b/RMFT2.cpp @@ -932,9 +932,9 @@ void RMFT2::kill(const FSH * reason, int operand) { // Hunt for an ONTHROW/ONCLOSE for this turnout int pc= (closed?onCloseLookup:onThrowLookup)->find(turnoutId); if (pc<0) return; - + // Check we dont already have a task running this turnout - RMFT2 * task=loopTask; + RMFT2 * task=loopTask; while(task) { if (task->onTurnoutId==turnoutId) { DIAG(F("Recursive ONTHROW/ONCLOSE for Turnout %d"),turnoutId); @@ -944,8 +944,8 @@ void RMFT2::kill(const FSH * reason, int operand) { if (task==loopTask) break; } - task->onTurnoutId=turnoutId; // flag for recursion detector task=new RMFT2(pc); // new task starts at this instruction + task->onTurnoutId=turnoutId; // flag for recursion detector } void RMFT2::activateEvent(int16_t addr, bool activate) {