implemented re-init of turnout on address change

This commit is contained in:
Stephan Richter
2020-11-22 23:25:52 +01:00
parent d8c1d93a7f
commit b41e973e1a
2 changed files with 8 additions and 2 deletions

View File

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId>
<version>1.0.13</version>
<version>1.0.14</version>
<name>Web4Rail</name>
<packaging>jar</packaging>
<description>Java Model Railway Control</description>

View File

@@ -199,7 +199,13 @@ public abstract class Turnout extends Tile implements Device{
@Override
public Tile update(HashMap<String, String> params) throws IOException {
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_B)) portB = Integer.parseInt(params.get(PORT_B));
return super.update(params);