From 349f5d5362c5cd0101508e761d236b8178500286 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 24 Mar 2022 10:40:49 +0000 Subject: [PATCH] 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),