Skip to content

Commit

Permalink
TOGGLE_TURNOUT
Browse files Browse the repository at this point in the history
  • Loading branch information
Asbelos committed Apr 4, 2024
1 parent e69b777 commit 72ef199
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions EXRAIL2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@ void RMFT2::loop2() {
Turnout::setClosed(operand, true);
break;

case OPCODE_TOGGLE_TURNOUT:
Turnout::setClosed(operand, Turnout::isThrown(operand));
break;

#ifndef IO_NO_HAL
case OPCODE_ROTATE:
uint8_t activity;
Expand Down
2 changes: 1 addition & 1 deletion EXRAIL2.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// 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.
//
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_RESERVE,OPCODE_FREE,
OPCODE_AT,OPCODE_AFTER,
Expand Down
2 changes: 2 additions & 0 deletions EXRAIL2MacroReset.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
#undef STEALTH_GLOBAL
#undef STOP
#undef THROW
#undef TOGGLE_TURNOUT
#undef TT_ADDPOSITION
#undef TURNOUT
#undef TURNOUTL
Expand Down Expand Up @@ -331,6 +332,7 @@
#define STEALTH_GLOBAL(code...)
#define STOP
#define THROW(id)
#define TOGGLE_TURNOUT(id)
#define TT_ADDPOSITION(turntable_id,position,value,angle,description...)
#define TURNOUT(id,addr,subaddr,description...)
#define TURNOUTL(id,addr,description...)
Expand Down
1 change: 1 addition & 0 deletions EXRAILMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
#define STASH(id) OPCODE_STASH,V(id),
#define STOP OPCODE_SPEED,V(0),
#define THROW(id) OPCODE_THROW,V(id),
#define TOGGLE_TURNOUT(id) OPCODE_TOGGLE_TURNOUT,V(id),
#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),
#endif
Expand Down

0 comments on commit 72ef199

Please sign in to comment.