From caca265529d51d3cd68e7957c589b552da8ef943 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 7 Aug 2022 20:05:40 +0200 Subject: [PATCH] alternate implementation of DCC::issueReminders() --- DCC.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/DCC.cpp b/DCC.cpp index 3d2d056..8524308 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -591,6 +591,7 @@ void DCC::issueReminders() { if ( DCCWaveform::mainTrack.getPacketPending()) return; // This loop searches for a loco in the speed table starting at nextLoco and cycling back around + /* for (int reg=0;reg=MAX_LOCOS) slot-=MAX_LOCOS; @@ -601,6 +602,17 @@ void DCC::issueReminders() { return; } } + */ + for (int reg=nextLoco;reg 0) { + // have found the next loco to remind + // issueReminder will return true if this loco is completed (ie speed and functions) + if (issueReminder(slot)) + nextLoco=(slot+1)%MAX_LOCOS; + return; + } + } } bool DCC::issueReminder(int reg) {