mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
prettier MAX_TRACKS
This commit is contained in:
parent
fd6e8705c8
commit
763ef8be34
|
@ -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<TrackManager::MAX_TRACKS; t++)
|
||||
if (TrackManager::getPower(t, pstr))
|
||||
broadcastReply(COMMAND_TYPE, F("<p%s>\n"),pstr);
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Reference in New Issue
Block a user