implemented re-init of turnout on address change
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>web4rail</artifactId>
|
<artifactId>web4rail</artifactId>
|
||||||
<version>1.0.13</version>
|
<version>1.0.14</version>
|
||||||
<name>Web4Rail</name>
|
<name>Web4Rail</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>Java Model Railway Control</description>
|
<description>Java Model Railway Control</description>
|
||||||
|
|||||||
@@ -199,7 +199,13 @@ public abstract class Turnout extends Tile implements Device{
|
|||||||
@Override
|
@Override
|
||||||
public Tile update(HashMap<String, String> params) throws IOException {
|
public Tile update(HashMap<String, String> params) throws IOException {
|
||||||
if (params.containsKey(PROTOCOL)) protocol = Protocol.valueOf(params.get(PROTOCOL));
|
if (params.containsKey(PROTOCOL)) protocol = Protocol.valueOf(params.get(PROTOCOL));
|
||||||
if (params.containsKey(ADDRESS)) address = Integer.parseInt(params.get(ADDRESS));
|
if (params.containsKey(ADDRESS)) {
|
||||||
|
int newAddress = Integer.parseInt(params.get(ADDRESS));
|
||||||
|
if (newAddress != address) {
|
||||||
|
initialized = false;
|
||||||
|
address = newAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (params.containsKey(PORT_A)) portA = Integer.parseInt(params.get(PORT_A));
|
if (params.containsKey(PORT_A)) portA = Integer.parseInt(params.get(PORT_A));
|
||||||
if (params.containsKey(PORT_B)) portB = Integer.parseInt(params.get(PORT_B));
|
if (params.containsKey(PORT_B)) portB = Integer.parseInt(params.get(PORT_B));
|
||||||
return super.update(params);
|
return super.update(params);
|
||||||
|
|||||||
Reference in New Issue
Block a user