From a2fb58584f489c24ace18f089da954d70b15bdac Mon Sep 17 00:00:00 2001 From: Asbelos Date: Fri, 31 May 2024 19:49:39 +0100 Subject: [PATCH] ACON/ACOF 32 bit + 1=OFF --- EXRAIL2.cpp | 5 +++-- EXRAIL2Parser.cpp | 12 +++++++----- EXRAILMacros.h | 8 ++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 93037d5..b2f29e2 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -1004,8 +1004,9 @@ void RMFT2::loop2() { case OPCODE_ACON: // MERG adapter case OPCODE_ACOF: if ((compileFeatures & FEATURE_LCC) && LCCSerial) - StringFormatter::send(LCCSerial,F(""), - opcode==OPCODE_ACON?'1':'0',(uint16_t)operand); + StringFormatter::send(LCCSerial,F(""), + opcode==OPCODE_ACON?'0':'1', + (uint16_t)operand,getOperand(progCounter,1)); break; case OPCODE_LCCX: // long form LCC diff --git a/EXRAIL2Parser.cpp b/EXRAIL2Parser.cpp index 25ea32c..f174bf8 100644 --- a/EXRAIL2Parser.cpp +++ b/EXRAIL2Parser.cpp @@ -78,8 +78,10 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16 getOperand(progCounter,0) ); } - if (opcode==OPCODE_ACON) StringFormatter::send(stream,F("\n"),getOperand(progCounter,0)); - if (opcode==OPCODE_ACOF) StringFormatter::send(stream,F("\n"),getOperand(progCounter,0)); + if (opcode==OPCODE_ACON) StringFormatter::send(stream,F("\n"), + getOperand(progCounter,0),getOperand(progCounter,1)); + if (opcode==OPCODE_ACOF) StringFormatter::send(stream,F("\n"), + getOperand(progCounter,0),getOperand(progCounter,1)); } // we stream the hex events we wish to listen to @@ -103,10 +105,10 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16 } if (opcode==OPCODE_ONACON || opcode==OPCODE_ONACOF) { onLCCLookup[eventIndex]=progCounter; // TODO skip... - StringFormatter::send(stream,F("\n"), + StringFormatter::send(stream,F("\n"), eventIndex, - opcode==OPCODE_ONACON?'1':'0', - getOperand(progCounter,0) + opcode==OPCODE_ONACON?'0':'1', + getOperand(progCounter,0),getOperand(progCounter,1) ); eventIndex++; } diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 34e9ec7..e4d72a1 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -541,10 +541,10 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup]; 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 ACON(eventid) OPCODE_ACON,V(eventid), -#define ACOF(eventid) OPCODE_ACOF,V(eventid), -#define ONACON(eventid) OPCODE_ONACON,V(eventid), -#define ONACOF(eventid) OPCODE_ONACOF,V(eventid), +#define ACON(eventid) OPCODE_ACON,V(((uint32_t)eventid >>16) & 0xFFFF),OPCODE_PAD,V(eventid & 0xFFFF), +#define ACOF(eventid) OPCODE_ACOF,V(((uint32_t)eventid >>16) & 0xFFFF),OPCODE_PAD,V(eventid & 0xFFFF), +#define ONACON(eventid) OPCODE_ONACON,V((uint32_t)(eventid) >>16),OPCODE_PAD,V(eventid & 0xFFFF), +#define ONACOF(eventid) OPCODE_ONACOF,V((uint32_t)(eventid) >>16),OPCODE_PAD,V(eventid & 0xFFFF), #define LCD(id,msg) PRINT(msg) #define SCREEN(display,id,msg) PRINT(msg) #define STEALTH(code...) PRINT(dummy)