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

TOGGLE_TURNOUT

This commit is contained in:
Asbelos 2024-04-04 09:06:50 +01:00
parent e69b777a2f
commit 72ef199315
4 changed files with 8 additions and 1 deletions

View File

@ -528,6 +528,10 @@ void RMFT2::loop2() {
Turnout::setClosed(operand, true); Turnout::setClosed(operand, true);
break; break;
case OPCODE_TOGGLE_TURNOUT:
Turnout::setClosed(operand, Turnout::isThrown(operand));
break;
#ifndef IO_NO_HAL #ifndef IO_NO_HAL
case OPCODE_ROTATE: case OPCODE_ROTATE:
uint8_t activity; uint8_t activity;

View File

@ -33,7 +33,7 @@
// or more OPCODE_PAD instructions with the subsequent parameters. This wastes a byte but makes // or more OPCODE_PAD instructions with the subsequent parameters. This wastes a byte but makes
// searching easier as a parameter can never be confused with an opcode. // searching easier as a parameter can never be confused with an opcode.
// //
enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE, enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,OPCODE_TOGGLE_TURNOUT,
OPCODE_FWD,OPCODE_REV,OPCODE_SPEED,OPCODE_INVERT_DIRECTION, OPCODE_FWD,OPCODE_REV,OPCODE_SPEED,OPCODE_INVERT_DIRECTION,
OPCODE_RESERVE,OPCODE_FREE, OPCODE_RESERVE,OPCODE_FREE,
OPCODE_AT,OPCODE_AFTER, OPCODE_AT,OPCODE_AFTER,

View File

@ -169,6 +169,7 @@
#undef STEALTH_GLOBAL #undef STEALTH_GLOBAL
#undef STOP #undef STOP
#undef THROW #undef THROW
#undef TOGGLE_TURNOUT
#undef TT_ADDPOSITION #undef TT_ADDPOSITION
#undef TURNOUT #undef TURNOUT
#undef TURNOUTL #undef TURNOUTL
@ -331,6 +332,7 @@
#define STEALTH_GLOBAL(code...) #define STEALTH_GLOBAL(code...)
#define STOP #define STOP
#define THROW(id) #define THROW(id)
#define TOGGLE_TURNOUT(id)
#define TT_ADDPOSITION(turntable_id,position,value,angle,description...) #define TT_ADDPOSITION(turntable_id,position,value,angle,description...)
#define TURNOUT(id,addr,subaddr,description...) #define TURNOUT(id,addr,subaddr,description...)
#define TURNOUTL(id,addr,description...) #define TURNOUTL(id,addr,description...)

View File

@ -606,6 +606,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
#define STASH(id) OPCODE_STASH,V(id), #define STASH(id) OPCODE_STASH,V(id),
#define STOP OPCODE_SPEED,V(0), #define STOP OPCODE_SPEED,V(0),
#define THROW(id) OPCODE_THROW,V(id), #define THROW(id) OPCODE_THROW,V(id),
#define TOGGLE_TURNOUT(id) OPCODE_TOGGLE_TURNOUT,V(id),
#ifndef IO_NO_HAL #ifndef IO_NO_HAL
#define TT_ADDPOSITION(id,position,value,angle,description...) OPCODE_TTADDPOSITION,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(value),OPCODE_PAD,V(angle), #define TT_ADDPOSITION(id,position,value,angle,description...) OPCODE_TTADDPOSITION,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(value),OPCODE_PAD,V(angle),
#endif #endif