From bf52f99a3abc9bd10daaa0cff44fc432a03f63a3 Mon Sep 17 00:00:00 2001 From: Fred Date: Sun, 7 Feb 2021 12:41:03 -0500 Subject: [PATCH 01/11] Create release-notes.md Add release notes to main sketch folder --- release-notes.md | 93 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 release-notes.md diff --git a/release-notes.md b/release-notes.md new file mode 100644 index 0000000..0893e1a --- /dev/null +++ b/release-notes.md @@ -0,0 +1,93 @@ +The DCC-EX Team is pleased to release CommandStation-EX-v3.0.0 as a Production Release. This release is a major re-write of earlier versions. We've re-architected the code-base so that it can better handle new features going forward. + +**Known Bugs:** + - **Consisting through JMRI** - currently does not work in this release. You may use the command to do this manually. + - **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.3** + - ** command to write loco address and clear consist** + - ** command will allow for consist address** + - **Startup commands implemented** + +**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** + - **Add Turnouts, Outputs and Sensors to `````` command output** + + **Summary of the key new features added to CommandStation-EX V3.0.0:** + + - **New USB Browser Based Throttle** - WebThrottle-EX is a full front-end to controller to control the CS to run trains. + - **WiFi Support** - AP and station modes supported. Auto-detection of an ESP8266 WiFi module with AT firmware on a Mega's serial port. Connection to JMRI and WiThrottle clients. + - **Withrottle Integrations** - Act as a host for up to four WiThrottle clients concurrently. + - **Add LCD/OLED support** - OLED supported on Mega only + - **Improved CV programming routines** - checks for length of CV pulse, and breaks out of the wait state once it has received an ACK, now reading one CV per second. + - **Improved current sensing** - rewrote current sensing routines for safer operation. Current thresholds based on milliamps, not magic numbers + - **Individual track power control** - Ability to toggle power on either or both tracks, and to "JOIN" the tracks and make them output the same waveform for multiple power districts. + - **Single or Dual-Pin PWM output** - Allows control of H-bridges with PH/EN or dual PWM inputs + - **New, simpler function command** - `````` command allows setting functions based on their number, not based on a code as in `````` + - **Function reminders** - Function reminders are sent in addition to speed reminders + - **Functions to F28** - All NMRA functions are now supported + - **Filters and user functions** - Ability to filter commands in the parser and execute custom code based on them. (ex: Redirect Turnout commands via NRF24) + - **Diagnostic `````` commands** - See documentation for a full list of new diagnostic commands + - **Rewrote DCC++ Parser** - more efficient operation, accepts multi-char input and uses less RAM + - **Rewritten waveform generator** - capable of using any pin for DCC waveform out, eliminating the need for jumpers + - **Rewritten packet generator** - Simplify and make smaller, remove idea of "registers" from original code + - **Add free RAM messages** - Free RAM messages are now printed whenever there is a decerase in available RAM + - **Fix EEPROM bugs** + - **Number of locos discovery command** - ```<#>``` command + - **Support for more locomotives** - 20 locomotives on an UNO and 50 an a Mega. + - **Automatic slot managment** - slot variable in throttle/function commands are ignored and slot management is taken care of automatically. `````` command added to release locos from memory. + + +**Key Contributors** + +**Project Lead** +- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) + +**CommandStation-EX Developers** +- Chris Harlow - Bournemouth, UK (UKBloke) +- Harald Barth - Stockholm, Sweden (Haba) +- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) +- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting) +- M Steve Todd - - Engine Driver and JMRI Interface +- Scott Catalanno - Pennsylvania +- Gregor Baues - Île-de-France, France (grbba) + +**exInstaller Software** +- Anthony W - Dayton, Ohio, USA (Dex, Dex++) + +**Website and Documentation** +- Mani Kumar - Bangalor, India (Mani / Mani Kumar) +- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk) +- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting) +- Roger Beschizza - Dorset, UK (Roger Beschizza) +- Keith Ledbetter - Chicago, Illinois, USA (Keith Ledbetter) +- Kevin Smith - (KCSmith) + +**WebThrotle-EX** +- Fred Decker - Holly Springs, NC (FlightRisk/FrightRisk) +- Mani Kumar - Bangalor, India (Mani /Mani Kumar) +- Matt H - + + + +**Beta Testing / Release Management / Support** +- Larry Dribin - Release Management +- Keith Ledbetter +- BradVan der Elst +- Andrew Pye +- Mike Bowers +- Randy McKenzie +- Roberto Bravin +- Sim Brigden +- Alan Lautenslager +- Martin Bafver +- Mário André Silva +- Anthony Kochevar +- Gajanatha Kobbekaduwe +- Sumner Patterson +- Paul - Virginia, USA From 92fb06c69182a7fbb764cf4f5dad00d07c720b2f Mon Sep 17 00:00:00 2001 From: Fred Date: Sun, 7 Feb 2021 12:43:15 -0500 Subject: [PATCH 02/11] Rename release-notes.md to release_notes.md --- release-notes.md => release_notes.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename release-notes.md => release_notes.md (100%) diff --git a/release-notes.md b/release_notes.md similarity index 100% rename from release-notes.md rename to release_notes.md From 5860ad3f1dc5b39f28dd3585b342f1684f3d8081 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 15 Feb 2021 10:41:08 +0100 Subject: [PATCH 03/11] do the sha generation on master --- .github/workflows/sha.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/sha.yml diff --git a/.github/workflows/sha.yml b/.github/workflows/sha.yml new file mode 100644 index 0000000..38210aa --- /dev/null +++ b/.github/workflows/sha.yml @@ -0,0 +1,34 @@ +name: SHA + +# Run this workflow ever time code is pushed to a branch +# other than `main` in your repository +on: push + +jobs: + # Set the job key. The key is displayed as the job name + # when a job name is not provided + sha: + # Name the Job + name: Commit SHA + # Set the type of machine to run on + runs-on: ubuntu-latest + + if: contains(github.ref, "master") + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + - name: Create SHA File + run: | + sha=$(git rev-parse --short "$GITHUB_SHA") + echo "#define GITHUB_SHA \"$sha\"" > GITHUB_SHA.h + + - uses: EndBug/add-and-commit@v4 # You can change this to use a specific version + with: + add: 'GITHUB_SHA.h' + message: 'Committing a SHA' + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged + \ No newline at end of file From 62d1f46a03e85c4c6d4bac04ccaac71da69824e1 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 15 Feb 2021 10:52:19 +0100 Subject: [PATCH 04/11] yaml syntax --- .github/workflows/sha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sha.yml b/.github/workflows/sha.yml index 38210aa..8aca1a5 100644 --- a/.github/workflows/sha.yml +++ b/.github/workflows/sha.yml @@ -13,7 +13,7 @@ jobs: # Set the type of machine to run on runs-on: ubuntu-latest - if: contains(github.ref, "master") + if: github.ref == 'refs/heads/master' steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code From 781d0325af43ead9646c17d4350380c34dbdfa85 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 15 Feb 2021 09:52:46 +0000 Subject: [PATCH 05/11] Committing a SHA --- GITHUB_SHA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index cca6c46..096d2bb 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "9db6d36" +#define GITHUB_SHA "62d1f46" From fbb9841f3ac0fcc3289f8465566e6c27643971de Mon Sep 17 00:00:00 2001 From: Fred Date: Wed, 17 Feb 2021 15:39:45 -0500 Subject: [PATCH 06/11] Update MotorDrivers.h Add a motor board definition for using the IBT_2 board for a high current to the main track and keep the Arduino Motor Shield for operating the programming track. --- MotorDrivers.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MotorDrivers.h b/MotorDrivers.h index a277bbf..5d4f026 100644 --- a/MotorDrivers.h +++ b/MotorDrivers.h @@ -57,4 +57,9 @@ new MotorDriver(10, 12, UNUSED_PIN, 9, A0, 2.99, 2000, UNUSED_PIN), \ new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 2.99, 2000, UNUSED_PIN) +// IBT_2 Motor Board for Main and Arduino Motor Shield for Prog +#define IBT_2_WITH_ARDUINO("IBT_2_WITH_ARDUINO_SHIELD"), \ + new MotorDriver(4, 5, 6, UNUSED_PIN, A5, 41.54, 5000, UNUSED_PIN), \ + new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 2.99, 2000, UNUSED_PIN) + #endif From 98135ba2def6f474efe8e8422fd28874f3c1ca85 Mon Sep 17 00:00:00 2001 From: Fred Date: Wed, 17 Feb 2021 20:40:03 +0000 Subject: [PATCH 07/11] Committing a SHA --- GITHUB_SHA.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index a22d209..70430b9 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "0228345" +#define GITHUB_SHA "fbb9841" From 313452362624924e4372b3c314be4e01c157ee1c Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 18 Feb 2021 10:24:43 +0000 Subject: [PATCH 08/11] Fix missing F in motor drivers --- MotorDrivers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MotorDrivers.h b/MotorDrivers.h index 5d4f026..b60dfb7 100644 --- a/MotorDrivers.h +++ b/MotorDrivers.h @@ -58,7 +58,7 @@ new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 2.99, 2000, UNUSED_PIN) // IBT_2 Motor Board for Main and Arduino Motor Shield for Prog -#define IBT_2_WITH_ARDUINO("IBT_2_WITH_ARDUINO_SHIELD"), \ +#define IBT_2_WITH_ARDUINO F("IBT_2_WITH_ARDUINO_SHIELD"), \ new MotorDriver(4, 5, 6, UNUSED_PIN, A5, 41.54, 5000, UNUSED_PIN), \ new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 2.99, 2000, UNUSED_PIN) From 57ea4bfe49745f0b2f62203aa82bbbbf621233e0 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 18 Feb 2021 10:25:58 +0000 Subject: [PATCH 09/11] JOIN relay pin --- DCC.cpp | 10 +++++++++- DCC.h | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/DCC.cpp b/DCC.cpp index e9e9cee..591f8c5 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -45,11 +45,18 @@ const byte FN_GROUP_4=0x08; const byte FN_GROUP_5=0x10; FSH* DCC::shieldName=NULL; +byte DCC::joinRelay=UNUSED_PIN; -void DCC::begin(const FSH * motorShieldName, MotorDriver * mainDriver, MotorDriver* progDriver) { +void DCC::begin(const FSH * motorShieldName, MotorDriver * mainDriver, MotorDriver* progDriver, + byte joinRelayPin) { shieldName=(FSH *)motorShieldName; DIAG(F("\n"), F(VERSION), F(ARDUINO_TYPE), shieldName, F(GITHUB_SHA)); + joinRelay=joinRelayPin; + if (joinRelay!=UNUSED_PIN) { + pinMode(joinRelay,OUTPUT); + digitalWrite(joinRelay,HIGH); // high is relay disengaged + } // Load stuff from EEprom (void)EEPROM; // tell compiler not to warn this is unused EEStore::init(); @@ -223,6 +230,7 @@ void DCC::writeCVBitMain(int cab, int cv, byte bNum, bool bValue) { } void DCC::setProgTrackSyncMain(bool on) { + if (joinRelay!=UNUSED_PIN) digitalWrite(joinRelay,on?LOW:HIGH); DCCWaveform::progTrackSyncMain=on; } void DCC::setProgTrackBoost(bool on) { diff --git a/DCC.h b/DCC.h index a7646a8..f1c4aa0 100644 --- a/DCC.h +++ b/DCC.h @@ -64,7 +64,8 @@ const byte MAX_LOCOS = 50; class DCC { public: - static void begin(const FSH * motorShieldName, MotorDriver *mainDriver, MotorDriver *progDriver); + static void begin(const FSH * motorShieldName, MotorDriver *mainDriver, MotorDriver *progDriver, + byte joinRelayPin=UNUSED_PIN); static void loop(); // Public DCC API functions @@ -109,6 +110,7 @@ private: byte groupFlags; unsigned long functions; }; + static byte joinRelay; static byte loopStatus; static void setThrottle2(uint16_t cab, uint8_t speedCode); static void updateLocoReminder(int loco, byte speedCode); From cbf08eff10912ef639f2c88133439791152e717b Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 18 Feb 2021 14:32:29 +0000 Subject: [PATCH 10/11] Swap Join Relay high/low --- DCC.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DCC.cpp b/DCC.cpp index 591f8c5..0560c8b 100644 --- a/DCC.cpp +++ b/DCC.cpp @@ -55,7 +55,7 @@ void DCC::begin(const FSH * motorShieldName, MotorDriver * mainDriver, MotorDriv joinRelay=joinRelayPin; if (joinRelay!=UNUSED_PIN) { pinMode(joinRelay,OUTPUT); - digitalWrite(joinRelay,HIGH); // high is relay disengaged + digitalWrite(joinRelay,LOW); // high is relay disengaged } // Load stuff from EEprom (void)EEPROM; // tell compiler not to warn this is unused @@ -230,7 +230,7 @@ void DCC::writeCVBitMain(int cab, int cv, byte bNum, bool bValue) { } void DCC::setProgTrackSyncMain(bool on) { - if (joinRelay!=UNUSED_PIN) digitalWrite(joinRelay,on?LOW:HIGH); + if (joinRelay!=UNUSED_PIN) digitalWrite(joinRelay,on?HIGH:LOW); DCCWaveform::progTrackSyncMain=on; } void DCC::setProgTrackBoost(bool on) { From f65a32100006fbf30ffb0441b4cc070364d71cfe Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 18 Feb 2021 14:34:30 +0000 Subject: [PATCH 11/11] Hide WIFI_CONNECT_TIMEOUT This is not what the config suggests it is... The timeout is in the ES and defaults to 15 seconds. Abandoning it early leads to confused setup. --- WifiInterface.cpp | 4 +++- config.example.h | 8 -------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/WifiInterface.cpp b/WifiInterface.cpp index 5d04400..4496776 100644 --- a/WifiInterface.cpp +++ b/WifiInterface.cpp @@ -35,7 +35,9 @@ Stream * WifiInterface::wifiStream; #ifndef WIFI_CONNECT_TIMEOUT // Tested how long it takes to FAIL an unknown SSID on firmware 1.7.4. -#define WIFI_CONNECT_TIMEOUT 14000 +// The ES should fail a connect in 15 seconds, we don't want to fail BEFORE that +// or ot will cause issues with the following commands. +#define WIFI_CONNECT_TIMEOUT 16000 #endif //////////////////////////////////////////////////////////////////////////////// diff --git a/config.example.h b/config.example.h index 4105f64..e776b04 100644 --- a/config.example.h +++ b/config.example.h @@ -25,7 +25,6 @@ The configuration file for DCC-EX Command Station // +-----------------------v // #define MOTOR_SHIELD_TYPE STANDARD_MOTOR_SHIELD - ///////////////////////////////////////////////////////////////////////////////////// // // The IP port to talk to a WIFI or Ethernet shield. @@ -77,13 +76,6 @@ The configuration file for DCC-EX Command Station // this line exists or not. If you need to use an alternate channel (we recommend // using only 1,6, or 11) you may change it here. #define WIFI_CHANNEL 1 -// -///////////////////////////////////////////////////////////////////////////////////// -// -// Wifi connect timeout in milliseconds. Default is 14000 (14 seconds). You only need -// to set this if you have an extremely slow Wifi router. -// -//#define WIFI_CONNECT_TIMEOUT 14000 ///////////////////////////////////////////////////////////////////////////////////// //