1
0
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:
Asbelos 2021-12-16 12:11:38 +00:00
parent 1b07d0a5c6
commit 94a2839bca
3 changed files with 12 additions and 9 deletions

View File

@ -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();
} }

View File

@ -104,6 +104,7 @@ void setup()
#endif #endif
LCD(3,F("Ready")); LCD(3,F("Ready"));
CommandDistributor::broadcastPower();
} }
void loop() void loop()

View File

@ -43,6 +43,6 @@
#include "Sensors.h" #include "Sensors.h"
#include "Outputs.h" #include "Outputs.h"
#include "RMFT.h" #include "RMFT.h"
#include "CommandDistributor.h"
#endif #endif