diff --git a/CommandDistributor.cpp b/CommandDistributor.cpp index 8405eb9..5e107df 100644 --- a/CommandDistributor.cpp +++ b/CommandDistributor.cpp @@ -105,18 +105,20 @@ void CommandDistributor::broadcastTurnout(int16_t id, bool isClosed ) { } void CommandDistributor::broadcastPower() { - const FSH * reason; bool main=DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON; bool prog=DCCWaveform::progTrack.getPowerMode()==POWERMODE::ON; bool join=DCCWaveform::progTrackSyncMain; - if (main && prog && join) reason=F("1 JOIN"); - else if (main && prog) reason=F("1"); - else if (main) reason=F("1 MAIN"); - else if (prog) reason=F("1 PROG"); - else reason=F("0"); + const FSH * reason=F(""); + char state='1'; + if (main && prog && join) reason=F(" JOIN"); + else if (main && prog); + else if (main) reason=F(" MAIN"); + else if (prog) reason=F(" PROG"); + else state='0'; + StringFormatter::send(broadcastBufferWriter, - F("\nPPA%c\n"),reason, main?'1':'0'); - LCD(2,F("Power %S"),reason); + F("\nPPA%c\n"),state,reason, main?'1':'0'); + LCD(2,F("Power %S%S"),state=='1'?F("On"):F("Off"),reason); broadcast(); } diff --git a/CommandStation-EX.ino b/CommandStation-EX.ino index 689804b..d619e86 100644 --- a/CommandStation-EX.ino +++ b/CommandStation-EX.ino @@ -104,6 +104,7 @@ void setup() #endif LCD(3,F("Ready")); + CommandDistributor::broadcastPower(); } void loop() diff --git a/DCCEX.h b/DCCEX.h index 2906dae..568f2d3 100644 --- a/DCCEX.h +++ b/DCCEX.h @@ -43,6 +43,6 @@ #include "Sensors.h" #include "Outputs.h" #include "RMFT.h" - +#include "CommandDistributor.h" #endif