This commit is contained in:
gac-S_Changer
2019-02-05 15:54:50 +01:00
parent 872eb21eb4
commit 3359ffce53
4 changed files with 70 additions and 9 deletions

View File

@@ -5,8 +5,11 @@ package ch.psi.mxsc;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceBase;
import ch.psi.pshell.device.DeviceConfig;
import ch.psi.pshell.imaging.DimensionDouble;
import ch.psi.pshell.imaging.PointDouble;
import ch.psi.pshell.swing.DevicePanel;
import java.io.IOException;
import java.util.ArrayList;
/**
@@ -153,10 +156,21 @@ public class Puck extends DeviceBase {
final int address;
final int number;
final double angle;
public static enum PuckDetectionMode{
Inductive,
Mechanical,
Both
}
public static class PuckConfig extends DeviceConfig{
public boolean disabled;
public PuckDetectionMode detection = PuckDetectionMode.Both;
}
Puck(BasePlate basePlate, int index) {
//super(String.valueOf(index+1));
super(SEGMENTS[index] + "" + NUMBERS[index]);
super(SEGMENTS[index] + "" + NUMBERS[index], new PuckConfig());
this.setParent(basePlate);
this.index = index;
this.segment = SEGMENTS[index];
@@ -168,6 +182,19 @@ public class Puck extends DeviceBase {
}
}
@Override
public PuckConfig getConfig(){
return (PuckConfig) super.getConfig();
}
public boolean isDisabled(){
return getConfig().disabled;
}
public PuckDetectionMode getDetectionMode(){
return getConfig().detection == null ? PuckDetectionMode.Both: getConfig().detection;
}
public BasePlate getBasePlate() {
return (BasePlate) getParent();
}