1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 00:26:13 +01:00

Sending LCC events

This commit is contained in:
Asbelos 2023-08-07 22:22:03 +01:00
parent 399030d8ae
commit b0e7506f05
4 changed files with 26 additions and 3 deletions

View File

@ -69,6 +69,7 @@ const int16_t HASH_KEYWORD_ROUTES=-3702;
const int16_t HASH_KEYWORD_RED=26099; const int16_t HASH_KEYWORD_RED=26099;
const int16_t HASH_KEYWORD_AMBER=18713; const int16_t HASH_KEYWORD_AMBER=18713;
const int16_t HASH_KEYWORD_GREEN=-31493; 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. // 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. // 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; break;
case '/': // New EXRAIL command case '/': // New EXRAIL command
reject=!parseSlash(stream,paramCount,p); reject=!parseSlash(stream,paramCount,p);
opcode=0; opcode=0;
break; break;
case 'J':
if (paramCount==1 && p[0]==HASH_KEYWORD_S) { //<JS>
LCCSerial=stream;
StringFormatter::send(stream,F("<jS"));
for (int progCounter=0;; SKIPOP) {
byte opcode=GET_OPCODE;
if (opcode==OPCODE_ENDEXRAIL) break;
if (opcode==OPCODE_LCC) StringFormatter::send(stream,F(" %x"),getOperand(progCounter,0));
}
StringFormatter::send(stream,F("\n>"));
opcode=0;
}
break;
default: // other commands pass through default: // other commands pass through
break; break;
} }
@ -950,6 +966,9 @@ void RMFT2::loop2() {
} }
break; 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) 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)); IODevice::writeAnalogue(operand,getOperand(1),getOperand(2),getOperand(3));

View File

@ -62,6 +62,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_ONCHANGE, OPCODE_ONCHANGE,
OPCODE_ONCLOCKTIME, OPCODE_ONCLOCKTIME,
OPCODE_ONTIME, OPCODE_ONTIME,
OPCODE_LCC,
// OPcodes below this point are skip-nesting IF operations // OPcodes below this point are skip-nesting IF operations
// placed here so that they may be skipped as a group // placed here so that they may be skipped as a group

View File

@ -82,6 +82,7 @@
#undef LATCH #undef LATCH
#undef LCD #undef LCD
#undef SCREEN #undef SCREEN
#undef LCC
#undef LCN #undef LCN
#undef MOVETT #undef MOVETT
#undef ONACTIVATE #undef ONACTIVATE
@ -205,6 +206,7 @@
#define JOIN #define JOIN
#define KILLALL #define KILLALL
#define LATCH(sensor_id) #define LATCH(sensor_id)
#define LCC(eventid)
#define LCD(row,msg) #define LCD(row,msg)
#define SCREEN(display,row,msg) #define SCREEN(display,row,msg)
#define LCN(msg) #define LCN(msg)

View File

@ -309,6 +309,7 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = {
#define JOIN OPCODE_JOIN,0,0, #define JOIN OPCODE_JOIN,0,0,
#define KILLALL OPCODE_KILLALL,0,0, #define KILLALL OPCODE_KILLALL,0,0,
#define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id), #define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id),
#define LCC(eventid) OPCODE_LCC,V(eventid),
#define LCD(id,msg) PRINT(msg) #define LCD(id,msg) PRINT(msg)
#define SCREEN(display,id,msg) PRINT(msg) #define SCREEN(display,id,msg) PRINT(msg)
#define LCN(msg) PRINT(msg) #define LCN(msg) PRINT(msg)