Skip to content

Commit

Permalink
Merge pull request #7945 from silverailscolo/eb-matrixmast-storeresetapp
Browse files Browse the repository at this point in the history
Matrixmast reset prev aspect setting
  • Loading branch information
bobjacobsen committed Jan 15, 2020
2 parents 9fec3d8 + cd434ab commit f87dc2b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions java/src/jmri/implementation/MatrixSignalMast.java
Expand Up @@ -149,6 +149,7 @@ public void setAspect(@Nonnull String aspect) {
}
}
}
// add a timer here to wait a while before setting new aspect?
if (aspectToOutput.containsKey(aspect) && aspectToOutput.get(aspect) != errorBits) {
// ToDo: pick up drop down choice for either DCC direct packets or Turnouts as outputs
// c.sendPacket(NmraPacket.altAccSignalDecoderPkt(dccSignalDecoderAddress, aspectToOutput.get(aspect)), packetRepeatCount);
Expand Down
Expand Up @@ -103,6 +103,9 @@ public Element store(Object o) { // from mast p to XML
e.addContent(el);
}
}
if (p.resetPreviousStates()) {
e.addContent(new Element("resetPreviousStates").addContent("yes"));
}
return e;
}

Expand Down Expand Up @@ -170,6 +173,12 @@ public boolean load(Element shared, Element perNode) { // from XML to mast m
m.setAspectDisabled(asp.getText());
}
}

if ((shared.getChild("resetPreviousStates") != null) // load mast-specific delay, since 4.19.4
&& shared.getChild("resetPreviousStates").getText().equals("yes")) {
m.resetPreviousStates(true);
}

return true;
}

Expand Down
1 change: 1 addition & 0 deletions java/test/jmri/implementation/MatrixSignalMastTest.java
Expand Up @@ -157,6 +157,7 @@ public void testAspects() {
m.setAspectEnabled("Approach");
m.setAspectEnabled("Stop");
m.setAspectEnabled("Unlit");
m.resetPreviousStates(false);

m.aspect = "Stop"; // define some initial aspect before setting any aspect
m.setMatrixMastCommandDelay(0);
Expand Down
7 changes: 7 additions & 0 deletions xml/schema/types/signalmasts-2-9-6.xsd
Expand Up @@ -467,6 +467,13 @@
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="resetPreviousStates" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
"yes" means that the dark turnout command should be sent before each new aspects turnout command
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="userName" type="userNameType">
<xs:annotation>
Expand Down

0 comments on commit f87dc2b

Please sign in to comment.