Skip to content
Permalink
Browse files

Disable when occuped check

If occuped & disable when occuped checked, do not send a Secondary Turnout change request.
  • Loading branch information...
icklesteve committed Aug 5, 2019
1 parent 8a89818 commit 8c6b0378a3f5d19eafda528cd2d60ce66cca3d91
Showing with 16 additions and 0 deletions.
  1. +16 −0 java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java
@@ -2345,6 +2345,9 @@ private void activateTurnout() {
if ( e.getNewValue() == null) {
return;
}
if (disableWhenOccupied && isOccupied()) {
return;
}
if (secondNamedTurnout != null) {
int t1state = namedTurnout.getBean().getCommandedState();
int t2state = secondNamedTurnout.getBean().getCommandedState();
@@ -2405,6 +2408,13 @@ public void toggleTurnout() {
}
}

/**
* Set the LayoutTurnout state
* Used for sending the toggle command
* Checks not diabled, disable when occupied
* Also sets secondary Turnout commanded state
* @param state New state to set, eg Turnout.CLOSED
*/
public void setState(int state) {
if ((getTurnout() != null) && !disabled) {
if (disableWhenOccupied && isOccupied()) {
@@ -2426,6 +2436,12 @@ public void setState(int state) {
}
}

/**
* Get the LayoutTurnout state
*
* Ensures the secondary Turnout state matches the primary
* @return the state, eg Turnout.CLOSED or Turnout.INCONSISTENT
*/
public int getState() {
int result = UNKNOWN;
if (getTurnout() != null) {

0 comments on commit 8c6b037

Please sign in to comment.
You can’t perform that action at this time.