1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

ON handler fake recursion

This commit is contained in:
Asbelos 2022-01-04 20:09:56 +00:00
parent 024313deac
commit 9cd3e4b7c1

View File

@ -932,9 +932,9 @@ void RMFT2::kill(const FSH * reason, int operand) {
// Hunt for an ONTHROW/ONCLOSE for this turnout // Hunt for an ONTHROW/ONCLOSE for this turnout
int pc= (closed?onCloseLookup:onThrowLookup)->find(turnoutId); int pc= (closed?onCloseLookup:onThrowLookup)->find(turnoutId);
if (pc<0) return; if (pc<0) return;
// Check we dont already have a task running this turnout // Check we dont already have a task running this turnout
RMFT2 * task=loopTask; RMFT2 * task=loopTask;
while(task) { while(task) {
if (task->onTurnoutId==turnoutId) { if (task->onTurnoutId==turnoutId) {
DIAG(F("Recursive ONTHROW/ONCLOSE for Turnout %d"),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; if (task==loopTask) break;
} }
task->onTurnoutId=turnoutId; // flag for recursion detector
task=new RMFT2(pc); // new task starts at this instruction 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) { void RMFT2::activateEvent(int16_t addr, bool activate) {