From 86ed8ff8a6aeb45abaf0a25def6d0d3e10815c82 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 13 Nov 2023 17:16:58 +0100 Subject: [PATCH] remove power state from <=> answer --- CommandDistributor.cpp | 4 ++-- CommandDistributor.h | 2 +- TrackManager.cpp | 31 ++++++++++++++----------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/CommandDistributor.cpp b/CommandDistributor.cpp index 653bbef..cd9e89e 100644 --- a/CommandDistributor.cpp +++ b/CommandDistributor.cpp @@ -269,8 +269,8 @@ void CommandDistributor::broadcastRaw(clientType type, char * msg) { broadcastReply(type, F("%s"),msg); } -void CommandDistributor::broadcastTrackState(const FSH* format,byte trackLetter, byte pstate, int16_t dcAddr) { - broadcastReply(COMMAND_TYPE, format,trackLetter, pstate, dcAddr); +void CommandDistributor::broadcastTrackState(const FSH* format,byte trackLetter, int16_t dcAddr) { + broadcastReply(COMMAND_TYPE, format, trackLetter, dcAddr); } void CommandDistributor::broadcastRouteState(uint16_t routeId, byte state ) { diff --git a/CommandDistributor.h b/CommandDistributor.h index 7dfcdf6..83bfbbd 100644 --- a/CommandDistributor.h +++ b/CommandDistributor.h @@ -55,7 +55,7 @@ public : static int16_t retClockTime(); static void broadcastPower(); static void broadcastRaw(clientType type,char * msg); - static void broadcastTrackState(const FSH* format,byte trackLetter, byte pstate, int16_t dcAddr); + static void broadcastTrackState(const FSH* format,byte trackLetter, int16_t dcAddr); template static void broadcastReply(clientType type, Targs... msg); static void forget(byte clientId); static void broadcastRouteState(uint16_t routeId,byte state); diff --git a/TrackManager.cpp b/TrackManager.cpp index 647f07c..8cdadb2 100644 --- a/TrackManager.cpp +++ b/TrackManager.cpp @@ -400,46 +400,43 @@ bool TrackManager::parseJ(Print *stream, int16_t params, int16_t p[]) void TrackManager::streamTrackState(Print* stream, byte t) { // null stream means send to commandDistributor for broadcast if (track[t]==NULL) return; - auto format=F(""); - byte pstate = TrackManager::isPowerOn(t) ? 1 : 0; + auto format=F("<= %d XXX>\n"); TRACK_MODE tm = track[t]->getMode(); if (tm & TRACK_MODE_MAIN) { if(tm & TRACK_MODE_AUTOINV) - format=F("<= %c %d MAIN AUTOINV>\n"); + format=F("<= %c MAIN A>\n"); else if (tm & TRACK_MODE_INV) - format=F("<= %c %d MAIN INV>\n"); + format=F("<= %c MAIN I>\n"); else - format=F("<= %c %d MAIN>\n"); + format=F("<= %c MAIN>\n"); } #ifndef DISABLE_PROG else if (tm & TRACK_MODE_PROG) - format=F("<= %c %d PROG>\n"); + format=F("<= %c PROG>\n"); #endif else if (tm & TRACK_MODE_NONE) - format=F("<= %c %d NONE>\n"); + format=F("<= %c NONE>\n"); else if(tm & TRACK_MODE_EXT) - format=F("<= %c %d EXT>\n"); + format=F("<= %c EXT>\n"); else if(tm & TRACK_MODE_BOOST) { if(tm & TRACK_MODE_AUTOINV) - format=F("<= %c %d BOOST AUTOINV>\n"); + format=F("<= %c B A>\n"); else if (tm & TRACK_MODE_INV) - format=F("<= %c %d BOOST INV>\n"); + format=F("<= %c B I>\n"); else - format=F("<= %c %d BOOST>\n"); + format=F("<= %c B>\n"); } else if (tm & TRACK_MODE_DC) { if (tm & TRACK_MODE_INV) - format=F("<= %c %d DCX %d>\n"); + format=F("<= %c DCX %d>\n"); else - format=F("<= %c %d DC %d>\n"); + format=F("<= %c DC %d>\n"); } - else - format=F("<= %c %d XXX>\n"); if (stream) - StringFormatter::send(stream,format,'A'+t, pstate, trackDCAddr[t]); + StringFormatter::send(stream,format,'A'+t, trackDCAddr[t]); else - CommandDistributor::broadcastTrackState(format,'A'+t, pstate, trackDCAddr[t]); + CommandDistributor::broadcastTrackState(format,'A'+t, trackDCAddr[t]); }