From 418d8eb1b2e17ebc0a5623747612d5bd5fa5ccc9 Mon Sep 17 00:00:00 2001 From: mstevetodd Date: Fri, 8 Jan 2021 16:57:32 -0500 Subject: [PATCH 1/3] send milliAmps and meter setup for new JMRI Meter function (#113) * send milliAmps and meter setup for new JMRI Meter function --- DCCEXParser.cpp | 5 ++++- DCCWaveform.h | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index c488fc1..fd1cea0 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -442,7 +442,10 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking) return; case 'c': // READ CURRENT - StringFormatter::send(stream, F(""), DCCWaveform::mainTrack.get1024Current()); + // + StringFormatter::send(stream, F(""), DCCWaveform::mainTrack.getCurrentmA(), DCCWaveform::mainTrack.getMaxmA()); + // StringFormatter::send(stream, F(""), DCCWaveform::progTrack.getCurrentmA(), DCCWaveform::progTrack.getMaxmA()); + StringFormatter::send(stream, F(""), DCCWaveform::mainTrack.get1024Current()); //'a' message deprecated, remove once JMRI 4.22 is available return; case 'Q': // SENSORS diff --git a/DCCWaveform.h b/DCCWaveform.h index b51e79f..3755979 100644 --- a/DCCWaveform.h +++ b/DCCWaveform.h @@ -58,9 +58,20 @@ class DCCWaveform { void checkPowerOverload(); int getLastCurrent(); inline int get1024Current() { - if (powerMode == POWERMODE::ON) - return (int)(lastCurrent*(long int)1024/motorDriver->getRawCurrentTripValue()); - return 0; + if (powerMode == POWERMODE::ON) + return (int)(lastCurrent*(long int)1024/motorDriver->getRawCurrentTripValue()); + return 0; + } + inline int getCurrentmA() { + if (powerMode == POWERMODE::ON) + return motorDriver->raw2mA(lastCurrent); + return 0; + } + inline int getMaxmA() { + if (maxmA == 0) { //only calculate this for first request, it doesn't change + maxmA = motorDriver->raw2mA(motorDriver->getRawCurrentTripValue()); + } + return maxmA; } void schedulePacket(const byte buffer[], byte byteCount, byte repeats); volatile bool packetPending; @@ -112,7 +123,7 @@ class DCCWaveform { byte pendingLength; byte pendingRepeats; int lastCurrent; - + int maxmA; // current sampling POWERMODE powerMode; From 7b4e5546b6b6e1c20060389fb2dc3e9c1b8ff9bf Mon Sep 17 00:00:00 2001 From: Fred Date: Fri, 8 Jan 2021 16:58:22 -0500 Subject: [PATCH 2/3] Update version.h --- version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.h b/version.h index e60dd91..43f4764 100644 --- a/version.h +++ b/version.h @@ -4,7 +4,7 @@ #include "StringFormatter.h" // const char VERSION[] PROGMEM ="0.2.0"; -#define VERSION "3.0.1" +#define VERSION "3.0.2" #endif From 82a4b4880892a6a0c91d40a5a662f1b838149d41 Mon Sep 17 00:00:00 2001 From: Fred Date: Fri, 8 Jan 2021 17:03:43 -0500 Subject: [PATCH 3/3] Update Prod-Release-Notes.md --- Release - Architecture Doc/Prod-Release-Notes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Release - Architecture Doc/Prod-Release-Notes.md b/Release - Architecture Doc/Prod-Release-Notes.md index 1a04b09..eeaa466 100644 --- a/Release - Architecture Doc/Prod-Release-Notes.md +++ b/Release - Architecture Doc/Prod-Release-Notes.md @@ -4,6 +4,10 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.0.0 as a Production R - **Consisting through JMRI** - currently does not work in this release. A number of testers were able to develop a work around. If interested enter a Support Ticket. - **Wi-Fi** - works, but can be challenging to use if you want to switch between AP mode and STA station mode. - **Pololu Motor Shield** - is supported with this release, but the user may have to play around with some timings to enable programming mode due to limitation in its current sensing circuitry + +**Summary of the key new features added to CommandStation-EX V3.0.2:** +- **Create new output for current in mA for ```` command** - New current response outputs current in mA, overlimit current, and maximum board capable current +- **Simultaneously update JMRI to handle new current meter** **Summary of the key new features added to CommandStation-EX V3.0.1:** - **Add back fix for jitter**