diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 0e17ea9..9550b83 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -69,6 +69,7 @@ const int16_t HASH_KEYWORD_ROUTES=-3702; const int16_t HASH_KEYWORD_RED=26099; const int16_t HASH_KEYWORD_AMBER=18713; const int16_t HASH_KEYWORD_GREEN=-31493; +const int16_t HASH_KEYWORD_S='S'; // One instance of RMFT clas is used for each "thread" in the automation. // Each thread manages a loco on a journey through the layout, and/or may manage a scenery automation. @@ -292,11 +293,26 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16 } break; + case '/': // New EXRAIL command reject=!parseSlash(stream,paramCount,p); opcode=0; break; - + + case 'J': + if (paramCount==1 && p[0]==HASH_KEYWORD_S) { // + LCCSerial=stream; + StringFormatter::send(stream,F("")); + opcode=0; + } + break; + default: // other commands pass through break; } @@ -949,7 +965,10 @@ void RMFT2::loop2() { invert=false; } break; - + + case OPCODE_LCC: + if (LCCSerial) StringFormatter::send(LCCSerial,F("<%% %x>\n"),(uint16_t)operand); + 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 4d106e6..be068ae 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -62,6 +62,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, OPCODE_ONCHANGE, OPCODE_ONCLOCKTIME, OPCODE_ONTIME, + OPCODE_LCC, // OPcodes below this point are skip-nesting IF operations // placed here so that they may be skipped as a group diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 588a417..07ac364 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -82,6 +82,7 @@ #undef LATCH #undef LCD #undef SCREEN +#undef LCC #undef LCN #undef MOVETT #undef ONACTIVATE @@ -204,7 +205,8 @@ #define INVERT_DIRECTION #define JOIN #define KILLALL -#define LATCH(sensor_id) +#define LATCH(sensor_id) +#define LCC(eventid) #define LCD(row,msg) #define SCREEN(display,row,msg) #define LCN(msg) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index 66b0111..56ed2f7 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -309,6 +309,7 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = { #define JOIN OPCODE_JOIN,0,0, #define KILLALL OPCODE_KILLALL,0,0, #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), +#define LCC(eventid) OPCODE_LCC,V(eventid), #define LCD(id,msg) PRINT(msg) #define SCREEN(display,id,msg) PRINT(msg) #define LCN(msg) PRINT(msg)