From dcb6b49823af9681a6395a5e98c3953b150dfae8 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Mon, 25 Sep 2023 14:16:00 +0100 Subject: [PATCH] Add LCCX --- EXRAIL2.cpp | 23 ++++++++++++++++++++--- EXRAIL2.h | 2 +- EXRAIL2MacroReset.h | 2 ++ EXRAILMacros.h | 4 ++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 631cc0c..41e749c 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -313,7 +313,14 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16 byte opcode=GET_OPCODE; if (opcode==OPCODE_ENDEXRAIL) break; if (opcode==OPCODE_LCC) StringFormatter::send(stream,F("\n"),getOperand(progCounter,0)); - } + if (opcode==OPCODE_LCCX) { // long form LCC + StringFormatter::send(stream,F("\n"), + getOperand(progCounter,1), + getOperand(progCounter,2), + getOperand(progCounter,3), + getOperand(progCounter,0) + ); + }} // we stream the hex events we wish to listen to // and at the same time build the event index looku. @@ -1010,9 +1017,19 @@ void RMFT2::loop2() { } break; - case OPCODE_LCC: + case OPCODE_LCC: // short form LCC if (LCCSerial) StringFormatter::send(LCCSerial,F(""),(uint16_t)operand); - break; + break; + + case OPCODE_LCCX: // long form LCC + if (LCCSerial) + StringFormatter::send(LCCSerial,F("\n"), + getOperand(progCounter,1), + getOperand(progCounter,2), + getOperand(progCounter,3), + getOperand(progCounter,0) + ); + break; case OPCODE_SERVO: // OPCODE_SERVO,V(vpin),OPCODE_PAD,V(position),OPCODE_PAD,V(profile),OPCODE_PAD,V(duration) IODevice::writeAnalogue(operand,getOperand(1),getOperand(2),getOperand(3)); diff --git a/EXRAIL2.h b/EXRAIL2.h index 908c13e..bc1839f 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -63,7 +63,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_ONCHANGE, OPCODE_ONCLOCKTIME, OPCODE_ONTIME, - OPCODE_LCC,OPCODE_ONLCC, + OPCODE_LCC,OPCODE_LCCX,OPCODE_ONLCC, OPCODE_ONOVERLOAD, // OPcodes below this point are skip-nesting IF operations diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index a952d90..b935337 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -84,6 +84,7 @@ #undef LCD #undef SCREEN #undef LCC +#undef LCCX #undef LCN #undef MOVETT #undef ONACTIVATE @@ -211,6 +212,7 @@ #define KILLALL #define LATCH(sensor_id) #define LCC(eventid) +#define LCCX(senderid,eventid) #define LCD(row,msg) #define SCREEN(display,row,msg) #define LCN(msg) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 0127610..ced0725 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -321,6 +321,10 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup]; #define KILLALL OPCODE_KILLALL,0,0, #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), #define LCC(eventid) OPCODE_LCC,V(eventid), +#define LCCX(sender,event) OPCODE_LCCX,V(event),\ + OPCODE_PAD,V((((uint64_t)sender)>>32)&0xFFFF),\ + OPCODE_PAD,V((((uint64_t)sender)>>16)&0xFFFF),\ + OPCODE_PAD,V((((uint64_t)sender)>>0)&0xFFFF), #define LCD(id,msg) PRINT(msg) #define SCREEN(display,id,msg) PRINT(msg) #define LCN(msg) PRINT(msg)