1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-29 10:23:45 +02:00

Compare commits

...

37 Commits

Author SHA1 Message Date
Harald Barth
1feaa98ee5 delay long only at write, poweroff short always at rejoi 2022-02-23 14:47:46 +01:00
Fred
3038f29dac Update release_notes_v4.0.0.md 2022-02-17 15:02:49 -05:00
Fred
e57cd1e2aa Update release_notes.md 2022-02-17 15:00:59 -05:00
Fred
c47dd101a5 Update release_notes_v4.0.0.md 2022-02-17 12:29:59 -05:00
Chris Mayo
cf905ce2f3 Clarify config.h entry for an OLED with a SH1106 (#210)
See:
79763a3 ("SH1106 OLED Display Offset Fix (#169)", 2021-06-10)
97f3450 ("Simplify OLED driver initialisation.", 2021-11-24)
2022-02-17 12:21:24 -05:00
Kebbin
4bfcaa605a update release_notes.md (#212) 2022-02-17 08:00:11 -05:00
Fred
557b71c036 Frightrisk update v4 (#209)
* Add Haba's bugfix for analog current reading with interrupts

* Update verson and release notes for 4.0

* remove unwanted changes to newer files
2022-02-16 12:18:43 -05:00
Fred
d0b01e3f03 Frightrisk ver4 (#205)
* Add release notes for verion 4.0

* Add archive release notes

* fix for SHA to modify previous commit instead of using new SHA

* new format for supported boards to allow easy addition of new boards

* Update release_notes.md (#206)

Formatting lines
Server Roster clarification and release 4,0 bug fix  vs 3.1 edit.
added support members

* Some duplication removal and rewording (#207)

WiThrottle and JMRI-related items

Co-authored-by: Fred <fndecker@gmail.com>

* rename config.json to installer.json, fixes for boards(may still be broken)

Co-authored-by: dexslab <dex35803@gmail.com>
Co-authored-by: Kcsmith0708 <kcsmith0708@wowway.com>
Co-authored-by: mstevetodd <mstevetodd@mstevetodd.com>
2022-02-16 12:02:11 -05:00
Dex
bd9a04572d Committing a SHA 2022-02-11 14:53:16 +00:00
Dex
a26d988acc add config.json to master repo for installer (#204) 2022-02-11 09:52:56 -05:00
Asbelos
22bf2b69f1 Committing a SHA 2022-02-04 15:33:26 +00:00
Asbelos
58ef7d25db Remove myAutomation2.h
This file was never intended for release.
2022-02-04 15:33:04 +00:00
Harald Barth
1ec3b173fd Committing a SHA 2022-01-31 22:25:59 +00:00
Harald Barth
07c0004996 Merge branch 'master' of https://github.com/DCC-EX/CommandStation-EX 2022-01-31 22:54:38 +01:00
FrightRisk
99a62883c7 Committing a SHA 2022-01-31 02:51:10 +00:00
FrightRisk
b7af6be1f2 Fix remaining rmft remnants 2022-01-30 21:50:43 -05:00
Fred
eb6b14b848 Committing a SHA 2022-01-31 02:39:51 +00:00
Fred
fa261ec39f Update version.h 2022-01-30 21:39:37 -05:00
Harald Barth
4ebf7978d8 rename all RMFT_ACTIVE to EXTAIL_ACTVE 2022-01-31 03:00:29 +01:00
Harald Barth
a0a635c167 version 2022-01-31 00:05:13 +01:00
Harald Barth
ca0c34f9fa Merge branch 'currentsenseirq' 2022-01-31 00:03:35 +01:00
Harald Barth
b6501c7e3e revert to write ERROR 2022-01-30 23:58:34 +01:00
Harald Barth
8af74f7082 protect analog read with cli() 2022-01-30 23:56:16 +01:00
Fred
75598b2b8b Committing a SHA 2022-01-30 17:31:41 +00:00
Fred
bd7c8bf78e Rename RMFT files and references to EXRAIL (#201)
Make naming consistent with our marketing of ex-rail for files and defines

* Rename RMFT.h to EXRAIL.h

* Rename RMFT2.cpp to EXRAIL2.cpp

* Rename RMFT2.h to EXRAIL2.h

* Rename RMFT2MacroReset.h to EXRAIL2MacroReset.h

* Rename RMFTMacros.h to EXRAILMacros.h

* Rename RMFT references to EXRAIL
2022-01-30 12:31:26 -05:00
Harald Barth
05545321a9 Committing a SHA 2022-01-23 17:55:49 +00:00
Harald Barth
03f7014c02 spell example right 2022-01-23 18:55:00 +01:00
Harald Barth
306f100085 Merge branch 'master' of https://github.com/DCC-EX/CommandStation-EX 2022-01-17 19:01:58 +01:00
Asbelos
509014bb6a Committing a SHA 2022-01-17 15:56:37 +00:00
Asbelos
f577c11eb7 Correct ack diag msgs
Bug caused by unsigned ints >32k being displayed as negative int.
2022-01-17 15:56:16 +00:00
Harald Barth
73ea7a1479 compiles on Nano Every 2022-01-15 20:23:58 +01:00
Harald Barth
f807339eec suggested code readability improvement by compiler warning 2022-01-15 20:21:28 +01:00
Harald Barth
b4aa47a451 Committing a SHA 2022-01-15 16:24:52 +00:00
Harald Barth
1416f83f8c Serial check, mostly for Teensy, does not impact startup if Serial is available 2022-01-15 17:24:18 +01:00
Asbelos
d5955a36bf Committing a SHA 2022-01-11 11:22:42 +00:00
Asbelos
35f7ac3d77 Teensy compatibility issues 2022-01-11 11:22:20 +00:00
Harald Barth
41cda58bef Committing a SHA 2022-01-08 20:47:13 +00:00
32 changed files with 762 additions and 295 deletions

View File

@@ -24,10 +24,11 @@ jobs:
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
- uses: EndBug/add-and-commit@v8 # You can change this to use a specific version
with:
add: 'GITHUB_SHA.h'
message: 'Committing a SHA'
commit: --amend
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged

2
.gitignore vendored
View File

@@ -7,7 +7,7 @@ Release/*
.pio/
.vscode/
config.h
.vscode/extensions.json
.vscode/*
mySetup.h
mySetup.cpp
myHal.cpp

View File

@@ -3,5 +3,8 @@
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}

View File

@@ -91,7 +91,7 @@ void setup()
// STANDARD_MOTOR_SHIELD, POLOLU_MOTOR_SHIELD, FIREBOX_MK1, FIREBOX_MK1S are pre defined in MotorShields.h
DCC::begin(MOTOR_SHIELD_TYPE);
// Start RMFT (ignored if no automnation)
// Start RMFT aka EX-RAIL (ignored if no automnation)
RMFT::begin();

35
DCC.cpp
View File

@@ -33,7 +33,7 @@
#include "version.h"
#include "FSH.h"
#include "IODevice.h"
#include "RMFT2.h"
#include "EXRAIL2.h"
#include "CommandDistributor.h"
// This module is responsible for converting API calls into
@@ -252,7 +252,7 @@ void DCC::setAccessory(int address, byte number, bool activate) {
b[1] = ((((address / 64) % 8) << 4) + (number % 4 << 1) + activate % 2) ^ 0xF8; // second byte is of the form 1AAACDDD, where C should be 1, and the least significant D represent activate/deactivate
DCCWaveform::mainTrack.schedulePacket(b, 2, 4); // Repeat the packet four times
#if defined(RMFT_ACTIVE)
#if defined(EXRAIL_ACTIVE)
RMFT2::activateEvent(address<<2|number,activate);
#endif
}
@@ -772,7 +772,7 @@ void DCC::ackManagerLoop() {
if (DCCWaveform::progTrack.getPowerMode()==POWERMODE::OVERLOAD) return;
if (checkResets(DCCWaveform::progTrack.autoPowerOff || ackManagerRejoin ? 20 : 3)) return;
DCCWaveform::progTrack.setAckBaseline();
callbackState=READY;
callbackState=AFTER_READ;
break;
case W0: // write 0 bit
case W1: // write 1 bit
@@ -958,6 +958,7 @@ void DCC::callback(int value) {
switch (callbackState) {
case AFTER_WRITE: // first attempt to callback after a write operation
// If no poweroff and no rejoin planned, continue without delay.
if (!ackManagerRejoin && !DCCWaveform::progTrack.autoPowerOff) {
callbackState=READY;
break;
@@ -966,20 +967,24 @@ void DCC::callback(int value) {
callbackState=WAITING_100;
if (Diag::ACK) DIAG(F("Stable 100mS"));
break;
case WAITING_100: // waiting for 100mS
case AFTER_READ:
// If we are going to power off anyway, it doesnt matter
// but if we will keep the power on, we must off it for 30mS
// If we do not plan do rejoin, we don't need to power off either
if (DCCWaveform::progTrack.autoPowerOff || !ackManagerRejoin) {
callbackState=READY;
} else {
DCCWaveform::progTrack.setPowerMode(POWERMODE::OFF);
callbackStart=millis();
callbackState=WAITING_30;
if (Diag::ACK) DIAG(F("OFF 30mS"));
}
break;
case WAITING_100: // waiting for 100mS for decoder write to settle
if (millis()-callbackStart < 100) break;
// stable after power maintained for 100mS
// If we are going to power off anyway, it doesnt matter
// but if we will keep the power on, we must off it for 30mS
if (DCCWaveform::progTrack.autoPowerOff) callbackState=READY;
else { // Need to cycle power off and on
DCCWaveform::progTrack.setPowerMode(POWERMODE::OFF);
callbackStart=millis();
callbackState=WAITING_30;
if (Diag::ACK) DIAG(F("OFF 30mS"));
}
// still may need to do the 30mS delay
callbackState=AFTER_READ;
break;
case WAITING_30: // waiting for 30mS with power off

1
DCC.h
View File

@@ -73,6 +73,7 @@ enum ackOp : byte
enum CALLBACK_STATE : byte {
AFTER_WRITE, // Start callback sequence after something was written to the decoder
AFTER_READ, // Start callback sequence after something was read from the decoder
WAITING_100, // Waiting for 100mS of stable power
WAITING_30, // waiting to 30ms of power off gap.
READY, // Ready to complete callback

View File

@@ -43,7 +43,7 @@
#include "Turnouts.h"
#include "Sensors.h"
#include "Outputs.h"
#include "RMFT.h"
#include "EXRAIL.h"
#include "CommandDistributor.h"
#endif

View File

@@ -741,10 +741,10 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
LCD(1, F("Ack Limit=%dmA"), p[2]); // <D ACK LIMIT 42>
} else if (p[1] == HASH_KEYWORD_MIN) {
DCCWaveform::progTrack.setMinAckPulseDuration(p[2]);
LCD(0, F("Ack Min=%dus"), p[2]); // <D ACK MIN 1500>
LCD(0, F("Ack Min=%uus"), p[2]); // <D ACK MIN 1500>
} else if (p[1] == HASH_KEYWORD_MAX) {
DCCWaveform::progTrack.setMaxAckPulseDuration(p[2]);
LCD(0, F("Ack Max=%dus"), p[2]); // <D ACK MAX 9000>
LCD(0, F("Ack Max=%uus"), p[2]); // <D ACK MAX 9000>
} else if (p[1] == HASH_KEYWORD_RETRY) {
if (p[2] >255) p[2]=3;
LCD(0, F("Ack Retry=%d Sum=%d"), p[2], DCC::setAckRetry(p[2])); // <D ACK RETRY 2>
@@ -886,7 +886,7 @@ void DCCEXParser::callback_R(int16_t result)
void DCCEXParser::callback_Rloco(int16_t result) {
const FSH * detail;
if (result<=0) {
detail=F("<r ERROR %d>\n");
detail=F("<r %d>\n");
} else {
bool longAddr=result & LONG_ADDR_MARKER; //long addr
if (longAddr)

View File

@@ -289,7 +289,7 @@ void DCCWaveform::setAckBaseline() {
if (isMainTrack) return;
int baseline=motorDriver->getCurrentRaw();
ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA);
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %dus and %dus"),
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %uus and %uus"),
baseline,motorDriver->raw2mA(baseline),
ackThreshold,motorDriver->raw2mA(ackThreshold),
minAckPulseDuration, maxAckPulseDuration);
@@ -309,7 +309,7 @@ void DCCWaveform::setAckPending() {
byte DCCWaveform::getAck() {
if (ackPending) return (2); // still waiting
if (Diag::ACK) DIAG(F("%S after %dmS max=%d/%dmA pulse=%duS samples=%d gaps=%d"),ackDetected?F("ACK"):F("NO-ACK"), ackCheckDuration,
if (Diag::ACK) DIAG(F("%S after %dmS max=%d/%dmA pulse=%uuS samples=%d gaps=%d"),ackDetected?F("ACK"):F("NO-ACK"), ackCheckDuration,
ackMaxCurrent,motorDriver->raw2mA(ackMaxCurrent), ackPulseDuration, numAckSamples, numAckGaps);
if (ackDetected) return (1); // Yes we had an ack
return(0); // pending set off but not detected means no ACK.

View File

@@ -1,8 +1,8 @@
#ifndef RMFT_H
#define RMFT_H
#ifndef EXRAIL_H
#define EXRAIL_H
#if defined(RMFT_ACTIVE)
#include "RMFT2.h"
#if defined(EXRAIL_ACTIVE)
#include "EXRAIL2.h"
class RMFT {
public:
@@ -10,7 +10,7 @@
static void inline loop() {RMFT2::loop();}
};
#include "RMFTMacros.h"
#include "EXRAILMacros.h"
#else
// Dummy RMFT

View File

@@ -42,7 +42,7 @@
#include <Arduino.h>
#include "RMFT2.h"
#include "EXRAIL2.h"
#include "DCC.h"
#include "DCCWaveform.h"
#include "DIAG.h"
@@ -681,7 +681,7 @@ void RMFT2::loop2() {
break;
case OPCODE_IFRANDOM: // do block on random percentage
if (random(100)>=operand) if (!skipIfBlock()) return;
if ((int16_t)random(100)>=operand) if (!skipIfBlock()) return;
break;
case OPCODE_IFRESERVE: // do block if we successfully RERSERVE

View File

@@ -18,8 +18,8 @@
* You should have received a copy of the GNU General Public License
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef RMFT2_H
#define RMFT2_H
#ifndef EXRAIL2_H
#define EXRAIL2_H
#include "FSH.h"
#include "IODevice.h"

View File

@@ -19,8 +19,8 @@
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef RMFTMacros_H
#define RMFTMacros_H
#ifndef EXRAILMacros_H
#define EXRAILMacros_H
// remove normal code LCD & SERIAL macros (will be restored later)
#undef LCD
@@ -50,13 +50,13 @@
// CAUTION: The macros below are multiple passed over myAutomation.h
// Pass 1 Implements aliases
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
#undef ALIAS
#define ALIAS(name,value) const int name=value;
#include "myAutomation.h"
// Pass 2 convert descriptions to withrottle format emitter function
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
#undef ROUTE
#define ROUTE(id, description) emitRouteDescription(stream,'R',id,F(description));
#undef AUTOMATION
@@ -67,7 +67,7 @@ void RMFT2::emitWithrottleDescriptions(Print * stream) {
}
// Pass 3... Create Text sending functions
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
const int StringMacroTracker1=__COUNTER__;
#undef PRINT
#define PRINT(msg) case (__COUNTER__ - StringMacroTracker1) : printMessage2(F(msg));break;
@@ -93,7 +93,7 @@ void RMFT2::printMessage(uint16_t id) {
// Pass 4: Turnout descriptions (optional)
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
#undef TURNOUT
#define TURNOUT(id,addr,subaddr,description...) case id: desc=F("" description); break;
#undef PIN_TURNOUT
@@ -112,7 +112,7 @@ void RMFT2::emitTurnoutDescription(Print* stream,int16_t turnoutid) {
}
// Pass 5: Roster names (count)
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
#undef ROSTER
#define ROSTER(cabid,name,funcmap...) +1
@@ -121,7 +121,7 @@ const byte RMFT2::rosterNameCount=0
;
// Pass 6: Roster names emitter
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
#undef ROSTER
#define ROSTER(cabid,name,funcmap...) StringFormatter::send(stream,(FSH *)format,F(name),cabid,cabid<128?'S':'L');
void RMFT2::emitWithrottleRoster(Print * stream) {
@@ -133,7 +133,7 @@ void RMFT2::emitWithrottleRoster(Print * stream) {
}
// Pass 7: functions getter
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
#undef ROSTER
#define ROSTER(cabid,name,funcmap...) case cabid: return F("" funcmap);
const FSH * RMFT2::getRosterFunctions(int16_t cabid) {
@@ -144,7 +144,7 @@ const FSH * RMFT2::getRosterFunctions(int16_t cabid) {
}
// Pass 8 Signal definitions
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
#undef SIGNAL
#define SIGNAL(redpin,amberpin,greenpin) redpin,amberpin,greenpin,
const FLASH int16_t RMFT2::SignalDefinitions[] = {
@@ -154,7 +154,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = {
// Last Pass : create main routes table
// Only undef the macros, not dummy them.
#define RMFT2_UNDEF_ONLY
#include "RMFT2MacroReset.h"
#include "EXRAIL2MacroReset.h"
// Define internal helper macros.
// Everything we generate here has to be compile-time evaluated to
// a constant.

View File

@@ -1 +1 @@
#define GITHUB_SHA "61390cb"
#define GITHUB_SHA "a26d988"

View File

@@ -72,7 +72,7 @@ void I2CManagerClass::I2C_sendStart() {
bytesToReceive = currentRequest->readLen;
// If anything to send, initiate write. Otherwise initiate read.
if (operation == OPERATION_READ || (operation == OPERATION_REQUEST & !bytesToSend))
if (operation == OPERATION_READ || ((operation == OPERATION_REQUEST) & !bytesToSend))
TWI0.MADDR = (currentRequest->i2cAddress << 1) | 1;
else
TWI0.MADDR = (currentRequest->i2cAddress << 1) | 0;
@@ -157,4 +157,4 @@ ISR(TWI0_TWIM_vect) {
I2CManagerClass::handleInterrupt();
}
#endif
#endif

View File

@@ -98,22 +98,20 @@ uint8_t I2CManagerClass::read(uint8_t address, uint8_t readBuffer[], uint8_t rea
* returned in the I2CRB as for the asynchronous version.
***************************************************************************/
void I2CManagerClass::queueRequest(I2CRB *req) {
uint8_t status;
switch (req->operation) {
case OPERATION_READ:
status = read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
req->status = read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
break;
case OPERATION_SEND:
status = write(req->i2cAddress, req->writeBuffer, req->writeLen, req);
req->status = write(req->i2cAddress, req->writeBuffer, req->writeLen, req);
break;
case OPERATION_SEND_P:
status = write_P(req->i2cAddress, req->writeBuffer, req->writeLen, req);
req->status = write_P(req->i2cAddress, req->writeBuffer, req->writeLen, req);
break;
case OPERATION_REQUEST:
status = read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req);
req->status = read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req);
break;
}
req->status = status;
}
/***************************************************************************

View File

@@ -152,16 +152,16 @@ int MotorDriver::getCurrentRaw() {
bool irq = disableInterrupts();
current = analogRead(currentPin)-senseOffset;
enableInterrupts(irq);
#elif defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY35)|| defined(ARDUINO_TEENSY36)
#else // Uno, Mega and all the TEENSY3* but not TEENSY4*
unsigned char sreg_backup;
sreg_backup = SREG; /* save interrupt enable/disable state */
cli();
current = analogRead(currentPin)-senseOffset;
#if defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY35)|| defined(ARDUINO_TEENSY36)
overflow_count = 0;
SREG = sreg_backup; /* restore interrupt state */
#else
current = analogRead(currentPin)-senseOffset;
#endif
if (sreg_backup & 128) sei(); /* restore interrupt state */
#endif // outer #
if (current<0) current=0-current;
if ((faultPin != UNUSED_PIN) && isLOW(fastFaultPin) && isHIGH(fastPowerPin))
return (current == 0 ? -1 : -current);

View File

@@ -100,4 +100,11 @@
new MotorDriver(6, 7, UNUSED_PIN, UNUSED_PIN, UNUSED_PIN, 1.0, 1100, UNUSED_PIN), \
new MotorDriver(5, 4, UNUSED_PIN, UNUSED_PIN, UNUSED_PIN, 1.0, 1100, UNUSED_PIN)
// This is an example how to setup a motor shield definition for a motor shield connected
// to an NANO EVERY board. You have to make the connectons from the shield to the board
// as in this example or adjust the values yourself.
#define NANOEVERY_EXAMPLE F("NANOEVERY_EXAMPLE"), \
new MotorDriver(5, 6, UNUSED_PIN, UNUSED_PIN, A0, 2.99, 2000, UNUSED_PIN),\
new MotorDriver(9, 10, UNUSED_PIN, UNUSED_PIN, A1, 2.99, 2000, UNUSED_PIN)
#endif

View File

@@ -0,0 +1,284 @@
Version 4.0 Release Notes
*************************
The DCC-EX Team is pleased to release CommandStation-EX-v4.0.0 as a Production Release. Release v4.0.0 is a Major release that adds significant new product design, plus Automation features and bug fixes. The team continues improving the architecture of DCC++EX to make it more flexible and optimizing the code so as to get more performance from the Arduino (and other) microprocessors. This release includes all of the Point Releases from v3.2.0 to v3.2.0 rc13.
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.zip)
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v0.0.0-Prod/CommandStation-EX.tar.gz)
**Known Issues**
- **Wi-Fi** - Requires sending `<AT>` commands from a serial monitor if you want to switch between AP mode and STA station mode after initial setup
- **Pololu Motor Shield** - is supported with this release, but the user may have to adjust timings to enable programming mode due to limitations in its current sensing circuitry
**All New Major DCC++EX 4.0.0 features**
- **New HAL Hardware Abstraction Layer API** that automatically detects and greatly simplifies interfacing to many predefined accessory boards for servos, signals & sensors and added I/O (digital and analog inputs and outputs, servos etc).
- HAL Support for;
- MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.
- PCA9685 PWM (servo & signal) control modules.
- Analogue inputs on Arduino pins and on ADS111x I2C modules.
- MP3 sound playback via DFPlayer module.
- HC-SR04 Ultrasonic range sensor module.
- VL53L0X Laser range sensor module (Time-Of-Flight).
- A new `<D HAL SHOW>` command to list the HAL devices attached to the command station
**New Command Station Broadcast throttle logic**
- Synchronizes multiple WiThrottles and PC based JMRI Throttles for direction, speed and F-key updates
**New Discovered Servers on WiFi Throttles**
- Our New multicast Dynamic Network Server (mDNS) enhancement allows us to display the available WiFi server connections to a DCC++EX Command Station. Selecting it allows your WiThrottle App to connect to and load Server Rosters and function keys to your throttle from the new DCC++EX Command Station Server Roster.
**New DCC++EX 4.0.0 with EX-RAIL Extended Railroad Automation Instruction Language**
- Use to control your entire layout or as a separate accessory/animation controller
- Awesome, cleverly powerful yet simple user friendly scripting language for user built Automation & Routing scripts.
- You can control Engines, Sensors, Turnouts, Signals, Outputs and Accessories that are entered into your new myAutomation.h file, then uploaded into the DCC++EX Command Station.
- EX-RAIL scripts are automatically displayed as Automation {Handoff} and Route {Set} buttons on supported WiFi Throttle Apps.
**New EX-RAIL Roster Feature**
- List and store user defined engine roster & function keys inside the command station, and automatically load them in WiFi Throttle Apps.
- When choosing “DCC++EX” from discovered servers an Engine Driver or WiThrottle is directly connected to the Command Station.
- The EX-RAIL ROSTER command allows all the engine numbers, names and function keys youve listed in your myAutomation.h file to automatically upload the Command Station's Server Roster into your Engine Driver and WiThrottle Apps.
**New JMRI 4.99.2 and above specific DCC++EX 4.0 features**
- Enhanced JMRI DCC++ Configure Base Station pane for building and maintaining Sensor, Turnout and Output devices, or these can automatically be populated from the DCC++EX Command Station's mySetup.h file into JMRI.
- JMRI now supports multiple serial connected DCC++EX Command Stations, to display and track separate "Send DCC++ Command" and "DCC++ Traffic" Monitors for each Command Station at the same time.
For example: Use an Uno DCC++EX DecoderPro Programming Station {DCC++Prg} on a desktop programming track and a second Mega DCC++EX EX-RAIL Command Station for Operations {DCC++Ops} on the layout with an additional `<JOINED>` programming spur or siding track for acquiring an engine and Drive Away onto the mainline (see the DriveAway feature for more information).
**DCC++EX 4.0.0 additional product enhancements**
- Additional Motor Shields and Motor Board {boosters) supported
- Additional Accessory boards supported for GPIO expansion, Sensors, Servos & Signals
- Additional diagnostic commands like D ACK RETRY and D EXRAIL ON events, D HAL SHOW devices and D SERVO positions, and D RESET the command station while maintaining the serial connection with JMRI
- Automatic retry on failed ACK detection to give decoders another chance
- New EX-RAIL / slash command allows JMRI to directly communicate with many EX-RAIL scripts
- Turnout class revised to expand turnout capabilities and allow turnout names/descriptors to display in WiThrottle Apps.
- Build turnouts through either or both mySetup.h and myAutomation.h files, and have them automatically passed to, and populate, JMRI Turnout Tables
- Turnout user names display in Engine Driver & WiThrottles
- Output class now allows ID > 255.
- Configuration options to globally flip polarity of DCC Accessory states when driven from `<a>` command and `<T>` command.
- Increased use of display for showing loco decoder programming information.
- Can disable EEPROM memory code to allow room for DCC++EX 4.0 to fit on a Uno Command Station
- Can define border between long and short addresses
- Native non-blocking I2C drivers for AVR and Nano architectures (fallback to blocking Wire library for other platforms).
- EEPROM layout change - deletes EEPROM contents on first start following upgrade.
**4.0.0 Bug Fixes**
- Compiles on Nano Every
- Diagnostic display of ack pulses >32ms
- Current read from wrong ADC during interrupt
- AT(+) Command Pass Through
- CiDAP WiFi Drop out and the WiThrottle F-key looping error corrected
- One-off error in CIPSEND drop
- Common Fault Pin Error
- Uno Memory Utilization optimized
#### Summary of Release 3.1.0 key features and/or bug fixes by Point Release
**Summary of the key new features added to CommandStation-EX V3.0.16**
- Ignore CV1 bit 7 read if rejected by a non NMRA compliant decoder when identifying loco id
**Summary of the key new features added to CommandStation-EX V3.0.15**
- Send function commands just once instead of repeating them 4 times
**Summary of the key new features added to CommandStation-EX V3.0.14**
- Add feature to tolerate decoders that incorrectly have gaps in their ACK pulse
- Provide proper track power management when joining and unjoining tracks with <1 JOIN>
**Summary of the key new features added to CommandStation-EX V3.0.13**
- Fix for CAB Functions greater than 127
**Summary of the key new features added to CommandStation-EX V3.0.12**
- Fixed clear screen issue for nanoEvery and nanoWifi
**Summary of the key new features added to CommandStation-EX V3.0.11**
- Reorganized files for support of 128 speed steps
**Summary of the key new features added to CommandStation-EX V3.0.10**
- Added Support for the Teensy 3.2, 3.5, 3.6, 4.0 and 4.1 MCUs
- No functional change just changes to avoid complier warnings for Teensy/nanoEvery
**Summary of the key new features added to CommandStation-EX V3.0.9**
- Rearranges serial newlines for the benefit of JMRI
- Major update for efficiencies in displays (LCD, OLED)
- Add I2C Support functions
**Summary of the key new features added to CommandStation-EX V3.0.8**
- Wraps <* *> around DIAGS for the benefit of JMRI
**Summary of the key new features added to CommandStation-EX V3.0.7**
- Implemented support for older 28 apeed step decoders - Option to turn on 28 step speed decoders in addition to 128. If set, all locos will use 28 steps.
- Improved overload messages with raw values (relative to offset)
**Summary of the key new features added to CommandStation-EX V3.0.6**
- Prevent compiler warning about deprecated B constants
- Fix Bug that did not let us transmit 5 byte sized packets - 5 Byte commands like PoM (programming on main) were not being sent correctly
- Support for Huge function numbers (DCC BinaryStateControl) - Support Functions beyond F28
- <!> ESTOP all - New command to emergency stop all locos on the main track
- <- [cab]> estop and forget cab/all cabs - Stop and remove loco from the CS. Stops the repeating throttle messages
- `<D RESET>` command to reboot Arduino
- Automatic sensor offset detect
- Improved startup msgs from Motor Drivers (accuracy and auto sense factors)
- Drop post-write verify - No need to double check CV writes. Writes are now even faster.
- Allow current sense pin set to UNUSED_PIN - No need to ground an unused analog current pin. Produce startup warning and callback -2 for prog track cmds.
**Summary of the key new features added to CommandStation-EX V3.0.5**
- Fix Fn Key startup with loco ID and fix state change for F16-28
- Removed ethernet mac config and made it automatic
- Show wifi ip and port on lcd
- Auto load config.example.h with warning
- Dropped example .ino files
- Corrected .ino comments
- Add Pololu fault pin handling
- Waveform speed/simplicity improvements
- Improved pin speed in waveform
- Portability to nanoEvery and UnoWifiRev2 CPUs
- Analog read speed improvements
- Drop need for DIO2 library
- Improved current check code
- Linear command
- Removed need for ArduinoTimers files
- Removed option to choose different timer
- Added EX-RAIL hooks for automation in future version
- Fixed Turnout list
- Allow command keywords in mixed case
- Dropped unused memstream
- PWM pin accuracy if requirements met
**Summary of the key new features added to CommandStation-EX V3.0.4**
- "Drive-Away" Feature - added so that throttles like Engine Driver can allow a loco to be programmed on a usable, electrically isolated programming track and then drive off onto the main track
- WiFi Startup Fixes
**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 `<c>` 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 `<s>` command output
**CommandStation-EX V3.0.0:**
**Release v3.0.0 was a major rewrite if earlier versions of DCC++. The code base was re-architeced and core changes were made to the Waveform generator to reduce overhead and make better use of Arduino.** **Summary of the key new features added in Release v3.0.0 include:**
- **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** - `<F>` command allows setting functions based on their number, not based on a code as in `<f>`
- **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 `<D>` 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 management** - slot variable in throttle/function commands are ignored and slot management is taken care of automatically. `<->` and `<- CAB>` commands added to release locos from memory and stop packets to the track.
**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)
- Neil McKechnie - Worcestershire, UK (NeilMck)
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
- M Steve Todd - Oregon, USA (MSteveTodd)
- Scott Catalano - Pennsylvania
- Gregor Baues - Île-de-France, France (grbba)
**Engine Driver and JMRI Interface**
- M Steve Todd
**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 - Rochester Hills, Michigan USA (KC Smith)
- Colin Grabham - Central NSW, Australia (Kebbin)
**WebThrotle-EX**
- Fred Decker - Holly Springs, NC (FlightRisk/FrightRisk)
- Mani Kumar - Bangalor, India (Mani /Mani Kumar)
- Matt H - Somewhere in Europe
**Beta Testing / Release Management / Support**
- Larry Dribin - Release Management
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
- Herb Morton - Kingwood Texas, USA (Ash++)
- Keith Ledbetter
- Brad Van der Elst
- Andrew Pye
- Mike Bowers
- Randy McKenzie
- Roberto Bravin
- Sam Brigden
- Alan Lautenslager
- Martin Bafver
- Mário André Silva
- Anthony Kochevar
- Gajanatha Kobbekaduwe
- Sumner Patterson
- Paul - Virginia, USA
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.zip)
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.tar.gz)

View File

@@ -1,5 +1,6 @@
/*
* © 2021 Chris Harlow
* © 2022 Harald Barth
* All rights reserved.
*
* This file is part of DCC++EX
@@ -19,29 +20,33 @@
*/
#include "SerialManager.h"
#include "DCCEXParser.h"
SerialManager * SerialManager::first=NULL;
#include "DCCEXParser.h"
SerialManager * SerialManager::first=NULL;
SerialManager::SerialManager(HardwareSerial * myserial) {
serial=myserial;
next=first;
first=this;
bufferLength=0;
myserial->begin(115200);
inCommandPayload=false;
}
SerialManager::SerialManager(Stream * myserial) {
serial=myserial;
next=first;
first=this;
bufferLength=0;
inCommandPayload=false;
}
void SerialManager::init() {
while (!Serial && millis() < 5000); // wait max 5s for Serial to start
Serial.begin(115200);
new SerialManager(&Serial);
#ifdef SERIAL3_COMMANDS
new SerialManager(&Serial3);
Serial3.begin(115200);
new SerialManager(&Serial3);
#endif
#ifdef SERIAL2_COMMANDS
new SerialManager(&Serial2);
Serial2.begin(115200);
new SerialManager(&Serial2);
#endif
#ifdef SERIAL1_COMMANDS
new SerialManager(&Serial1);
Serial1.begin(115200);
new SerialManager(&Serial1);
#endif
new SerialManager(&Serial);
}
void SerialManager::broadcast(RingStream * ring) {

View File

@@ -37,10 +37,10 @@ public:
private:
static SerialManager * first;
SerialManager(HardwareSerial * myserial);
SerialManager(Stream * myserial);
void loop2();
void broadcast2(RingStream * ring);
HardwareSerial * serial;
Stream * serial;
SerialManager * next;
byte bufferLength;
byte buffer[COMMAND_BUFFER_SIZE];

View File

@@ -99,6 +99,7 @@ void StringFormatter::send2(Print * stream,const FSH* format, va_list args) {
case 'E': printEscapes(stream,(const FSH*)va_arg(args, char*)); break;
case 'S': stream->print((const FSH*)va_arg(args, char*)); break;
case 'd': printPadded(stream,va_arg(args, int), formatWidth, formatLeft); break;
case 'u': printPadded(stream,va_arg(args, unsigned int), formatWidth, formatLeft); break;
case 'l': printPadded(stream,va_arg(args, long), formatWidth, formatLeft); break;
case 'b': stream->print(va_arg(args, int), BIN); break;
case 'o': stream->print(va_arg(args, int), OCT); break;

View File

@@ -30,7 +30,7 @@
#endif
#include "StringFormatter.h"
#include "CommandDistributor.h"
#include "RMFT2.h"
#include "EXRAIL2.h"
#include "Turnouts.h"
#include "DCC.h"
#include "LCN.h"
@@ -114,7 +114,7 @@
// I know it says setClosedStateOnly, but we need to tell others
// that the state has changed too.
#if defined(RMFT_ACTIVE)
#if defined(EXRAIL_ACTIVE)
RMFT2::turnoutEvent(id, closeFlag);
#endif
@@ -147,7 +147,7 @@
EEPROM.put(tt->_eepromAddress, tt->_turnoutData.flags);
#endif
#if defined(RMFT_ACTIVE)
#if defined(EXRAIL_ACTIVE)
RMFT2::turnoutEvent(id, closeFlag);
#endif

View File

@@ -53,7 +53,7 @@
#include "DIAG.h"
#include "GITHUB_SHA.h"
#include "version.h"
#include "RMFT2.h"
#include "EXRAIL2.h"
#include "CommandDistributor.h"
#define LOOPLOCOS(THROTTLECHAR, CAB) for (int loco=0;loco<MAX_MY_LOCO;loco++) \
@@ -121,7 +121,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
for(Turnout *tt=Turnout::first();tt!=NULL;tt=tt->next()){
int id=tt->getId();
StringFormatter::send(stream,F("]\\[%d}|{"), id);
#ifdef RMFT_ACTIVE
#ifdef EXRAIL_ACTIVE
RMFT2::emitTurnoutDescription(stream,id);
#else
StringFormatter::send(stream,F("%d"), id);
@@ -133,9 +133,9 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
}
else if (!exRailSent) {
// Send ExRail routes list if not already sent (but not at same time as turnouts above)
// Send EX-RAIL routes list if not already sent (but not at same time as turnouts above)
exRailSent=true;
#ifdef RMFT_ACTIVE
#ifdef EXRAIL_ACTIVE
RMFT2::emitWithrottleRouteList(stream);
#endif
// allow heartbeat to slow down once all metadata sent
@@ -156,7 +156,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
DCCWaveform::progTrack.setPowerMode(cmd[3]=='1'?POWERMODE::ON:POWERMODE::OFF);
CommandDistributor::broadcastPower();
}
#if defined(RMFT_ACTIVE)
#if defined(EXRAIL_ACTIVE)
else if (cmd[1]=='R' && cmd[2]=='A' && cmd[3]=='2' ) { // Route activate
// exrail routes are RA2Rn , Animations are RA2An
int route=getInt(cmd+5);
@@ -205,7 +205,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
StringFormatter::send(stream,F("HtDCC-EX v%S, %S, %S, %S\n"), F(VERSION), F(ARDUINO_TYPE), DCC::getMotorShieldName(), F(GITHUB_SHA));
StringFormatter::send(stream,F("PTT]\\[Turnouts}|{Turnout]\\[THROW}|{2]\\[CLOSE}|{4\n"));
StringFormatter::send(stream,F("PPA%x\n"),DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON);
#ifdef RMFT_ACTIVE
#ifdef EXRAIL_ACTIVE
RMFT2::emitWithrottleRoster(stream);
#endif
// set heartbeat to 1 second because we need to sync the metadata
@@ -287,7 +287,7 @@ void WiThrottle::multithrottle(RingStream * stream, byte * cmd){
int fkeys=29;
myLocos[loco].functionToggles=1<<2; // F2 (HORN) is a non-toggle
#ifdef RMFT_ACTIVE
#ifdef EXRAIL_ACTIVE
const char * functionNames=(char *) RMFT2::getRosterFunctions(locoid);
if (!functionNames) {
// no roster, use presets as above

View File

@@ -125,7 +125,7 @@ The configuration file for DCC-EX Command Station
//OR define OLED_DRIVER width,height in pixels (address auto detected)
// 128x32 or 128x64 I2C SSD1306-based devices are supported.
// Also 132x64 I2C SH1106 devices
// Use 132,64 for a SH1106-based I2C device with a 128x64 display.
// #define OLED_DRIVER 128,32
// Define scroll mode as 0, 1 or 2
@@ -189,8 +189,8 @@ The configuration file for DCC-EX Command Station
// To monitor a throttle on one or more serial ports, uncomment the defines below.
// NOTE: do not define here the WiFi shield serial port or your wifi will not work.
//
//#define SERIAL1_COMMAND
//#define SERIAL2_COMMAND
//#define SERIAL3_COMMAND
//#define SERIAL1_COMMANDS
//#define SERIAL2_COMMANDS
//#define SERIAL3_COMMANDS
/////////////////////////////////////////////////////////////////////////////////////

View File

@@ -40,7 +40,7 @@
// WIFI_ON: All prereqs for running with WIFI are met
// Note: WIFI_CHANNEL may not exist in early config.h files so is added here if needed.
#if (defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_SAMD_ZERO) || defined(TEENSYDUINO))
#if (defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_SAMD_ZERO) || defined(TEENSYDUINO)) || defined(ARDUINO_AVR_NANO_EVERY)
#define BIG_RAM
#endif
#if ENABLE_WIFI
@@ -81,7 +81,7 @@
#if __has_include ( "myAutomation.h")
#if defined(BIG_RAM) || defined(DISABLE_EEPROM)
#define RMFT_ACTIVE
#define EXRAIL_ACTIVE
#else
#define EXRAIL_WARNING
#endif

270
installer.json Normal file
View File

@@ -0,0 +1,270 @@
[
{
"Name": "BaseStationClassic",
"Git": "DCC-EX/BaseStation-Classic",
"Libraries": [
{
"Name": "Ethernet",
"Repo": "arduino-libraries/Ethernet",
"Location": "libraries/Ethernet",
"LibraryDownloadAvailable": true
}
],
"SupportedBoards": [
{
"Name": "Uno",
"FQBN": "arduino:avr:uno",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
},
{
"Name": "Mega",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
}
],
"DisplayName": "Base Station Classic",
"InputFileLocation": "DCCpp",
"AllowAdvanced": false,
"ConfigFile": "DCCpp/Config.h"
},
{
"Name": "CommandStation-EX",
"Git": "DCC-EX/CommandStation-EX",
"Libraries": [
{
"Name": "Ethernet",
"Repo": "arduino-libraries/Ethernet",
"Location": "libraries/Ethernet",
"LibraryDownloadAvailable": true
},
{
"Name": "DIO2",
"Repo": "",
"Location": "libraries/DIO2",
"LibraryDownloadAvailable": true
}
],
"SupportedBoards": [
{
"Name": "Uno",
"FQBN": "arduino:avr:uno",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
},
{
"Name": "Mega",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
},
{
"Name": "Mega Wifi",
"FQBN": "arduino:avr:mega",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
},
{
"Name": "Nano",
"FQBN": "arduino:avr:nano",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
},
{
"Name": "Nano Every",
"FQBN": "arduino:megaavr:nanoevery",
"Platforms": [
{
"Architecture": "megaavr",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
},
{
"Name": "Teensy 3.x",
"FQBN": "teensy:avr:teensy31",
"Platforms": [
{
"Architecture": "teensy",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
},
{
"Name": "Teensy 4.x",
"FQBN": "teensy:avr:teensy41",
"Platforms": [
{
"Architecture": "teensy",
"Package": "arduino"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
}
],
"ExtraLibraries": []
},
{
"Name": "SAMD21",
"FQBN": "SparkFun:samd",
"Platforms": [
{
"Architecture": "avr",
"Package": "arduino"
},
{
"Architecture": "samd",
"Package": "arduino"
},
{
"Architecture": "samd",
"Package": "SparkFun"
}
],
"SupportedMotoShields": [
{
"Name": "Arduino Motor Shield",
"Declaration": "STANDARD_MOTOR_SHIELD"
},
{
"Name": "Pololu MC33926 Motor Shield",
"Declaration": "POLOLU_MOTOR_SHIELD"
},
{
"Name": "FireBox MK1",
"Declaration": "FIREBOX_MK1"
},
{
"Name": "FireBox MK1S",
"Declaration": "FIREBOX_MK1S"
}
],
"ExtraLibraries": []
}
],
"DisplayName": "CommandStation EX",
"InputFileLocation": "",
"AllowAdvanced": true,
"ConfigFile": "config.h"
}
]

View File

@@ -1,5 +1,5 @@
/* This is an automation example file.
* The presence of a file calle "myAutomation.h" brings EX-RAIL code into
* The presence of a file called "myAutomation.h" brings EX-RAIL code into
* the command station.
* The auotomation may have multiple concurrent tasks.
* A task may

View File

@@ -1,192 +0,0 @@
/* This is an automation example file.
* The presence of a file calle "myAutomation.h" brings EX-RAIL code into
* the command station.
* The auotomation may have multiple concurrent tasks.
* A task may drive one loco through a ROUTE or may simply
* automate some other part of the layout without any loco.
*
* At startup, a single task is created to execute the first
* instruction after ROUTES.
* This task may simply follow a route, or may SCHEDULE
* further tasks (thats is.. send a loco out along a route).
*
* Where the loco id is not known at compile time, a new task
* can be creatd with the command:
* </ SCHEDULE [cab] route>
*
*/
// Include the name to pin mappings for my layout
#include "myLayout.h"
ALIAS(ROUTE_1,1)
ALIAS(UP_MOUNTAIN,8)
ALIAS(UP_MOUNTAIN_FROM_PROG,88)
ALIAS(INNER_LOOP,7)
ALIAS(INNER_FROM_PROG,77)
//EXRAIL // myAutomation must start with the EXRAIL instruction
// This is the default starting route, AKA ROUTE(0)
// START(999) // this is just a diagnostic test cycle
PRINT("started")
LCD(0,"EXRAIL RULES")
SERIAL("I had one of them but the leg fell off!")
DONE // This just ends the startup thread
/*AUTOSTART*/ ROUTE(ROUTE_1,"Close All")
LCD(1,"Bingo")
CLOSE(TOP_TURNOUT) DELAY(10)
CLOSE(Y_TURNOUT) DELAY(10)
CLOSE(MIDDLE_TURNOUT) DELAY(10)
CLOSE(JOIN_TURNOUT) DELAY(10)
CLOSE(LOWER_TURNOUT) DELAY(10)
CLOSE(CROSSOVER_TURNOUT) DELAY(10)
CLOSE(PROG_TURNOUT) DELAY(10)
PRINT("Close All completed")
ENDTASK
SEQUENCE(UP_MOUNTAIN) // starting at the lower closed turnout siding and going up the mountain
PRINT("Up Mountain started")
DELAY(10000) // wait 10 seconds
RESERVE(BLOCK_LOWER_MOUNTAIN)
CLOSE(LOWER_TURNOUT) CLOSE(JOIN_TURNOUT)
FWD(60) AT(Y_LOWER)
RESERVE(BLOCK_X_MOUNTAIN)
CLOSE(Y_TURNOUT) CLOSE(MIDDLE_TURNOUT)
FWD(40) AT(MIDDLE_C_BUFFER) STOP
FREE(BLOCK_X_MOUNTAIN) FREE(BLOCK_LOWER_MOUNTAIN)
DELAY(10000)
RESERVE(BLOCK_UPPER_MOUNTAIN) RESERVE(BLOCK_X_MOUNTAIN)
CLOSE(MIDDLE_TURNOUT) THROW(Y_TURNOUT) THROW(TOP_TURNOUT)
REV(55)
AFTER(Y_UPPER) FREE(BLOCK_X_MOUNTAIN)
REV(55) AT(TOP_T_BUFFER) STOP // At top of mountain
FREE(BLOCK_UPPER_MOUNTAIN)
DELAY(5000)
RESERVE(BLOCK_UPPER_MOUNTAIN)
THROW(TOP_TURNOUT)
FWD(60) AT(Y_UPPER)
RESERVE(BLOCK_X_MOUNTAIN)
THROW(Y_TURNOUT) CLOSE(MIDDLE_TURNOUT)
FWD(40) AT(MIDDLE_C_BUFFER) STOP
FREE(BLOCK_UPPER_MOUNTAIN) FREE(BLOCK_X_MOUNTAIN)
DELAY(6000)
RESERVE(BLOCK_LOWER_MOUNTAIN) RESERVE(BLOCK_X_MOUNTAIN)
CLOSE(MIDDLE_TURNOUT) CLOSE(Y_TURNOUT) CLOSE(JOIN_TURNOUT) CLOSE(LOWER_TURNOUT)
REV(60)
AFTER(Y_LOWER) FREE(BLOCK_X_MOUNTAIN)
AT(LOWER_C_BUFFER) STOP
FREE(BLOCK_LOWER_MOUNTAIN)
FOLLOW(UP_MOUNTAIN)
AUTOMATION(UP_MOUNTAIN_FROM_PROG,"Send up mountain from prog")
JOIN
RESERVE(BLOCK_LOWER_MOUNTAIN)
RESERVE(BLOCK_X_INNER)
RESERVE(BLOCK_X_OUTER)
// safe to cross
THROW(PROG_TURNOUT) THROW(CROSSOVER_TURNOUT) THROW(JOIN_TURNOUT)
FWD(45)
AFTER(JOIN_AFTER) STOP
CLOSE(PROG_TURNOUT) CLOSE(CROSSOVER_TURNOUT) CLOSE(JOIN_TURNOUT)
FREE(BLOCK_X_OUTER) FREE(BLOCK_X_INNER)
CLOSE(LOWER_TURNOUT)
REV(40) AT(LOWER_C_BUFFER) STOP
FREE(BLOCK_LOWER_MOUNTAIN)
FOLLOW(UP_MOUNTAIN)
SEQUENCE(INNER_LOOP)
FWD(50)
AT(CROSSOVER_INNER_BEFORE)
RESERVE(BLOCK_X_INNER)
CLOSE(CROSSOVER_TURNOUT)
FWD(50)
AFTER(CROSSOVER_INNER_AFTER)
FREE(BLOCK_X_INNER)
FOLLOW(INNER_LOOP)
// Turnout definitions
TURNOUT(TOP_TURNOUT, TOP_TURNOUT,0,"Top Station")
TURNOUT(Y_TURNOUT, Y_TURNOUT,0,"Mountain join")
TURNOUT(MIDDLE_TURNOUT, MIDDLE_TURNOUT,0,"Middle Station")
TURNOUT(JOIN_TURNOUT,JOIN_TURNOUT,0)
TURNOUT(LOWER_TURNOUT,LOWER_TURNOUT,0)
TURNOUT(CROSSOVER_TURNOUT,CROSSOVER_TURNOUT,0)
TURNOUT(PROG_TURNOUT,PROG_TURNOUT,0)
// Single slip protection
ONTHROW(2)
THROW(1)
DONE
ONCLOSE(1)
CLOSE(2)
DONE
ROUTE(61,"Call return test")
PRINT("In 61 test 1")
CALL(62)
PRINT("In 61 test 2")
CALL(62)
PRINT("In 61 test 3")
ACTIVATE(100,2)
DEACTIVATE(100,2)
DONE
SEQUENCE(62)
PRINT("In seq 62")
RETURN
ROUTE(63,"Signal test 40,41,42")
SIGNAL(40,41,42)
DELAY(2000)
RED(40)
DELAY(2000)
AMBER(40)
DELAY(2000)
GREEN(40)
FOLLOW(63)
ROUTE(64,"Func test 6772")
XFON(6772,1)
DELAY(5000)
XFOFF(6772,1)
DELAY(5000)
FOLLOW(64)
ROUTE(65,"Negative sensor test")
PRINT(" WAIT for -176")
AT(-176)
PRINT(" WAIT for 176")
AT(176)
PRINT("done")
DONE
ROUTE(123,"Activate stuff")
ACTIVATEL(5)
ACTIVATE(7,2)
DEACTIVATE(3,2)
DEACTIVATEL(6)
DONE
ONACTIVATEL(5)
PRINT("ACT 5")
DONE
ONACTIVATE(7,2)
PRINT("ACT 7,2")
DONE
ONDEACTIVATE(7,2)
PRINT("DEACT 7,2")
DONE
ONDEACTIVATEL(5)
PRINT("DEACT 5")
DONE

View File

@@ -1,16 +1,88 @@
The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production Release. Release v3.1.0 is a minor release that adds additional features and fixes a number of bugs. With the number of new features, this could have easily been a major release. The team is continually improving the architecture of DCC++EX to make it more flexible and optimizing the code so as to get more performance from the Arduino (and other) microprocessors. This release includes all of the Point Releases from v3.0.1 to v3.0.16.
The DCC-EX Team is pleased to release CommandStation-EX-v4.0.0 as a Production Release. Release v4.0.0 is a Major release that adds significant new product design, plus Automation features and bug fixes. The team continues improving the architecture of DCC++EX to make it more flexible and optimizing the code so as to get more performance from the Arduino (and other) microprocessors. This release includes all of the Point Releases from v3.2.0 to v3.2.0 rc13.
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v3.1.0-Prod/CommandStation-EX.zip)
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v3.1.0-Prod/CommandStation-EX.tar.gz)
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.zip)
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v0.0.0-Prod/CommandStation-EX.tar.gz)
**Known Issues**
- **Wi-Fi** - works, but requires sending <AT> commands from a serial monitor if you want to switch between AP mode and STA station mode after initial setup
- **Pololu Motor Shield** - is supported with this release, but the user may have to adjust timings to enable programming mode due to limitation in its current sensing circuitry
- **Wi-Fi** - Requires sending `<AT>` commands from a serial monitor if you want to switch between AP mode and STA station mode after initial setup
- **Pololu Motor Shield** - is supported with this release, but the user may have to adjust timings to enable programming mode due to limitations in its current sensing circuitry
#### Summary of key features and/or bug fixes by Point Release
**All New Major DCC++EX 4.0.0 features**
- **New HAL Hardware Abstraction Layer API** that automatically detects and greatly simplifies interfacing to many predefined accessory boards for servos, signals & sensors and added I/O (digital and analog inputs and outputs, servos etc).
- HAL Support for;
- MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.
- PCA9685 PWM (servo & signal) control modules.
- Analogue inputs on Arduino pins and on ADS111x I2C modules.
- MP3 sound playback via DFPlayer module.
- HC-SR04 Ultrasonic range sensor module.
- VL53L0X Laser range sensor module (Time-Of-Flight).
- A new `<D HAL SHOW>` command to list the HAL devices attached to the command station
**New Command Station Broadcast throttle logic**
- Synchronizes multiple WiThrottles and PC based JMRI Throttles for direction, speed and F-key updates
**New Discovered Servers on WiFi Throttles**
- Our New multicast Dynamic Network Server (mDNS) enhancement allows us to display the available WiFi server connections to a DCC++EX Command Station. Selecting it allows your WiThrottle App to connect to and load Server Rosters and function keys to your throttle from the new DCC++EX Command Station Server Roster.
**New DCC++EX 4.0.0 with EX-RAIL Extended Railroad Automation Instruction Language**
- Use to control your entire layout or as a separate accessory/animation controller
- Awesome, cleverly powerful yet simple user friendly scripting language for user built Automation & Routing scripts.
- You can control Engines, Sensors, Turnouts, Signals, Outputs and Accessories that are entered into your new myAutomation.h file, then uploaded into the DCC++EX Command Station.
- EX-RAIL scripts are automatically displayed as Automation {Handoff} and Route {Set} buttons on supported WiFi Throttle Apps.
**New EX-RAIL Roster Feature**
- List and store user defined engine roster & function keys inside the command station, and automatically load them in WiFi Throttle Apps.
- When choosing “DCC++EX” from discovered servers an Engine Driver or WiThrottle is directly connected to the Command Station.
- The EX-RAIL ROSTER command allows all the engine numbers, names and function keys youve listed in your myAutomation.h file to automatically upload the Command Station's Server Roster into your Engine Driver and WiThrottle Apps.
**New JMRI 4.99.2 and above specific DCC++EX 4.0 features**
- Enhanced JMRI DCC++ Configure Base Station pane for building and maintaining Sensor, Turnout and Output devices, or these can automatically be populated from the DCC++EX Command Station's mySetup.h file into JMRI.
- JMRI now supports multiple serial connected DCC++EX Command Stations, to display and track separate "Send DCC++ Command" and "DCC++ Traffic" Monitors for each Command Station at the same time.
For example: Use an Uno DCC++EX DecoderPro Programming Station {DCC++Prg} on a desktop programming track and a second Mega DCC++EX EX-RAIL Command Station for Operations {DCC++Ops} on the layout with an additional `<JOINED>` programming spur or siding track for acquiring an engine and Drive Away onto the mainline (see the DriveAway feature for more information).
**DCC++EX 4.0.0 additional product enhancements**
- Additional Motor Shields and Motor Board {boosters) supported
- Additional Accessory boards supported for GPIO expansion, Sensors, Servos & Signals
- Additional diagnostic commands like D ACK RETRY and D EXRAIL ON events, D HAL SHOW devices and D SERVO positions, and D RESET the command station while maintaining the serial connection with JMRI
- Automatic retry on failed ACK detection to give decoders another chance
- New EX-RAIL / slash command allows JMRI to directly communicate with many EX-RAIL scripts
- Turnout class revised to expand turnout capabilities and allow turnout names/descriptors to display in WiThrottle Apps.
- Build turnouts through either or both mySetup.h and myAutomation.h files, and have them automatically passed to, and populate, JMRI Turnout Tables
- Turnout user names display in Engine Driver & WiThrottles
- Output class now allows ID > 255.
- Configuration options to globally flip polarity of DCC Accessory states when driven from `<a>` command and `<T>` command.
- Increased use of display for showing loco decoder programming information.
- Can disable EEPROM memory code to allow room for DCC++EX 4.0 to fit on a Uno Command Station
- Can define border between long and short addresses
- Native non-blocking I2C drivers for AVR and Nano architectures (fallback to blocking Wire library for other platforms).
- EEPROM layout change - deletes EEPROM contents on first start following upgrade.
**4.0.0 Bug Fixes**
- Compiles on Nano Every
- Diagnostic display of ack pulses >32ms
- Current read from wrong ADC during interrupt
- AT(+) Command Pass Through
- CiDAP WiFi Drop out and the WiThrottle F-key looping error corrected
- One-off error in CIPSEND drop
- Common Fault Pin Error
- Uno Memory Utilization optimized
#### Summary of Release 3.1.0 key features and/or bug fixes by Point Release
**Summary of the key new features added to CommandStation-EX V3.0.16**
@@ -154,7 +226,7 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production R
- Neil McKechnie - Worcestershire, UK (NeilMck)
- Fred Decker - Holly Springs, North Carolina, USA (FlightRisk)
- Dave Cutting - Logan, Utah, USA (Dave Cutting/ David Cutting)
- M Steve Todd -
- M Steve Todd - Oregon, USA (MSteveTodd)
- Scott Catalano - Pennsylvania
- Gregor Baues - Île-de-France, France (grbba)
@@ -174,6 +246,7 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production R
- Roger Beschizza - Dorset, UK (Roger Beschizza)
- Keith Ledbetter - Chicago, Illinois, USA (Keith Ledbetter)
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
- Colin Grabham - Central NSW, Australia (Kebbin)
**WebThrotle-EX**
@@ -185,13 +258,14 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production R
- Larry Dribin - Release Management
- Kevin Smith - Rochester Hills, Michigan USA (KC Smith)
- Herb Morton - Kingwood Texas, USA (Ash++)
- Keith Ledbetter
- BradVan der Elst
- Brad Van der Elst
- Andrew Pye
- Mike Bowers
- Randy McKenzie
- Roberto Bravin
- Sim Brigden
- Sam Brigden
- Alan Lautenslager
- Martin Bafver
- Mário André Silva
@@ -202,5 +276,7 @@ The DCC-EX Team is pleased to release CommandStation-EX-v3.1.0 as a Production R
**Downloads (zip and tar.gz) below. These are named without version number in the folder name to make the Arduino IDE happy.**
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v3.1.0-Prod/CommandStation-EX.zip)
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v3.1.0-Prod/CommandStation-EX.tar.gz)
[CommandStation-EX.zip](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.zip)
[CommandStation-EX.tar.gz](https://github.com/DCC-EX/CommandStation-EX/releases/download/v4.0.0-Prod/CommandStation-EX.tar.gz)

View File

@@ -3,8 +3,12 @@
#include "StringFormatter.h"
#define VERSION "3.2.0 rc10"
// 3.2.0 Major functional and non-functional changes.
#define VERSION "4.0.0"
// 4.0.0 Major functional and non-functional changes.
// Engine Driver "DriveAway" feature enhancement
//.......JMRI feature enhancement. Provides for multiple additional DCC++EX wifi
//.........connections as accessory controllers or CS for a programming track when
//.........motor shield is added
// New HAL added for I/O (digital and analogue inputs and outputs, servos etc).
// Support for MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.
// Support for PCA9685 PWM (servo) control modules.
@@ -12,6 +16,7 @@
// Support for MP3 sound playback via DFPlayer module.
// Support for HC-SR04 Ultrasonic range sensor module.
// Support for VL53L0X Laser range sensor module (Time-Of-Flight).
//.........Added <D HAL SHOW> diagnostic command to show configured devices
// Native non-blocking I2C drivers for AVR and Nano architectures (fallback
// to blocking Wire library for other platforms).
// EEPROM layout change - deletes EEPROM contents on first start following upgrade.
@@ -25,6 +30,9 @@
// Can define border between long and short addresses
// Turnout and accessory states (thrown/closed = 0/1 or 1/0) can be set to match RCN-213
// Bugfix: one-off error in CIPSEND drop
// Compiles on Nano Every
// Bugfix: disgnostic display of ack pulses >32kus
//.......Bugfix: Current read from wrong ADC during interrupt
// ...
// 3.1.7 Bugfix: Unknown locos should have speed forward
// 3.1.6 Make output ID two bytes and guess format/size of registered outputs found in EEPROM