public int[][] buildFrontChannelList() {
return new int[][] {
- { 1, 2, 3, 4, 0 }, // ch1
- { 5, 6, 7, 8, 0 }, // ch2
- { 9, 10, 11, 12, 0 }, // ch3
- { 13, 14, 15, 16, 0 }, // ch4
- { 17, 18, 19, 20, 0 }, // ch5
- { 21, 22, 23, 24, 0 }, // ch6
- { 25, 26, 27, 28, 0 }, // ch7
- { 29, 30, 31, 32, 0 }, // ch8
+ { 1, 2, 3, 4 }, // ch1
+ { 5, 6, 7, 8 }, // ch2
+ { 9, 10, 11, 12 }, // ch3
+ { 13, 14, 15, 16 }, // ch4
+ { 17, 18, 19, 20 }, // ch5
+ { 21, 22, 23, 24 }, // ch6
+ { 25, 26, 27, 28 }, // ch7
+ { 29, 30, 31, 32 }, // ch8
};
}
public int[][] buildRearChannelList() {
return new int[][] {
- { 33, 34, 35, 36, 0 }, // ch9
- { 37, 38, 39, 40, 0 }, // ch10
- { 41, 42, 43, 44, 0 }, // ch11
- { 45, 46, 47, 48, 0 }, // ch12
- { 49, 50, 51, 52, 0 }, // ch13
- { 53, 54, 55, 56, 0 }, // ch14
- { 57, 58, 59, 60, 0 }, // ch15
- { 61, 62, 63, 64, 0 }, // ch16
+ { 33, 34, 35, 36 }, // ch9
+ { 37, 38, 39, 40 }, // ch10
+ { 41, 42, 43, 44 }, // ch11
+ { 45, 46, 47, 48 }, // ch12
+ { 49, 50, 51, 52 }, // ch13
+ { 53, 54, 55, 56 }, // ch14
+ { 57, 58, 59, 60 }, // ch15
+ { 61, 62, 63, 64 }, // ch16
};
}
}
// List of point indices on the board
private final int[] points;
+
+ // How many channels are on the panda board
+ private final static int CHANNELS_PER_BOARD = 8;
+
+ // How many cubes per channel xc_PB is configured for
+ private final static int CUBES_PER_CHANNEL = 4;
// Packet data
- private final byte[] packet = new byte[4*352]; // TODO: de-magic-number
+ private final byte[] packet = new byte[4*352]; // TODO: de-magic-number, UDP related?
public PandaDriver(NetAddress address, Model model, int[][] channelList) {
this.address = address;
private ArrayList<Integer> buildMappedList(Model model, int[][] channelList) {
ArrayList<Integer> points = new ArrayList<Integer>();
- for (int[] channel : channelList) {
- for (int cubeNumber : channel) {
+ for (int chi = 0; chi < CHANNELS_PER_BOARD; ++chi) {
+ int[] channel = (chi < channelList.length) ? channelList[chi] : new int[]{};
+ for (int ci = 0; ci < CUBES_PER_CHANNEL; ++ci) {
+ int cubeNumber = (ci < channel.length) ? channel[ci] : 0;
if (cubeNumber == 0) {
for (int i = 0; i < (Cube.FACES_PER_CUBE*Face.STRIPS_PER_FACE*Strip.POINTS_PER_STRIP); ++i) {
points.add(0);