From b969563d355de74181ab4b1a0854a807980bcaa4 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 2 Mar 2023 12:56:30 +0000 Subject: [PATCH] Squashed commit of the following: commit 4d8efcdd056a021023b8c7d7942a05e8530adafe Author: Asbelos Date: Wed Mar 1 16:32:05 2023 +0000 Reinstate obsolete commit 003313998b3708b0b845d88a985d8515834cbe2f Author: Asbelos Date: Wed Mar 1 16:07:11 2023 +0000 Change to commit c72bf51959d77356ba0b1eb6be83b790439ce779 Author: Asbelos Date: Sat Feb 25 17:38:39 2023 +0000 G and I commands --- DCCEXParser.cpp | 18 +++- Release_Notes/CommandRef.md | 171 ++++++++++++++++++++++++++++++++++++ TrackManager.cpp | 30 ++++++- TrackManager.h | 3 + 4 files changed, 219 insertions(+), 3 deletions(-) create mode 100644 Release_Notes/CommandRef.md diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index bcc25d7..9e2cf5f 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -79,6 +79,8 @@ const int16_t HASH_KEYWORD_TT=2688; const int16_t HASH_KEYWORD_VPIN=-415; const int16_t HASH_KEYWORD_A='A'; const int16_t HASH_KEYWORD_C='C'; +const int16_t HASH_KEYWORD_G='G'; +const int16_t HASH_KEYWORD_I='I'; const int16_t HASH_KEYWORD_R='R'; const int16_t HASH_KEYWORD_T='T'; const int16_t HASH_KEYWORD_X='X'; @@ -501,8 +503,10 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) return; case 'c': // SEND METER RESPONSES - // No longer supported because of multiple tracks - break; + // No longer useful because of multiple tracks See and + if (params>0) break; + TrackManager::reportObsoleteCurrent(stream); + return; case 'Q': // SENSORS Sensor::printAll(stream); @@ -583,6 +587,16 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) } CommandDistributor::setClockTime(p[1], p[2], 1); return; + + case HASH_KEYWORD_G: // current gauge limits + if (params>1) break; + TrackManager::reportGauges(stream); // + return; + + case HASH_KEYWORD_I: // current values + if (params>1) break; + TrackManager::reportCurrent(stream); // + return; case HASH_KEYWORD_A: // returns automations/routes StringFormatter::send(stream, F(" is actually read as + - Keyword parameters are shown in upper case but may be entered in mixed case. + - value parameters are numeric. + - [something] indicates its optional. + - Not all commands have a response, and not all responses come from the last commands that you have issued. + +Startup status + + +Track power management +<1> +<1 MAIN|PROG|JOIN> +<0> +<0 MAIN|PROG> + +Basic manual control + + + + + +DCC accessory control + + + + +Turnout definition +Note: Turnouts are best defined in myAutomation.h where a turnout description can also be provided ( refer to EXRAIL documentation) or by using these commands in a mySetup.h file. + + + + + + + +Outputs + + + +Sensors + + +Decoder programming + + + + + + + + + + + + + +Advanced DCC control + +

+ +<#> +<-> +<- cabid> + + + + + +EEPROM commands +These commands exist for +backwards JMRI compatibility. +You are strongly discouraged from maintaining your configuration settings in EEPROM. + + + + + + + + + + +Diagnostic commands + + + + + + + + + + + +<+ cmd> +<+> + + +User defined filter commands + + + +Track Management +<=> +<= track DCC|PROG|OFF> +<= track DC|DCX cabid> + + + + +Turntable interface + + +Fast clock interface + + + + +Advanced Throttle access to features + + + + + + + + +******************* +EXRAIL Commands +******************* + + + + + + + + + + + + +Obsolete commands/formats + + + + + + + + +Broadcast responses +Note: broadcasts are sent to all throttles when appropriate (usually because something has changed) + + + + + + + + + +Diagnostic responses +These are not meant to be software readable. They contain diagnostic information for programmers to identify issues. + +<* ... *> + diff --git a/TrackManager.cpp b/TrackManager.cpp index cbb672a..33d1d8a 100644 --- a/TrackManager.cpp +++ b/TrackManager.cpp @@ -423,7 +423,35 @@ POWERMODE TrackManager::getProgPower() { return track[t]->getPower(); return POWERMODE::OFF; } - + +void TrackManager::reportObsoleteCurrent(Print* stream) { + // This function is for backward JMRI compatibility only + // It reports the first track only, as main, regardless of track settings. + // + int maxCurrent=track[0]->raw2mA(track[0]->getRawCurrentTripValue()); + StringFormatter::send(stream, F("\n"), + track[0]->raw2mA(track[0]->getCurrentRaw(false)), maxCurrent, maxCurrent); +} + +void TrackManager::reportCurrent(Print* stream) { + StringFormatter::send(stream,F("getPower()==POWERMODE::OVERLOAD) ? -1 : + track[t]->raw2mA(track[t]->getCurrentRaw(false))); + } + StringFormatter::send(stream,F(">\n")); +} + +void TrackManager::reportGauges(Print* stream) { + StringFormatter::send(stream,F("raw2mA(track[t]->getRawCurrentTripValue())); + } + StringFormatter::send(stream,F(">\n")); +} + void TrackManager::setJoinRelayPin(byte joinRelayPin) { joinRelay=joinRelayPin; if (joinRelay!=UNUSED_PIN) { diff --git a/TrackManager.h b/TrackManager.h index 90a9345..4a548cc 100644 --- a/TrackManager.h +++ b/TrackManager.h @@ -77,6 +77,9 @@ class TrackManager { static bool isJoined() { return progTrackSyncMain;} static void setJoinRelayPin(byte joinRelayPin); static void sampleCurrent(); + static void reportGauges(Print* stream); + static void reportCurrent(Print* stream); + static void reportObsoleteCurrent(Print* stream); static int16_t joinRelay; static bool progTrackSyncMain; // true when prog track is a siding switched to main static bool progTrackBoosted; // true when prog track is not current limited