diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index c7a61dc..05b93d9 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]) { @@ -574,6 +580,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 960e97f..578b2fe 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 0ae54b8..5766635 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 @@ -114,6 +115,7 @@ #undef TURNOUT #undef UNJOIN #undef UNLATCH +#undef VIRTUAL_TURNOUT #undef WAITFOR #undef XFOFF #undef XFON @@ -149,7 +151,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) @@ -210,6 +213,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 0e22cd4..19d862d 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(""); @@ -198,6 +200,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), @@ -258,6 +261,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 2772cd6..940aeb5 100644 --- a/version.h +++ b/version.h @@ -9,13 +9,17 @@ // SET_TRACK(track,mode) Functions (A-H, MAIN|PROG|DC|DCX|OFF) // New DC track function and DCX reverse polarity function // TrackManager DCC & DC up to 8 Districts Architecture -// 4.0.2 EXRAIL additions: // Automatic ALIAS(name) -// DCCEXPArser.cpp now accepts Underscore in Alias Names +// Command Parser now accepts Underscore in Alias Names +// 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) -// 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