diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 669a632..3c7af23 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -360,7 +360,7 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) { // check KILL ALL here, otherwise the next validation confuses ALL with a flag if (p[0]==HASH_KEYWORD_KILL && p[1]==HASH_KEYWORD_ALL) { - while (loopTask) delete loopTask; // destructor changes loopTask + while (loopTask) loopTask->kill(F("KILL ALL")); // destructor changes loopTask return true; } @@ -373,7 +373,7 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) { RMFT2 * task=loopTask; while(task) { if (task->taskId==p[1]) { - delete task; + task->kill(F("KILL")); return true; } task=task->next; @@ -812,7 +812,11 @@ void RMFT2::loop2() { case OPCODE_ENDEXRAIL: kill(); return; - + + case OPCODE_KILLALL: + while(loopTask) loopTask->kill(F("KILLALL")); + return; + case OPCODE_JOIN: DCCWaveform::mainTrack.setPowerMode(POWERMODE::ON); DCCWaveform::progTrack.setPowerMode(POWERMODE::ON); diff --git a/EXRAIL2.h b/EXRAIL2.h index dc33b76..6cc0243 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -49,7 +49,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_ONCLOSE, OPCODE_ONTHROW, OPCODE_SERVOTURNOUT, OPCODE_PINTURNOUT, OPCODE_PRINT,OPCODE_DCCACTIVATE, OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE,OPCODE_IFGTE,OPCODE_IFLT, - OPCODE_ROSTER, + OPCODE_ROSTER,OPCODE_KILLALL, OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE,OPCODE_ENDTASK,OPCODE_ENDEXRAIL }; diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 67939db..06318c7 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -69,6 +69,7 @@ #undef IFTIMEOUT #undef INVERT_DIRECTION #undef JOIN +#undef KILLALL #undef LATCH #undef LCD #undef LCN @@ -166,6 +167,7 @@ #define IFTIMEOUT #define INVERT_DIRECTION #define JOIN +#define KILLALL #define LATCH(sensor_id) #define LCD(row,msg) #define LCN(msg) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 912c6c4..07b75d2 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -215,6 +215,7 @@ const FLASH int16_t RMFT2::SignalDefinitions[] = { #define IFTIMEOUT OPCODE_IFTIMEOUT,0,0, #define INVERT_DIRECTION OPCODE_INVERT_DIRECTION,0,0, #define JOIN OPCODE_JOIN,0,0, +#define KILLALL OPCODE_KILLALL,0,0, #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), #define LCD(id,msg) PRINT(msg) #define LCN(msg) PRINT(msg)