OverlayUI ui;
ControlUI controlUI;
MappingUI mappingUI;
-PandaDriver pandaFront;
-PandaDriver pandaRear;
+PandaDriver[] pandaBoards;
boolean mappingMode = false;
-
-boolean pandaBoardsEnabled = false;
-
boolean debugMode = false;
DebugUI debugUI;
// Build output driver
int[][] frontChannels = glucose.mapping.buildFrontChannelList();
int[][] rearChannels = glucose.mapping.buildRearChannelList();
- int[][] flippedRGB = glucose.mapping.buildFlippedRGBList();
mappingTool = new MappingTool(glucose, frontChannels, rearChannels);
- pandaFront = new PandaDriver(new NetAddress("192.168.1.28", 9001), glucose.model, frontChannels, flippedRGB);
- pandaRear = new PandaDriver(new NetAddress("192.168.1.29", 9001), glucose.model, rearChannels, flippedRGB);
+ pandaBoards = new PandaDriver[] {
+ new PandaDriver("10.200.1.28", glucose.model, frontChannels),
+ new PandaDriver("10.200.1.29", glucose.model, rearChannels),
+ };
logTime("Build PandaDriver");
// Build overlay UI
}
// TODO(mcslee): move into GLucose engine
- if (pandaBoardsEnabled) {
- pandaFront.send(colors);
- pandaRear.send(colors);
+ for (PandaDriver p : pandaBoards) {
+ p.send(colors);
}
}
}
break;
case 'p':
- pandaBoardsEnabled = !pandaBoardsEnabled;
- println("PandaBoard Output: " + (pandaBoardsEnabled ? "ON" : "OFF"));
+ for (PandaDriver p : pandaBoards) {
+ p.toggle();
+ }
break;
case 'u':
uiOn = !uiOn;
}
int mx, my;
-
void mousePressed() {
- if (mouseX > ui.leftPos) {
- ui.mousePressed();
- } else {
+ ui.mousePressed();
+ if (mouseX < ui.leftPos) {
if (debugMode) {
debugUI.mousePressed();
}
}
void mouseReleased() {
- if (mouseX > ui.leftPos) {
- ui.mouseReleased();
- }
+ ui.mouseReleased();
}
void mouseWheel(int delta) {
- eyeR = constrain(eyeR - delta, -500, -80);
- eyeX = midX + eyeR*sin(eyeA);
- eyeZ = midZ + eyeR*cos(eyeA);
+ if (mouseX > ui.leftPos) {
+ ui.mouseWheel(delta);
+ } else {
+ eyeR = constrain(eyeR - delta, -500, -80);
+ eyeX = midX + eyeR*sin(eyeA);
+ eyeZ = midZ + eyeR*cos(eyeA);
+ }
}