Preliminary implementation of SwissMX RT

This commit is contained in:
2023-04-26 09:22:59 +02:00
parent f961ee0758
commit a904eac8eb
9 changed files with 321 additions and 137 deletions

View File

@@ -18,7 +18,7 @@ import java.util.ArrayList;
public class Puck extends DeviceBase {
final static int signalX = -1;
final static PointDouble[] samplesPosition = new PointDouble[]{
final static PointDouble[] SAMPLES_POSITION_NORMAL = new PointDouble[]{
new PointDouble(0 * signalX, 24.24),
new PointDouble(23.05360995 * signalX, 7.490571944),
new PointDouble(14.24791452* signalX, -19.61057194),
@@ -37,6 +37,21 @@ public class Puck extends DeviceBase {
new PointDouble(-28.39445573 * signalX, 44.18263554)
};
final static PointDouble[] SAMPLES_POSITION_RT = new PointDouble[]{
new PointDouble(-30.0,-40.0),
new PointDouble(-2.0, -30.0),
new PointDouble(25.0, -40.0),
new PointDouble(45.0, -15.0),
new PointDouble(-30.0,0.0),
new PointDouble(-30.0, 40.0),
new PointDouble(-2.0, 30.0),
new PointDouble(25.0, 40.0),
new PointDouble(45.0, 15.0)
};
final static PointDouble[] samplesPosition = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt) ?
SAMPLES_POSITION_RT : SAMPLES_POSITION_NORMAL;
static final Character[] SEGMENTS_NORMAL =new Character[]{
'A', 'A','A', 'A', 'A',
'B', 'B', 'B', 'B', 'B',
@@ -64,6 +79,10 @@ public class Puck extends DeviceBase {
'F', 'F', 'F', 'F', 'F',
};
static final Character[] SEGMENTS_RT =new Character[]{
'A', 'B','C', 'D', 'E', 'F'
};
static final int[] NUMBERS_NORMAL = new int[]{
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
@@ -90,6 +109,10 @@ public class Puck extends DeviceBase {
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
};
static final int[] NUMBERS_RT = new int[]{
1, 1, 1, 1, 1, 1
};
static final int[] ADDRESSES_NORMAL = new int[]{
1, 2, 3, 4, 5,
@@ -144,12 +167,19 @@ public class Puck extends DeviceBase {
240.00, 240.00, 210.00, 220.89, 199.11,
};
static final double[] ANGLES_RT = new double[]{
0.00, 0.00, 0.00, 0.00, 0.00, 0.00
};
static final Character[] SEGMENTS = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? SEGMENTS_NORMAL : (
(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? SEGMENTS_SF : SEGMENTS_6D
(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? SEGMENTS_SF : (
(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt) ? SEGMENTS_RT : SEGMENTS_6D
)
);
static final int[] NUMBERS = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? NUMBERS_NORMAL : (
(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? NUMBERS_SF : NUMBERS_6D
(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? NUMBERS_SF :
((MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt) ? NUMBERS_RT : NUMBERS_6D)
);
@@ -159,7 +189,8 @@ public class Puck extends DeviceBase {
static final double[] ANGLES = (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.normal) ? ANGLES_NORMAL : (
(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? ANGLES_SF : ANGLES_6D
(MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.sf) ? ANGLES_SF :
((MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt) ? ANGLES_RT : ANGLES_6D)
);
final static PointDouble referencePosition = new PointDouble(0.0, -66.9 - 0.2);
@@ -168,12 +199,15 @@ public class Puck extends DeviceBase {
final static PointDouble ledMinispinePosition = new PointDouble(0.0, -36.0);
final static Double unipuckLedSize = 10.0;
final static Double minispineLedSize = 8.0;
PuckType puckType = PuckType.Unknown;
public PuckType getPuckType(){
if (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt){
return PuckType.RT;
}
return puckType;
}
@@ -185,16 +219,19 @@ public class Puck extends DeviceBase {
Empty,
Minispine,
Unipuck,
RT,
Error,
Unknown;
public boolean isDefined(){
return (this==Minispine) || (this==Unipuck);
return (this==Minispine) || (this==Unipuck)|| (this==RT);
}
}
public String getStatus(){
Detection detection = getDetection();
PuckType puckType = getPuckType();
if ((detection==Detection.Present) && puckType.isDefined()) {
return puckType.toString();
}
@@ -347,7 +384,7 @@ public class Puck extends DeviceBase {
}
public int getUserIndex(){
return (getSegment() - new Character('A')) * 5 + getNumber() - 1;
return (getSegment() - new Character('A')) * BasePlate.numberOfPucksPerSegments + getNumber() - 1;
}
boolean enabled;
@@ -370,6 +407,9 @@ public class Puck extends DeviceBase {
Detection detection = Detection.Error;
public Detection getDetection() {
if (MainPanel.BASE_PLATE_LAYOUT == MainPanel.BasePlateLayout.rt){
return Detection.Present;
}
return detection;
}