improved contact learning code
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.12</version>
|
<version>1.0.13</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>
|
||||||
|
|||||||
@@ -686,17 +686,18 @@ public class Plan extends BaseClass{
|
|||||||
|
|
||||||
public void sensor(int addr, boolean active) {
|
public void sensor(int addr, boolean active) {
|
||||||
Contact contact = Contact.get(addr);
|
Contact contact = Contact.get(addr);
|
||||||
|
if (active && learningContact != null) {
|
||||||
if (isSet(contact)) {
|
if (isSet(contact)) {
|
||||||
contact.activate(active);
|
contact.addr(0);
|
||||||
} else {
|
LOG.debug("unsibscribed {} from {}",contact,addr);
|
||||||
LOG.debug("contact: {}", addr);
|
|
||||||
if (active && learningContact != null) {
|
|
||||||
LOG.debug("learned: {} = {}",addr,learningContact);
|
|
||||||
stream(learningContact.addr(addr).propMenu().toString());
|
|
||||||
learningContact = null;
|
|
||||||
}
|
}
|
||||||
|
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