1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-01-27 20:58:52 +01:00

Power status LCD <JL> testing

This commit is contained in:
Ash-4 2025-01-12 18:01:32 -06:00
parent dc84f560e6
commit f325c9d18f
4 changed files with 38 additions and 3 deletions

View File

@ -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); // <g limit...limit>
return;
case "L"_hk: // <JL> current values
if (params>1) break;
TrackManager::reportCurrentLCD(stream); // Track power status
return;
case "A"_hk: // <JA> intercepted by EXRAIL// <JA> returns automations/routes
if (params!=1) break; // <JA>
StringFormatter::send(stream, F("<jA>\n"));

View File

@ -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("<jG"));
FOR_EACH_TRACK(t) {

View File

@ -1,6 +1,7 @@
/*
* © 2022 Chris Harlow
* © 2022-2024 Harald Barth
* © 2025 Herb Morton
* © 2023 Colin Murdoch
*
* All rights reserved.
@ -87,6 +88,7 @@ class TrackManager {
static void sampleCurrent();
static void reportGauges(Print* stream);
static void reportCurrent(Print* stream);
static void reportCurrentLCD(Print* stream);
static void reportObsoleteCurrent(Print* stream);
static void streamTrackState(Print* stream, byte t);
static bool isPowerOn(byte t);

View File

@ -3,7 +3,8 @@
#include "StringFormatter.h"
#define VERSION "5.5.4"
#define VERSION "5.5.4 LCD"
// - Track power status <JL> LCD
// 5.5.4 - Split ESP32 from DCCWaveform to DCCWaveformRMT
// - Railcom Cutout control (DCCTimerAVR Mega only so far)
// 5.5.3 - EXRAIL ESTOPALL,XPOM,