diff --git a/CommandDistributor.cpp b/CommandDistributor.cpp index 4e5ecb9..9bde259 100644 --- a/CommandDistributor.cpp +++ b/CommandDistributor.cpp @@ -135,3 +135,8 @@ void CommandDistributor::broadcastPower() { LCD(2,F("Power %S%S"),state=='1'?F("On"):F("Off"),reason); broadcast(true); } + +void CommandDistributor::broadcastText(const FSH * msg) { + StringFormatter::send(broadcastBufferWriter,F("%S"),msg); + broadcast(false); +} diff --git a/CommandDistributor.h b/CommandDistributor.h index 51458fa..a9af3bb 100644 --- a/CommandDistributor.h +++ b/CommandDistributor.h @@ -32,6 +32,7 @@ public : static void broadcastSensor(int16_t id, bool value); static void broadcastTurnout(int16_t id, bool isClosed); static void broadcastPower(); + static void broadcastText(const FSH * msg); static void forget(byte clientId); private: static void broadcast(bool includeWithrottleClients); diff --git a/DCCEX.h b/DCCEX.h index 00d89de..d60edfa 100644 --- a/DCCEX.h +++ b/DCCEX.h @@ -43,7 +43,7 @@ #include "Turnouts.h" #include "Sensors.h" #include "Outputs.h" -#include "EXRAIL.h" #include "CommandDistributor.h" +#include "EXRAIL.h" #endif diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 852eb70..d47778e 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -32,6 +32,7 @@ #undef ATTIMEOUT #undef AUTOMATION #undef AUTOSTART +#undef BROADCAST #undef CALL #undef CLOSE #undef DEACTIVATE @@ -121,6 +122,7 @@ #define ATTIMEOUT(sensor_id,timeout_ms) #define AUTOMATION(id, description) #define AUTOSTART +#define BROADCAST(msg) #define CALL(route) #define CLOSE(id) #define DEACTIVATE(addr,subaddr) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 7efb445..baf3ea7 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -69,6 +69,8 @@ void RMFT2::emitWithrottleDescriptions(Print * stream) { // Pass 3... Create Text sending functions #include "EXRAIL2MacroReset.h" const int StringMacroTracker1=__COUNTER__; +#undef BROADCAST +#define BROADCAST(msg) case (__COUNTER__ - StringMacroTracker1) : CommandDistributor::broadcastText(F(msg));break; #undef PRINT #define PRINT(msg) case (__COUNTER__ - StringMacroTracker1) : printMessage2(F(msg));break; #undef LCN @@ -170,6 +172,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = { #define ATTIMEOUT(sensor_id,timeout) OPCODE_ATTIMEOUT1,0,0,OPCODE_ATTIMEOUT2,V(sensor_id),OPCODE_PAD,V(timeout/100L), #define AUTOMATION(id, description) OPCODE_AUTOMATION, V(id), #define AUTOSTART OPCODE_AUTOSTART,0,0, +#define BROADCAST(msg) PRINT(msg) #define CALL(route) OPCODE_CALL,V(route), #define CLOSE(id) OPCODE_CLOSE,V(id), #define DEACTIVATE(addr,subaddr) OPCODE_DCCACTIVATE,V(addr<<3 | subaddr<<1),