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

alternate implementation of DCC::issueReminders()

This commit is contained in:
Harald Barth 2022-08-07 20:05:40 +02:00
parent c115c441e4
commit caca265529

12
DCC.cpp
View File

@ -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;reg++) {
int slot=reg+nextLoco;
if (slot>=MAX_LOCOS) slot-=MAX_LOCOS;
@ -601,6 +602,17 @@ void DCC::issueReminders() {
return;
}
}
*/
for (int reg=nextLoco;reg<MAX_LOCOS+nextLoco;reg++) {
int slot=reg%MAX_LOCOS;
if (speedTable[slot].loco > 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) {