mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
simplify LCD power state
This commit is contained in:
parent
1b07d0a5c6
commit
94a2839bca
@ -105,18 +105,20 @@ void CommandDistributor::broadcastTurnout(int16_t id, bool isClosed ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandDistributor::broadcastPower() {
|
void CommandDistributor::broadcastPower() {
|
||||||
const FSH * reason;
|
|
||||||
bool main=DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON;
|
bool main=DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON;
|
||||||
bool prog=DCCWaveform::progTrack.getPowerMode()==POWERMODE::ON;
|
bool prog=DCCWaveform::progTrack.getPowerMode()==POWERMODE::ON;
|
||||||
bool join=DCCWaveform::progTrackSyncMain;
|
bool join=DCCWaveform::progTrackSyncMain;
|
||||||
if (main && prog && join) reason=F("1 JOIN");
|
const FSH * reason=F("");
|
||||||
else if (main && prog) reason=F("1");
|
char state='1';
|
||||||
else if (main) reason=F("1 MAIN");
|
if (main && prog && join) reason=F(" JOIN");
|
||||||
else if (prog) reason=F("1 PROG");
|
else if (main && prog);
|
||||||
else reason=F("0");
|
else if (main) reason=F(" MAIN");
|
||||||
|
else if (prog) reason=F(" PROG");
|
||||||
|
else state='0';
|
||||||
|
|
||||||
StringFormatter::send(broadcastBufferWriter,
|
StringFormatter::send(broadcastBufferWriter,
|
||||||
F("<p%S>\nPPA%c\n"),reason, main?'1':'0');
|
F("<p%c%S>\nPPA%c\n"),state,reason, main?'1':'0');
|
||||||
LCD(2,F("Power %S"),reason);
|
LCD(2,F("Power %S%S"),state=='1'?F("On"):F("Off"),reason);
|
||||||
broadcast();
|
broadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
LCD(3,F("Ready"));
|
LCD(3,F("Ready"));
|
||||||
|
CommandDistributor::broadcastPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
Loading…
Reference in New Issue
Block a user