Skip to content
Permalink
Browse files

improved fix

  • Loading branch information...
icklesteve committed Jun 1, 2019
1 parent b9bf9a7 commit 8c47cebea232eafd9009db0cdff99db77e943a55
Showing with 16 additions and 7 deletions.
  1. +16 −7 java/src/jmri/jmrix/openlcb/OlcbLight.java
@@ -74,10 +74,25 @@ public void update(Boolean value) {
};
// A Light Control will have failed to set its state during xml load
// as the LightListener is not present, so we re-activate any Light Controls
deactivateLight();
activateLight();
}

/**
* Activate a light activating all its LightControl objects.
*/
@Override
public void activateLight() {
// during xml load any Light Controls may attempt to set the Light before the
// lightListener has been set
if (lightListener==null){
return;
}
lightControlList.stream().forEach((lc) -> {
lc.activateLightControl();
});
mActive = true; // set flag for control listeners
}


/**
* Set the current state of this Light This routine requests the hardware to
@@ -87,12 +102,6 @@ public void update(Boolean value) {
*/
@Override
protected void doNewState(int oldState, int newState) {
// during xml load any Light Controls may attempt to set the Light before the
// lightListener has been set
if (lightListener==null){
log.debug("lightListener not set, probably still initialising");
return;
}
switch (newState) {
case Light.ON:
lightListener.setFromOwnerWithForceNotify(true);

0 comments on commit 8c47ceb

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