improved contact learning code
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.srsoftware</groupId>
|
||||
<artifactId>web4rail</artifactId>
|
||||
<version>1.0.12</version>
|
||||
<version>1.0.13</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -686,17 +686,18 @@ public class Plan extends BaseClass{
|
||||
|
||||
public void sensor(int addr, boolean active) {
|
||||
Contact contact = Contact.get(addr);
|
||||
|
||||
if (isSet(contact)) {
|
||||
contact.activate(active);
|
||||
} else {
|
||||
LOG.debug("contact: {}", addr);
|
||||
if (active && learningContact != null) {
|
||||
LOG.debug("learned: {} = {}",addr,learningContact);
|
||||
stream(learningContact.addr(addr).propMenu().toString());
|
||||
learningContact = null;
|
||||
if (active && learningContact != null) {
|
||||
if (isSet(contact)) {
|
||||
contact.addr(0);
|
||||
LOG.debug("unsibscribed {} from {}",contact,addr);
|
||||
}
|
||||
stream(learningContact.addr(addr).propMenu().toString());
|
||||
learningContact = null;
|
||||
LOG.debug("learned: {} = {}",addr,learningContact);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSet(contact)) contact.activate(active);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user