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

@@ -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);