diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 0d794ad..00fd6a5 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -2,7 +2,7 @@ * © 2022 Paul M Antoine * © 2021 Neil McKechnie * © 2021 Mike S - * © 2021-2024 Herb Morton + * © 2021-2025 Herb Morton * © 2020-2023 Harald Barth * © 2020-2021 M Steve Todd * © 2020-2021 Fred Decker @@ -771,6 +771,11 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) TrackManager::reportCurrent(stream); // return; + case "L"_hk: // current values + if (params>1) break; + TrackManager::reportCurrentLCD(stream); // Track power status + return; + case "A"_hk: // intercepted by EXRAIL// returns automations/routes if (params!=1) break; // StringFormatter::send(stream, F("\n")); diff --git a/TrackManager.cpp b/TrackManager.cpp index b793de1..d95a1f5 100644 --- a/TrackManager.cpp +++ b/TrackManager.cpp @@ -2,7 +2,7 @@ * © 2022-2025 Chris Harlow * © 2022-2024 Harald Barth * © 2023-2024 Paul M. Antoine - * © 2024 Herb Morton + * © 2024-2025 Herb Morton * © 2023 Colin Murdoch * All rights reserved. * @@ -646,6 +646,33 @@ void TrackManager::reportCurrent(Print* stream) { StringFormatter::send(stream,F(">\n")); } +void TrackManager::reportCurrentLCD(Print* stream) { + FOR_EACH_TRACK(t) { + bool pstate = TrackManager::isPowerOn(t); // checks if power is on or off + TRACK_MODE tMode=(TrackManager::getMode(t)); // gets to current power mode + int16_t DCAddr=(TrackManager::returnDCAddr(t)); + int16_t tPwr_mA= (track[t]->getPower()==POWERMODE::OVERLOAD) ? -1 : + track[t]->raw2mA(track[t]->getCurrentRaw(false)); + + if (pstate) { // if power is on do this section + if (tMode & TRACK_MODE_DC) { // Test if track is in DC or DCX mode + LCD(8+t, F("%c: %S %d ON %dmA"), t+'A', (TrackManager::getModeName(tMode)),DCAddr, tPwr_mA); + } + else { // formats without DCAddress + LCD(8+t, F("%c: %S ON %dmA"), t+'A', (TrackManager::getModeName(tMode)), tPwr_mA); + } + } + else { // if power is off do this section + if (tMode & TRACK_MODE_DC) { // DC / DCX + LCD(8+t, F("Track %c: %S %d OFF"), t+'A', (TrackManager::getModeName(tMode)),DCAddr); + } + else { // Not DC or DCX + LCD(8+t, F("Track %c: %S OFF"), t+'A', (TrackManager::getModeName(tMode))); + } + } + } + } + void TrackManager::reportGauges(Print* stream) { StringFormatter::send(stream,F(" LCD // 5.5.4 - Split ESP32 from DCCWaveform to DCCWaveformRMT // - Railcom Cutout control (DCCTimerAVR Mega only so far) // 5.5.3 - EXRAIL ESTOPALL,XPOM,