This commit is contained in:
gac-S_Changer
2020-01-08 14:33:25 +01:00
parent c0ba71e0d2
commit ba042d65bc

View File

@@ -164,9 +164,11 @@ public class PuckDetection extends DeviceBase {
for (List<Integer> sensor : bus) {
Integer indDetector = sensor.get(0);
Integer mecDetector = sensor.get(1);
int index = Controller.getInstance().getPuckIndex(address);
PuckState puck = Controller.getInstance().getPuckState(index);
puck.set(mecDetector, indDetector);
if (Controller.getInstance()!=null){
int index = Controller.getInstance().getPuckIndex(address);
PuckState puck = Controller.getInstance().getPuckState(index);
puck.set(mecDetector, indDetector);
}
address++;
}
}
@@ -177,10 +179,16 @@ public class PuckDetection extends DeviceBase {
}
public PuckState getPuckState(int id) throws Exception {
if (Controller.getInstance() == null) {
return null;
}
return Controller.getInstance().getPuckState(id);
}
public Puck getPuck(String name) throws Exception {
public Puck getPuck(String name) throws Exception {
if (Controller.getInstance() == null) {
return null;
}
return Controller.getInstance().getPuck(name);
}
@@ -204,8 +212,9 @@ public class PuckDetection extends DeviceBase {
}
public static void main(String[] args) throws IOException, InterruptedException {
PuckDetection pd = new PuckDetection("PD", "129.129.110.99:5556");
//PuckDetection pd = new PuckDetection("PD", "129.129.110.99:5556");
//PuckDetection pd = new PuckDetection("PD","raspberrypi:5556");
PuckDetection pd = new PuckDetection("PD", "tell10s-raspberrypi:5556");
pd.setDebug(true);
pd.initialize();
Thread.sleep(100000);