mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 21:21:24 +01:00
Reformat reply to <=>
This commit is contained in:
parent
befcfebec7
commit
e8b9f80c8c
@ -269,8 +269,8 @@ void CommandDistributor::broadcastRaw(clientType type, char * msg) {
|
|||||||
broadcastReply(type, F("%s"),msg);
|
broadcastReply(type, F("%s"),msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandDistributor::broadcastTrackState(const FSH* format,byte trackLetter, int16_t dcAddr) {
|
void CommandDistributor::broadcastTrackState(const FSH* format,byte trackLetter, byte pstate, int16_t dcAddr) {
|
||||||
broadcastReply(COMMAND_TYPE, format,trackLetter, dcAddr);
|
broadcastReply(COMMAND_TYPE, format,trackLetter, pstate, dcAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandDistributor::broadcastRouteState(uint16_t routeId, byte state ) {
|
void CommandDistributor::broadcastRouteState(uint16_t routeId, byte state ) {
|
||||||
|
@ -55,7 +55,7 @@ public :
|
|||||||
static int16_t retClockTime();
|
static int16_t retClockTime();
|
||||||
static void broadcastPower();
|
static void broadcastPower();
|
||||||
static void broadcastRaw(clientType type,char * msg);
|
static void broadcastRaw(clientType type,char * msg);
|
||||||
static void broadcastTrackState(const FSH* format,byte trackLetter, int16_t dcAddr);
|
static void broadcastTrackState(const FSH* format,byte trackLetter, byte pstate, int16_t dcAddr);
|
||||||
template<typename... Targs> static void broadcastReply(clientType type, Targs... msg);
|
template<typename... Targs> static void broadcastReply(clientType type, Targs... msg);
|
||||||
static void forget(byte clientId);
|
static void forget(byte clientId);
|
||||||
static void broadcastRouteState(uint16_t routeId,byte state);
|
static void broadcastRouteState(uint16_t routeId,byte state);
|
||||||
|
@ -401,50 +401,45 @@ void TrackManager::streamTrackState(Print* stream, byte t) {
|
|||||||
// null stream means send to commandDistributor for broadcast
|
// null stream means send to commandDistributor for broadcast
|
||||||
if (track[t]==NULL) return;
|
if (track[t]==NULL) return;
|
||||||
auto format=F("");
|
auto format=F("");
|
||||||
// bool pstate = TrackManager::isPowerOn(t);
|
byte pstate = TrackManager::isPowerOn(t) ? 1 : 0;
|
||||||
// char *statestr;
|
|
||||||
// if (pstate)
|
|
||||||
// statestr = (char *)"ON";
|
|
||||||
// else
|
|
||||||
// statestr = (char *)"OFF";
|
|
||||||
TRACK_MODE tm = track[t]->getMode();
|
TRACK_MODE tm = track[t]->getMode();
|
||||||
if (tm & TRACK_MODE_MAIN) {
|
if (tm & TRACK_MODE_MAIN) {
|
||||||
if(tm & TRACK_MODE_AUTOINV)
|
if(tm & TRACK_MODE_AUTOINV)
|
||||||
format=F("<= %c MAIN AUTOINV>\n");
|
format=F("<= %c %d MAIN AUTOINV>\n");
|
||||||
else if (tm & TRACK_MODE_INV)
|
else if (tm & TRACK_MODE_INV)
|
||||||
format=F("<= %c MAIN INV>\n");
|
format=F("<= %c %d MAIN INV>\n");
|
||||||
else
|
else
|
||||||
format=F("<= %c MAIN>\n");
|
format=F("<= %c %d MAIN>\n");
|
||||||
}
|
}
|
||||||
#ifndef DISABLE_PROG
|
#ifndef DISABLE_PROG
|
||||||
else if (tm & TRACK_MODE_PROG)
|
else if (tm & TRACK_MODE_PROG)
|
||||||
format=F("<= %c PROG>\n");
|
format=F("<= %c %d PROG>\n");
|
||||||
#endif
|
#endif
|
||||||
else if (tm & TRACK_MODE_NONE)
|
else if (tm & TRACK_MODE_NONE)
|
||||||
format=F("<= %c NONE>\n");
|
format=F("<= %c %d NONE>\n");
|
||||||
else if(tm & TRACK_MODE_EXT)
|
else if(tm & TRACK_MODE_EXT)
|
||||||
format=F("<= %c EXT>\n");
|
format=F("<= %c %d EXT>\n");
|
||||||
else if(tm & TRACK_MODE_BOOST) {
|
else if(tm & TRACK_MODE_BOOST) {
|
||||||
if(tm & TRACK_MODE_AUTOINV)
|
if(tm & TRACK_MODE_AUTOINV)
|
||||||
format=F("<= %c BOOST AUTOINV>\n");
|
format=F("<= %c %d BOOST AUTOINV>\n");
|
||||||
else if (tm & TRACK_MODE_INV)
|
else if (tm & TRACK_MODE_INV)
|
||||||
format=F("<= %c BOOST INV>\n");
|
format=F("<= %c %d BOOST INV>\n");
|
||||||
else
|
else
|
||||||
format=F("<= %c BOOST>\n");
|
format=F("<= %c %d BOOST>\n");
|
||||||
}
|
}
|
||||||
else if (tm & TRACK_MODE_DC) {
|
else if (tm & TRACK_MODE_DC) {
|
||||||
if (tm & TRACK_MODE_INV)
|
if (tm & TRACK_MODE_INV)
|
||||||
format=F("<= %c DCX %d>\n");
|
format=F("<= %c %d DCX %d>\n");
|
||||||
else
|
else
|
||||||
format=F("<= %c DC %d>\n");
|
format=F("<= %c %d DC %d>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
format=F("<= %c XXX>\n");
|
format=F("<= %c %d XXX>\n");
|
||||||
|
|
||||||
if (stream)
|
if (stream)
|
||||||
StringFormatter::send(stream,format,'A'+t, trackDCAddr[t]);
|
StringFormatter::send(stream,format,'A'+t, pstate, trackDCAddr[t]);
|
||||||
else
|
else
|
||||||
CommandDistributor::broadcastTrackState(format,'A'+t, trackDCAddr[t]);
|
CommandDistributor::broadcastTrackState(format,'A'+t, pstate, trackDCAddr[t]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user