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 diff --git a/version.h b/version.h index f846e0d..a97aaec 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,10 @@ #include "StringFormatter.h" -#define VERSION "4.2.18" +#define VERSION "4.2.20" +// 4.2.20 - & commands for multi-track gauges +// - Reinstate but remember its a bit useless when TM involved. +// 4.2.19 - Bugfix for analog reading of track current sensor offset. // 4.2.18 - I2C Multiplexer support through Extended Addresses, // added for Wire, 4209 and AVR I2C drivers. // - I2C retries when an operation fails.