mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 00:26:13 +01:00
ONLCC poc
This commit is contained in:
parent
2149f83216
commit
d24a407021
35
EXRAIL2.cpp
35
EXRAIL2.cpp
|
@ -70,6 +70,8 @@ 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';
|
const int16_t HASH_KEYWORD_S='S';
|
||||||
|
const int16_t HASH_KEYWORD_L='L';
|
||||||
|
const int16_t HASH_KEYWORD_E='E';
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -310,6 +312,38 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
|
||||||
}
|
}
|
||||||
StringFormatter::send(stream,F(">\n"));
|
StringFormatter::send(stream,F(">\n"));
|
||||||
opcode=0;
|
opcode=0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (paramCount==1 && p[0]==HASH_KEYWORD_L) { //<JL>
|
||||||
|
// we stream the hex events we wish to listen to
|
||||||
|
// and at the same time build the event index lookup
|
||||||
|
|
||||||
|
LCCSerial=stream;
|
||||||
|
StringFormatter::send(stream,F("<jL"));
|
||||||
|
int eventIndex=0;
|
||||||
|
for (int progCounter=0;; SKIPOP) {
|
||||||
|
byte opcode=GET_OPCODE;
|
||||||
|
if (opcode==OPCODE_ENDEXRAIL) break;
|
||||||
|
if (opcode==OPCODE_ONLCC) {
|
||||||
|
onLCCLookup[eventIndex++]=progCounter; // TODO skip...
|
||||||
|
StringFormatter::send(stream,F(" %x.%x.%x:%x"),
|
||||||
|
getOperand(progCounter,1),
|
||||||
|
getOperand(progCounter,2),
|
||||||
|
getOperand(progCounter,3),
|
||||||
|
getOperand(progCounter,0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringFormatter::send(stream,F(">\n"));
|
||||||
|
opcode=0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (paramCount==2 && p[0]==HASH_KEYWORD_E) { //<JE eventid>
|
||||||
|
reject=p[1]<0 || p[1]>=countLCCLookup;
|
||||||
|
if (reject) break;
|
||||||
|
new RMFT2(onLCCLookup[p[1]]);
|
||||||
|
opcode=0;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -997,6 +1031,7 @@ void RMFT2::loop2() {
|
||||||
case OPCODE_SERVOTURNOUT: // Turnout definition ignored at runtime
|
case OPCODE_SERVOTURNOUT: // Turnout definition ignored at runtime
|
||||||
case OPCODE_PINTURNOUT: // Turnout definition ignored at runtime
|
case OPCODE_PINTURNOUT: // Turnout definition ignored at runtime
|
||||||
case OPCODE_ONCLOSE: // Turnout event catchers ignored here
|
case OPCODE_ONCLOSE: // Turnout event catchers ignored here
|
||||||
|
case OPCODE_ONLCC: // LCC event catchers ignored here
|
||||||
case OPCODE_ONTHROW:
|
case OPCODE_ONTHROW:
|
||||||
case OPCODE_ONACTIVATE: // Activate event catchers ignored here
|
case OPCODE_ONACTIVATE: // Activate event catchers ignored here
|
||||||
case OPCODE_ONDEACTIVATE:
|
case OPCODE_ONDEACTIVATE:
|
||||||
|
|
|
@ -62,7 +62,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
|
||||||
OPCODE_ONCHANGE,
|
OPCODE_ONCHANGE,
|
||||||
OPCODE_ONCLOCKTIME,
|
OPCODE_ONCLOCKTIME,
|
||||||
OPCODE_ONTIME,
|
OPCODE_ONTIME,
|
||||||
OPCODE_LCC,
|
OPCODE_LCC,OPCODE_ONLCC,
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -190,6 +190,8 @@ private:
|
||||||
static LookList * onGreenLookup;
|
static LookList * onGreenLookup;
|
||||||
static LookList * onChangeLookup;
|
static LookList * onChangeLookup;
|
||||||
static LookList * onClockLookup;
|
static LookList * onClockLookup;
|
||||||
|
static const int countLCCLookup;
|
||||||
|
static int onLCCLookup[];
|
||||||
|
|
||||||
// Local variables - exist for each instance/task
|
// Local variables - exist for each instance/task
|
||||||
RMFT2 *next; // loop chain
|
RMFT2 *next; // loop chain
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
#undef ONDEACTIVATE
|
#undef ONDEACTIVATE
|
||||||
#undef ONDEACTIVATEL
|
#undef ONDEACTIVATEL
|
||||||
#undef ONCLOSE
|
#undef ONCLOSE
|
||||||
|
#undef ONLCC
|
||||||
#undef ONTIME
|
#undef ONTIME
|
||||||
#undef ONCLOCKTIME
|
#undef ONCLOCKTIME
|
||||||
#undef ONCLOCKMINS
|
#undef ONCLOCKMINS
|
||||||
|
@ -220,6 +221,7 @@
|
||||||
#define ONDEACTIVATE(addr,subaddr)
|
#define ONDEACTIVATE(addr,subaddr)
|
||||||
#define ONDEACTIVATEL(linear)
|
#define ONDEACTIVATEL(linear)
|
||||||
#define ONCLOSE(turnout_id)
|
#define ONCLOSE(turnout_id)
|
||||||
|
#define ONLCC(sender,event)
|
||||||
#define ONGREEN(signal_id)
|
#define ONGREEN(signal_id)
|
||||||
#define ONRED(signal_id)
|
#define ONRED(signal_id)
|
||||||
#define ONTHROW(turnout_id)
|
#define ONTHROW(turnout_id)
|
||||||
|
|
|
@ -243,6 +243,16 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||||
#include "myAutomation.h"
|
#include "myAutomation.h"
|
||||||
0,0,0,0 };
|
0,0,0,0 };
|
||||||
|
|
||||||
|
// Pass 9 ONLCC counter and lookup array
|
||||||
|
#include "EXRAIL2MacroReset.h"
|
||||||
|
#undef ONLCC
|
||||||
|
#define ONLCC(sender,event) +1
|
||||||
|
|
||||||
|
const int RMFT2::countLCCLookup=0
|
||||||
|
#include "myAutomation.h"
|
||||||
|
;
|
||||||
|
int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
|
||||||
|
|
||||||
// Last Pass : create main routes table
|
// Last Pass : create main routes table
|
||||||
// Only undef the macros, not dummy them.
|
// Only undef the macros, not dummy them.
|
||||||
#define RMFT2_UNDEF_ONLY
|
#define RMFT2_UNDEF_ONLY
|
||||||
|
@ -318,6 +328,10 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||||
#define ONACTIVATEL(linear) OPCODE_ONACTIVATE,V(linear+3),
|
#define ONACTIVATEL(linear) OPCODE_ONACTIVATE,V(linear+3),
|
||||||
#define ONAMBER(signal_id) OPCODE_ONAMBER,V(signal_id),
|
#define ONAMBER(signal_id) OPCODE_ONAMBER,V(signal_id),
|
||||||
#define ONCLOSE(turnout_id) OPCODE_ONCLOSE,V(turnout_id),
|
#define ONCLOSE(turnout_id) OPCODE_ONCLOSE,V(turnout_id),
|
||||||
|
#define ONLCC(sender,event) OPCODE_ONLCC,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 ONTIME(value) OPCODE_ONTIME,V(value),
|
#define ONTIME(value) OPCODE_ONTIME,V(value),
|
||||||
#define ONCLOCKTIME(hours,mins) OPCODE_ONTIME,V((STRIP_ZERO(hours)*60)+STRIP_ZERO(mins)),
|
#define ONCLOCKTIME(hours,mins) OPCODE_ONTIME,V((STRIP_ZERO(hours)*60)+STRIP_ZERO(mins)),
|
||||||
#define ONCLOCKMINS(mins) ONCLOCKTIME(25,mins)
|
#define ONCLOCKMINS(mins) ONCLOCKTIME(25,mins)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "4.2.66"
|
#define VERSION "5.0.1LCC"
|
||||||
// 4.2.66 - Throttle inrush current by applying PWM to brake pin when
|
// 4.2.66 - Throttle inrush current by applying PWM to brake pin when
|
||||||
// fault pin goes active
|
// fault pin goes active
|
||||||
// 4.2.65 - new config WIFI_FORCE_AP option
|
// 4.2.65 - new config WIFI_FORCE_AP option
|
||||||
|
|
Loading…
Reference in New Issue
Block a user