From 349f5d5362c5cd0101508e761d236b8178500286 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 24 Mar 2022 10:40:49 +0000 Subject: [PATCH 1/5] EXRAIL FORGET current loco --- EXRAIL2.cpp | 7 +++++++ EXRAIL2.h | 2 +- EXRAIL2MacroReset.h | 4 +++- EXRAILMacros.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 2bb75c5..07adedb 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -570,6 +570,13 @@ void RMFT2::loop2() { driveLoco(operand); break; + case OPCODE_FORGET: + if (loco!=0) { + DCC::forgetLoco(loco); + loco=0; + } + break; + case OPCODE_INVERT_DIRECTION: invert= !invert; driveLoco(speedo); diff --git a/EXRAIL2.h b/EXRAIL2.h index fb81d44..dc33b76 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -44,7 +44,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR, OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN, OPCODE_JOIN,OPCODE_UNJOIN,OPCODE_READ_LOCO1,OPCODE_READ_LOCO2,OPCODE_POM, - OPCODE_START,OPCODE_SETLOCO,OPCODE_SENDLOCO, + OPCODE_START,OPCODE_SETLOCO,OPCODE_SENDLOCO,OPCODE_FORGET, OPCODE_PAUSE, OPCODE_RESUME,OPCODE_POWEROFF,OPCODE_POWERON, OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT, OPCODE_PRINT,OPCODE_DCCACTIVATE, diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 7c6bcc9..f87cbf2 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -54,6 +54,7 @@ #undef FOFF #undef FOLLOW #undef FON +#undef FORGET #undef FREE #undef FWD #undef GREEN @@ -148,7 +149,8 @@ #define FADE(pin,value,ms) #define FOFF(func) #define FOLLOW(route) -#define FON(func) +#define FON(func) +#define FORGET #define FREE(blockid) #define FWD(speed) #define GREEN(signal_id) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index e3b0217..1c608e1 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -198,6 +198,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = { #define FOFF(func) OPCODE_FOFF,V(func), #define FOLLOW(route) OPCODE_FOLLOW,V(route), #define FON(func) OPCODE_FON,V(func), +#define FORGET OPCODE_FORGET,0,0, #define FREE(blockid) OPCODE_FREE,V(blockid), #define FWD(speed) OPCODE_FWD,V(speed), #define GREEN(signal_id) OPCODE_GREEN,V(signal_id), From 0040f5caf6f2b123027ca2496f42b8b6fb24f8bb Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 24 Mar 2022 11:10:09 +0000 Subject: [PATCH 2/5] EXRAIL --- EXRAIL2.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 07adedb..c5f77c1 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -63,6 +63,7 @@ const int16_t HASH_KEYWORD_UNLATCH=1353; const int16_t HASH_KEYWORD_PAUSE=-4142; const int16_t HASH_KEYWORD_RESUME=27609; const int16_t HASH_KEYWORD_KILL=5218; +const int16_t HASH_KEYWORD_ALL=3457; const int16_t HASH_KEYWORD_ROUTES=-3702; // One instance of RMFT clas is used for each "thread" in the automation. @@ -362,8 +363,13 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) { if (paramCount!=2 || p[1]<0 || p[1]>=MAX_FLAGS) return false; switch (p[0]) { - case HASH_KEYWORD_KILL: // Kill taskid + case HASH_KEYWORD_KILL: // Kill taskid|ALL { + if (p[1]==HASH_KEYWORD_ALL) { + while (loopTask) delete loopTask; + return true; + } + RMFT2 * task=loopTask; while(task) { if (task->taskId==p[1]) { From 92c2768c0b4903cbdd30d3be7fa1a3f1ef112463 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 24 Mar 2022 11:56:06 +0000 Subject: [PATCH 3/5] EXRAIL VIRTUAL_TURNOUT --- EXRAIL2MacroReset.h | 2 ++ EXRAILMacros.h | 3 +++ version.h | 3 +++ 3 files changed, 8 insertions(+) diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index f87cbf2..67939db 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -114,6 +114,7 @@ #undef TURNOUT #undef UNJOIN #undef UNLATCH +#undef VIRTUAL_TURNOUT #undef WAITFOR #undef XFOFF #undef XFON @@ -210,6 +211,7 @@ #define TURNOUT(id,addr,subaddr,description...) #define UNJOIN #define UNLATCH(sensor_id) +#define VIRTUAL_TURNOUT(id,description...) #define WAITFOR(pin) #define XFOFF(cab,func) #define XFON(cab,func) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 1c608e1..912c6c4 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -102,6 +102,8 @@ void RMFT2::printMessage(uint16_t id) { #define PIN_TURNOUT(id,pin,description...) case id: desc=F("" description); break; #undef SERVO_TURNOUT #define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle,profile,description...) case id: desc=F("" description); break; +#undef VIRTUAL_TURNOUT +#define VIRTUAL_TURNOUT(id,description...) case id: desc=F("" description); break; void RMFT2::emitTurnoutDescription(Print* stream,int16_t turnoutid) { const FSH * desc=F(""); @@ -258,6 +260,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = { #define TURNOUT(id,addr,subaddr,description...) OPCODE_TURNOUT,V(id),OPCODE_PAD,V(addr),OPCODE_PAD,V(subaddr), #define UNJOIN OPCODE_UNJOIN,0,0, #define UNLATCH(sensor_id) OPCODE_UNLATCH,V(sensor_id), +#define VIRTUAL_TURNOUT(id,description...) OPCODE_PINTURNOUT,V(id),OPCODE_PAD,V(0), #define WAITFOR(pin) OPCODE_WAITFOR,V(pin), #define XFOFF(cab,func) OPCODE_XFOFF,V(cab),OPCODE_PAD,V(func), #define XFON(cab,func) OPCODE_XFON,V(cab),OPCODE_PAD,V(func), diff --git a/version.h b/version.h index cb47614..c8e0205 100644 --- a/version.h +++ b/version.h @@ -6,6 +6,9 @@ #define VERSION "4.0.2" // 4.0.2 EXRAIL additions: +// VIRTUAL_TURNOUT +// command to stop all tasks. +// FORGET forgets the current loco in DCC reminder tables. // Servo signals (SERVO_SIGNAL) // High-On signal pins (SIGNALH) // Wait for analog value (ATGTE, ATLT) From 2cd0c169cee0db769f8b15439fc8928ad3bfacc4 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 24 Mar 2022 13:56:01 +0000 Subject: [PATCH 4/5] Cleanup version.h --- version.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/version.h b/version.h index c8e0205..72e7d67 100644 --- a/version.h +++ b/version.h @@ -12,21 +12,22 @@ // Servo signals (SERVO_SIGNAL) // High-On signal pins (SIGNALH) // Wait for analog value (ATGTE, ATLT) -// 4.0.1 EXRAIL BROADCAST("msg") +// 4.0.1 Small EXRAIL updates +// EXRAIL BROADCAST("msg") // EXRAIL POWERON // 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 +// 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. -// Support for analogue inputs on Arduino pins and on ADS111x I2C modules. -// 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 diagnostic command to show configured devices +// Support for MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules. +// Support for PCA9685 PWM (servo) control modules. +// Support for analogue inputs on Arduino pins and on ADS111x I2C modules. +// 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 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. From 6826e01bd31ed123c62fec46dbcabafd7a884d98 Mon Sep 17 00:00:00 2001 From: Kcsmith0708 Date: Thu, 24 Mar 2022 11:34:11 -0400 Subject: [PATCH 5/5] Update version.h (#223) Rewrite & Updated the 4.0.0 Section --- version.h | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/version.h b/version.h index 72e7d67..9abcc7b 100644 --- a/version.h +++ b/version.h @@ -17,34 +17,39 @@ // EXRAIL POWERON // 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. -// Support for analogue inputs on Arduino pins and on ADS111x I2C modules. -// 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 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. -// New EX-RAIL automation capability. -// Turnout class revised to expand turnout capabilities, new commands added. -// Output class now allows ID > 255. -// Configuration options to globally flip polarity of DCC Accessory states when driven -// from command and command. -// Increased use of display for showing loco decoder programming information. +// 'Discovered Server' multicast Dynamic Network Server (mDNS) displays available WiFi connections to a DCC++EX Command Station +// New EX-RAIL "Extended Railroad Automation Instruction Language" automation capability. +// EX-Rail Function commands for creating Automation, Route & Sequence Scripts +// EX-RAIL “ROSTER” Engines Id & Function key layout on Engine Driver or WiThrottle +// EX-RAIL DCC++EX Commands to Control EX-RAIL via JMRI Send pane and IDE Serial monitors +// New JMRI feature enhancements; +// Reads DCC++EX EEPROM & automatically uploades any Signals, DCC Turnouts, Servo Turnouts, Vpin Turnouts , & Output pane +// Turnout class revised to expand turnout capabilities, new commands added. +// Provides for multiple additional DCC++EX WiFi connections as accessory controllers or CS for a programming track when Motor Shields are added +// Supports Multiple Command Station connections and individual tracking of Send DCC++ Command panes and DCC++ Traffic Monitor panes +// New HAL added for I/O (digital and analogue inputs and outputs, servos etc) +// Automatically detects & connects to supported devices included in your config.h file +// Support for MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules. +// Support for PCA9685 PWM (servo) control modules. +// Support for analogue inputs on Arduino pins and on ADS111x I2C modules. +// 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 diagnostic command to show configured devices +// New Processor Support added +// Compiles on Nano Every and Teensy +// Native non-blocking I2C drivers for AVR and Nano architectures (fallback to blocking Wire library for other platforms). // Can disable EEPROM code +// EEPROM layout change - deletes EEPROM contents on first start following upgrade. +// Output class now allows ID > 255. +// Configuration options to globally flip polarity of DCC Accessory states when driven from command and command. +// Increased use of display for showing loco decoder programming information. // 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 -// ... +// Bugfix: Current read from wrong ADC during interrupt +// 3.2.0 Development Release Includes all of 3.1.1 thru 3.1.7 enhancements // 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 // 3.1.5 Fix LCD corruption on power-up