Skip to content

Commit

Permalink
EXRAIL MESSAGE()
Browse files Browse the repository at this point in the history
  • Loading branch information
Asbelos committed Mar 8, 2024
1 parent 4b04a80 commit be218d3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CommandDistributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ void CommandDistributor::broadcastRaw(clientType type, char * msg) {
broadcastReply(type, F("%s"),msg);
}

void CommandDistributor::broadcastMessage(char * message) {
broadcastReply(COMMAND_TYPE, F("<m \"%s\">\n"),message);
broadcastReply(WITHROTTLE_TYPE, F("Hm%s\n"),message);
}

void CommandDistributor::broadcastTrackState(const FSH* format, byte trackLetter, const FSH *modename, int16_t dcAddr) {
broadcastReply(COMMAND_TYPE, format, trackLetter, modename, dcAddr);
}
Expand Down
1 change: 1 addition & 0 deletions CommandDistributor.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public :
static void forget(byte clientId);
static void broadcastRouteState(uint16_t routeId,byte state);
static void broadcastRouteCaption(uint16_t routeId,const FSH * caption);
static void broadcastMessage(char * message);

// Handling code for virtual LCD receiver.
static Print * getVirtualLCDSerial(byte screen, byte row);
Expand Down
4 changes: 4 additions & 0 deletions EXRAIL2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@ void RMFT2::thrungeString(uint32_t strfar, thrunger mode, byte id) {
break;
case thrunge_parse:
case thrunge_broadcast:
case thrunge_message:
case thrunge_lcd:
default: // thrunge_lcd+1, ...
if (!buffer) buffer=new StringBuffer();
Expand Down Expand Up @@ -1371,6 +1372,9 @@ void RMFT2::thrungeString(uint32_t strfar, thrunger mode, byte id) {
case thrunge_withrottle:
CommandDistributor::broadcastRaw(CommandDistributor::WITHROTTLE_TYPE,buffer->getString());
break;
case thrunge_message:
CommandDistributor::broadcastMessage(buffer->getString());
break;
case thrunge_lcd:
LCD(id,F("%s"),buffer->getString());
break;
Expand Down
2 changes: 1 addition & 1 deletion EXRAIL2.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ enum thrunger: byte {
thrunge_serial,thrunge_parse,
thrunge_serial1, thrunge_serial2, thrunge_serial3,
thrunge_serial4, thrunge_serial5, thrunge_serial6,
thrunge_lcn,
thrunge_lcn,thrunge_message,
thrunge_lcd, // Must be last!!
};

Expand Down
2 changes: 2 additions & 0 deletions EXRAIL2MacroReset.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
#undef LCCX
#undef LCN
#undef MOVETT
#undef MESSAGE
#undef ONACTIVATE
#undef ONACTIVATEL
#undef ONAMBER
Expand Down Expand Up @@ -253,6 +254,7 @@
#define LCD(row,msg)
#define SCREEN(display,row,msg)
#define LCN(msg)
#define MESSAGE(msg)
#define MOVETT(id,steps,activity)
#define ONACTIVATE(addr,subaddr)
#define ONACTIVATEL(linear)
Expand Down
4 changes: 4 additions & 0 deletions EXRAILMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ const int StringMacroTracker1=__COUNTER__;
#define PRINT(msg) THRUNGE(msg,thrunge_print)
#undef LCN
#define LCN(msg) THRUNGE(msg,thrunge_lcn)
#undef MESSAGE
#define MESSAGE(msg) THRUNGE(msg,thrunge_message)

#undef ROUTE_CAPTION
#define ROUTE_CAPTION(id,caption) \
case (__COUNTER__ - StringMacroTracker1) : {\
Expand Down Expand Up @@ -516,6 +519,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
#define SCREEN(display,id,msg) PRINT(msg)
#define STEALTH(code...) PRINT(dummy)
#define LCN(msg) PRINT(msg)
#define MESSAGE(msg) PRINT(msg)
#define MOVETT(id,steps,activity) OPCODE_SERVO,V(id),OPCODE_PAD,V(steps),OPCODE_PAD,V(EXTurntable::activity),OPCODE_PAD,V(0),
#define ONACTIVATE(addr,subaddr) OPCODE_ONACTIVATE,V(addr<<2|subaddr),
#define ONACTIVATEL(linear) OPCODE_ONACTIVATE,V(linear+3),
Expand Down
4 changes: 3 additions & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

#include "StringFormatter.h"

#define VERSION "5.2.37"
#define VERSION "5.2.38"
// 5.2.38 - Exrail MESSAGE("text") to send a user message to all
// connected throttles (uses <m "text"> and withrottle Hmtext.
// 5.2.37 - Bugfix ESP32: Use BOOSTER_INPUT define
// 5.2.36 - Variable frequency for DC mode
// 5.2.35 - Bugfix: Make DCC Extended Accessories follow RCN-213
Expand Down

0 comments on commit be218d3

Please sign in to comment.