1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-01-11 21:31:02 +01:00

PIN and SERVO turnout ids

This commit is contained in:
Asbelos 2021-08-14 16:42:56 +01:00
parent 329df3a3ee
commit f1e84330ca
2 changed files with 14 additions and 16 deletions

View File

@ -57,7 +57,7 @@ byte RMFT2::flags[MAX_FLAGS];
DCCEXParser::setRMFTFilter(RMFT2::ComandFilter); DCCEXParser::setRMFTFilter(RMFT2::ComandFilter);
for (int f=0;f<MAX_FLAGS;f++) flags[f]=0; for (int f=0;f<MAX_FLAGS;f++) flags[f]=0;
int progCounter; int progCounter;
// first pass startup, define any turnouts or servos and count size. // first pass startup, define any turnouts or servos, set signals red and count size.
for (progCounter=0;; SKIPOP){ for (progCounter=0;; SKIPOP){
byte opcode=GET_OPCODE; byte opcode=GET_OPCODE;
if (opcode==OPCODE_ENDEXRAIL) break; if (opcode==OPCODE_ENDEXRAIL) break;
@ -81,16 +81,18 @@ byte RMFT2::flags[MAX_FLAGS];
} }
if (opcode==OPCODE_SERVOTURNOUT) { if (opcode==OPCODE_SERVOTURNOUT) {
VPIN id=GET_OPERAND(0); int16_t id=GET_OPERAND(0);
int activeAngle=GET_OPERAND(1); VPIN pin=GET_OPERAND(1);
int inactiveAngle=GET_OPERAND(2); int activeAngle=GET_OPERAND(2);
Turnout::createServo(id,id,activeAngle,inactiveAngle); int inactiveAngle=GET_OPERAND(3);
Turnout::createServo(id,pin,activeAngle,inactiveAngle);
continue; continue;
} }
if (opcode==OPCODE_PINTURNOUT) { if (opcode==OPCODE_PINTURNOUT) {
VPIN id=GET_OPERAND(0); int16_t id=GET_OPERAND(0);
Turnout::createVpin(id,id); VPIN pin=GET_OPERAND(1);
Turnout::createVpin(id,pin);
continue; continue;
} }
// other opcodes are not needed on this pass // other opcodes are not needed on this pass
@ -100,7 +102,7 @@ byte RMFT2::flags[MAX_FLAGS];
new RMFT2(0); // add the startup route new RMFT2(0); // add the startup route
} }
// This filter intercepst <> commands to do the following: // This filter intercepts <> commands to do the following:
// - Implement RMFT specific commands/diagnostics // - Implement RMFT specific commands/diagnostics
// - Reject/modify JMRI commands that would interfere with RMFT processing // - Reject/modify JMRI commands that would interfere with RMFT processing
void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]) { void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]) {
@ -115,10 +117,6 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
} }
break; break;
case 't': // THROTTLE <t [REGISTER] CAB SPEED DIRECTION>
// TODO - Monitor throttle commands and reject any that are in current automation
break;
case '/': // New EXRAIL command case '/': // New EXRAIL command
reject=!parseSlash(stream,paramCount,p); reject=!parseSlash(stream,paramCount,p);
opcode=0; opcode=0;

View File

@ -96,8 +96,8 @@
#define STOP #define STOP
#undef SIGNAL #undef SIGNAL
#define SIGNAL(redpin,amberpin,greenpin) #define SIGNAL(redpin,amberpin,greenpin)
#define SERVO_TURNOUT(pin,activeAngle,inactiveAngle) #define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle)
#define PIN_TURNOUT(pin) #define PIN_TURNOUT(id,pin)
#define THROW(id) #define THROW(id)
#define TURNOUT(id,addr,subaddr) #define TURNOUT(id,addr,subaddr)
#define UNJOIN #define UNJOIN
@ -233,8 +233,8 @@ const int StringMacroTracker1=__COUNTER__;
#define SPEED(speed) OPCODE_SPEED,V(speed), #define SPEED(speed) OPCODE_SPEED,V(speed),
#define STOP OPCODE_SPEED,V(0), #define STOP OPCODE_SPEED,V(0),
#define SIGNAL(redpin,amberpin,greenpin) OPCODE_SIGNAL,V(redpin),OPCODE_PAD,V(amberpin),OPCODE_PAD,V(greenpin), #define SIGNAL(redpin,amberpin,greenpin) OPCODE_SIGNAL,V(redpin),OPCODE_PAD,V(amberpin),OPCODE_PAD,V(greenpin),
#define SERVO_TURNOUT(pin,activeAngle,inactiveAngle) OPCODE_SERVOTURNOUT,V(pin),OPCODE_PAD,V(actibeAngle),OPCODE #define SERVO_TURNOUT(id,pin,activeAngle,inactiveAngle) OPCODE_SERVOTURNOUT,V(id),OPCODE_PAD,V(pin),OPCODE_PAD,V(activeAngle),OPCODE_PAD,V(inactiveAngle),
#define PIN_TURNOUT(pin) OPCODE_PINTURNOUT,V(pin), #define PIN_TURNOUT(id,pin) OPCODE_PINTURNOUT,V(id),OPCODE_PAD,V(pin),
#define THROW(id) OPCODE_THROW,V(id), #define THROW(id) OPCODE_THROW,V(id),
#define TURNOUT(id,addr,subaddr) OPCODE_TURNOUT,V(id),OPCODE_PAD,V(addr),OPCODE_PAD,V(subaddr), #define TURNOUT(id,addr,subaddr) OPCODE_TURNOUT,V(id),OPCODE_PAD,V(addr),OPCODE_PAD,V(subaddr),
#define UNJOIN OPCODE_UNJOIN,NOP, #define UNJOIN OPCODE_UNJOIN,NOP,