mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 01:56:14 +01:00
FTOGGLE,XFTOGGLE
This commit is contained in:
parent
7a93cf7be8
commit
c7ed47400d
|
@ -816,6 +816,10 @@ void RMFT2::loop2() {
|
||||||
if (loco) DCC::setFn(loco,operand,false);
|
if (loco) DCC::setFn(loco,operand,false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPCODE_FTOGGLE:
|
||||||
|
if (loco) DCC::changeFn(loco,operand);
|
||||||
|
break;
|
||||||
|
|
||||||
case OPCODE_DRIVE:
|
case OPCODE_DRIVE:
|
||||||
{
|
{
|
||||||
byte analogSpeed=IODevice::readAnalogue(operand) *127 / 1024;
|
byte analogSpeed=IODevice::readAnalogue(operand) *127 / 1024;
|
||||||
|
@ -831,6 +835,10 @@ void RMFT2::loop2() {
|
||||||
DCC::setFn(operand,getOperand(1),false);
|
DCC::setFn(operand,getOperand(1),false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPCODE_XFTOGGLE:
|
||||||
|
DCC::changeFn(operand,getOperand(1));
|
||||||
|
break;
|
||||||
|
|
||||||
case OPCODE_DCCACTIVATE: {
|
case OPCODE_DCCACTIVATE: {
|
||||||
// operand is address<<3 | subaddr<<1 | active
|
// operand is address<<3 | subaddr<<1 | active
|
||||||
int16_t addr=operand>>3;
|
int16_t addr=operand>>3;
|
||||||
|
|
|
@ -44,6 +44,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
|
||||||
OPCODE_ENDIF,OPCODE_ELSE,
|
OPCODE_ENDIF,OPCODE_ELSE,
|
||||||
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_DELAYMS,OPCODE_RANDWAIT,
|
OPCODE_DELAY,OPCODE_DELAYMINS,OPCODE_DELAYMS,OPCODE_RANDWAIT,
|
||||||
OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF,
|
OPCODE_FON,OPCODE_FOFF,OPCODE_XFON,OPCODE_XFOFF,
|
||||||
|
OPCODE_FTOGGLE,OPCODE_XFTOGGLE,
|
||||||
OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE,
|
OPCODE_RED,OPCODE_GREEN,OPCODE_AMBER,OPCODE_DRIVE,
|
||||||
OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR,
|
OPCODE_SERVO,OPCODE_SIGNAL,OPCODE_TURNOUT,OPCODE_WAITFOR,
|
||||||
OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN,
|
OPCODE_PAD,OPCODE_FOLLOW,OPCODE_CALL,OPCODE_RETURN,
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
#undef FOLLOW
|
#undef FOLLOW
|
||||||
#undef FON
|
#undef FON
|
||||||
#undef FORGET
|
#undef FORGET
|
||||||
|
#undef FTOGGLE
|
||||||
#undef FREE
|
#undef FREE
|
||||||
#undef FWD
|
#undef FWD
|
||||||
#undef GREEN
|
#undef GREEN
|
||||||
|
@ -181,6 +182,7 @@
|
||||||
#undef WITHROTTLE
|
#undef WITHROTTLE
|
||||||
#undef XFOFF
|
#undef XFOFF
|
||||||
#undef XFON
|
#undef XFON
|
||||||
|
#undef XFTOGGLE
|
||||||
|
|
||||||
#ifndef RMFT2_UNDEF_ONLY
|
#ifndef RMFT2_UNDEF_ONLY
|
||||||
#define ACTIVATE(addr,subaddr)
|
#define ACTIVATE(addr,subaddr)
|
||||||
|
@ -226,6 +228,7 @@
|
||||||
#define FON(func)
|
#define FON(func)
|
||||||
#define FORGET
|
#define FORGET
|
||||||
#define FREE(blockid)
|
#define FREE(blockid)
|
||||||
|
#define FTOGGLE(func)
|
||||||
#define FWD(speed)
|
#define FWD(speed)
|
||||||
#define GREEN(signal_id)
|
#define GREEN(signal_id)
|
||||||
#define HAL(haltype,params...)
|
#define HAL(haltype,params...)
|
||||||
|
@ -340,4 +343,6 @@
|
||||||
#define WITHROTTLE(msg)
|
#define WITHROTTLE(msg)
|
||||||
#define XFOFF(cab,func)
|
#define XFOFF(cab,func)
|
||||||
#define XFON(cab,func)
|
#define XFON(cab,func)
|
||||||
|
#define XFTOGGLE(cab,func)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]) {
|
void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]) {
|
||||||
(void)stream; // avoid compiler warning if we don't access this parameter
|
(void)stream; // avoid compiler warning if we don't access this parameter
|
||||||
bool reject=false;
|
|
||||||
switch(opcode) {
|
switch(opcode) {
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
|
@ -47,8 +47,7 @@ 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);
|
if (parseSlash(stream,paramCount,p)) opcode=0;
|
||||||
opcode=0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'A': // <A address aspect>
|
case 'A': // <A address aspect>
|
||||||
|
@ -106,10 +105,12 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
|
||||||
}
|
}
|
||||||
if (paramCount==1) { // <L eventid> LCC event arrived from adapter
|
if (paramCount==1) { // <L eventid> LCC event arrived from adapter
|
||||||
int16_t eventid=p[0];
|
int16_t eventid=p[0];
|
||||||
reject=eventid<0 || eventid>=countLCCLookup;
|
bool reject = eventid<0 || eventid>=countLCCLookup;
|
||||||
if (!reject) startNonRecursiveTask(F("LCC"),eventid,onLCCLookup[eventid]);
|
if (!reject) {
|
||||||
|
startNonRecursiveTask(F("LCC"),eventid,onLCCLookup[eventid]);
|
||||||
opcode=0;
|
opcode=0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J': // throttle info commands
|
case 'J': // throttle info commands
|
||||||
|
|
|
@ -490,6 +490,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
|
||||||
#define FON(func) OPCODE_FON,V(func),
|
#define FON(func) OPCODE_FON,V(func),
|
||||||
#define FORGET OPCODE_FORGET,0,0,
|
#define FORGET OPCODE_FORGET,0,0,
|
||||||
#define FREE(blockid) OPCODE_FREE,V(blockid),
|
#define FREE(blockid) OPCODE_FREE,V(blockid),
|
||||||
|
#define FTOGGLE(func) OPCODE_FTOGGLE,V(func),
|
||||||
#define FWD(speed) OPCODE_FWD,V(speed),
|
#define FWD(speed) OPCODE_FWD,V(speed),
|
||||||
#define GREEN(signal_id) OPCODE_GREEN,V(signal_id),
|
#define GREEN(signal_id) OPCODE_GREEN,V(signal_id),
|
||||||
#define HAL(haltype,params...)
|
#define HAL(haltype,params...)
|
||||||
|
@ -618,6 +619,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
|
||||||
#endif
|
#endif
|
||||||
#define XFOFF(cab,func) OPCODE_XFOFF,V(cab),OPCODE_PAD,V(func),
|
#define XFOFF(cab,func) OPCODE_XFOFF,V(cab),OPCODE_PAD,V(func),
|
||||||
#define XFON(cab,func) OPCODE_XFON,V(cab),OPCODE_PAD,V(func),
|
#define XFON(cab,func) OPCODE_XFON,V(cab),OPCODE_PAD,V(func),
|
||||||
|
#define XFTOGGLE(cab,func) OPCODE_XFTOGGLE,V(cab),OPCODE_PAD,V(func),
|
||||||
|
|
||||||
// Build RouteCode
|
// Build RouteCode
|
||||||
const int StringMacroTracker2=__COUNTER__;
|
const int StringMacroTracker2=__COUNTER__;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user