From e4904e40802ca3f1a8e9a6b82d2f06cddd4f81e2 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Thu, 15 Feb 2024 20:05:27 +0000 Subject: [PATCH] Exrail ASPECT(addr,value) --- EXRAIL2.cpp | 5 +++++ EXRAIL2.h | 2 +- EXRAIL2MacroReset.h | 2 ++ EXRAILMacros.h | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 8a2eadf..56aeeb2 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -800,6 +800,11 @@ void RMFT2::loop2() { DCC::setAccessory(addr,subaddr,active); break; } + case OPCODE_ASPECT: { + // operand is address<<5 | value + DCC::setExtendedAccessory(operand>>5, operand & 0x1F); + break; + } case OPCODE_FOLLOW: progCounter=routeLookup->find(operand); diff --git a/EXRAIL2.h b/EXRAIL2.h index ccfbbe6..e8235c6 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -54,7 +54,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, 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, + OPCODE_PRINT,OPCODE_DCCACTIVATE,OPCODE_ASPECT, OPCODE_ONACTIVATE,OPCODE_ONDEACTIVATE, OPCODE_ROSTER,OPCODE_KILLALL, OPCODE_ROUTE,OPCODE_AUTOMATION,OPCODE_SEQUENCE, diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 309c325..633f4d5 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -31,6 +31,7 @@ #undef ALIAS #undef AMBER #undef ANOUT +#undef ASPECT #undef AT #undef ATGTE #undef ATLT @@ -186,6 +187,7 @@ #define AMBER(signal_id) #define ANOUT(vpin,value,param1,param2) #define AT(sensor_id) +#define ASPECT(address,value) #define ATGTE(sensor_id,value) #define ATLT(sensor_id,value) #define ATTIMEOUT(sensor_id,timeout_ms) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 3b579a3..8d870ef 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -117,6 +117,9 @@ static_assert(!hasdup(compileTimeSequenceList[0],1),"Duplicate SEQUENCE/ROUTE/AU // - check range on LATCH/UNLATCH // This pass generates no runtime data or code #include "EXRAIL2MacroReset.h" +#undef ASPECT +#define ASPECT(address,value) static_assert((address & 0x7ff)== address, "invalid Address"); \ + static_assert((value & 0x1F)== value, "Invalid value"); #undef CALL #define CALL(id) static_assert(hasseq(id),"Sequence not found"); #undef FOLLOW @@ -432,6 +435,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup]; #define ALIAS(name,value...) #define AMBER(signal_id) OPCODE_AMBER,V(signal_id), #define ANOUT(vpin,value,param1,param2) OPCODE_SERVO,V(vpin),OPCODE_PAD,V(value),OPCODE_PAD,V(param1),OPCODE_PAD,V(param2), +#define ASPECT(address,value) OPCODE_ASPECT,V((address<<5) | (value & 0x1F)), #define AT(sensor_id) OPCODE_AT,V(sensor_id), #define ATGTE(sensor_id,value) OPCODE_ATGTE,V(sensor_id),OPCODE_PAD,V(value), #define ATLT(sensor_id,value) OPCODE_ATLT,V(sensor_id),OPCODE_PAD,V(value),