From 763ef8be34743835308ad7eaad31a1d59db8b471 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 14 Nov 2023 11:12:14 +0100 Subject: [PATCH] prettier MAX_TRACKS --- CommandDistributor.cpp | 2 +- TrackManager.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CommandDistributor.cpp b/CommandDistributor.cpp index 89c8714..4269492 100644 --- a/CommandDistributor.cpp +++ b/CommandDistributor.cpp @@ -249,7 +249,7 @@ void CommandDistributor::broadcastLoco(byte slot) { void CommandDistributor::broadcastPower() { char pstr[] = "? x"; - for(byte t=0; t<8; t++) + for(byte t=0; t\n"),pstr); diff --git a/TrackManager.cpp b/TrackManager.cpp index ff56001..7c1e651 100644 --- a/TrackManager.cpp +++ b/TrackManager.cpp @@ -526,7 +526,7 @@ POWERMODE TrackManager::getProgPower() { FOR_EACH_TRACK(t) if (track[t]->getMode() & TRACK_MODE_PROG) return track[t]->getPower(); // optimize: there is max one prog track - return POWERMODE::OFF; + return POWERMODE::OFF; } // returns on if all are on. returns off otherwise @@ -545,6 +545,8 @@ POWERMODE TrackManager::getMainPower() { } bool TrackManager::getPower(byte t, char s[]) { + if (t > lastTrack) + return false; if (track[t]) { s[0] = track[t]->getPower() == POWERMODE::ON ? '1' : '0'; s[2] = t + 'A';