mirror of
https://github.com/euphy/polargraphcontroller
synced 2025-01-09 19:55:16 +01:00
Some changes to help the PolargraphPro
This commit is contained in:
parent
b664ce9cd4
commit
111a9b9478
@ -710,4 +710,13 @@ void revertToLastMode()
|
|||||||
currentMode = lastMode;
|
currentMode = lastMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void button_mode_sendButtonActivate()
|
||||||
|
{
|
||||||
|
addToCommandQueue(CMD_ACTIVATE_MACHINE_BUTTON+",END");
|
||||||
|
}
|
||||||
|
void button_mode_sendButtonDeactivate()
|
||||||
|
{
|
||||||
|
addToCommandQueue(CMD_DEACTIVATE_MACHINE_BUTTON+",END");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -782,6 +782,9 @@ List<String> getControlNamesForDetailPanel()
|
|||||||
controlNames.add(MODE_SEND_MACHINE_SPEED);
|
controlNames.add(MODE_SEND_MACHINE_SPEED);
|
||||||
controlNames.add(MODE_SEND_MACHINE_SPEED_PERSIST);
|
controlNames.add(MODE_SEND_MACHINE_SPEED_PERSIST);
|
||||||
|
|
||||||
|
controlNames.add(MODE_SEND_BUTTON_ACTIVATE);
|
||||||
|
controlNames.add(MODE_SEND_BUTTON_DEACTIVATE);
|
||||||
|
|
||||||
controlNames.add(MODE_CHANGE_SERIAL_PORT);
|
controlNames.add(MODE_CHANGE_SERIAL_PORT);
|
||||||
|
|
||||||
return controlNames;
|
return controlNames;
|
||||||
@ -954,6 +957,8 @@ Map<String, String> buildControlLabels()
|
|||||||
result.put(MODE_FLIP_WEBCAM_INPUT, "Flip video");
|
result.put(MODE_FLIP_WEBCAM_INPUT, "Flip video");
|
||||||
result.put(MODE_ROTATE_WEBCAM_INPUT, "Rotate webcam");
|
result.put(MODE_ROTATE_WEBCAM_INPUT, "Rotate webcam");
|
||||||
|
|
||||||
|
result.put(MODE_SEND_BUTTON_ACTIVATE, "Activate button");
|
||||||
|
result.put(MODE_SEND_BUTTON_DEACTIVATE, "Deactivate button");
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -1095,6 +1100,9 @@ Set<String> buildControlNames()
|
|||||||
result.add(MODE_FLIP_WEBCAM_INPUT);
|
result.add(MODE_FLIP_WEBCAM_INPUT);
|
||||||
result.add(MODE_ROTATE_WEBCAM_INPUT);
|
result.add(MODE_ROTATE_WEBCAM_INPUT);
|
||||||
|
|
||||||
|
result.add(MODE_SEND_BUTTON_ACTIVATE);
|
||||||
|
result.add(MODE_SEND_BUTTON_DEACTIVATE);
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,9 @@ static final String CMD_SETPENLIFTRANGE = "C45,";
|
|||||||
static final String CMD_SELECT_ROVE_SOURCE_IMAGE = "C46";
|
static final String CMD_SELECT_ROVE_SOURCE_IMAGE = "C46";
|
||||||
static final String CMD_RENDER_ROVE = "C47";
|
static final String CMD_RENDER_ROVE = "C47";
|
||||||
|
|
||||||
|
static final String CMD_ACTIVATE_MACHINE_BUTTON = "C49";
|
||||||
|
static final String CMD_DEACTIVATE_MACHINE_BUTTON = "C50";
|
||||||
|
|
||||||
static final int PATH_SORT_NONE = 0;
|
static final int PATH_SORT_NONE = 0;
|
||||||
static final int PATH_SORT_MOST_POINTS_FIRST = 1;
|
static final int PATH_SORT_MOST_POINTS_FIRST = 1;
|
||||||
static final int PATH_SORT_GREATEST_AREA_FIRST = 2;
|
static final int PATH_SORT_GREATEST_AREA_FIRST = 2;
|
||||||
|
@ -63,6 +63,7 @@ boolean drawbotConnected = false;
|
|||||||
static final int HARDWARE_VER_UNO = 1;
|
static final int HARDWARE_VER_UNO = 1;
|
||||||
static final int HARDWARE_VER_MEGA = 100;
|
static final int HARDWARE_VER_MEGA = 100;
|
||||||
static final int HARDWARE_VER_MEGA_POLARSHIELD = 200;
|
static final int HARDWARE_VER_MEGA_POLARSHIELD = 200;
|
||||||
|
static final int HARDWARE_VER_POLARPRO = 300;
|
||||||
int currentHardware = HARDWARE_VER_MEGA_POLARSHIELD;
|
int currentHardware = HARDWARE_VER_MEGA_POLARSHIELD;
|
||||||
|
|
||||||
final int HARDWARE_ATMEGA328_SRAM = 2048;
|
final int HARDWARE_ATMEGA328_SRAM = 2048;
|
||||||
@ -325,6 +326,9 @@ static final String MODE_SHOW_WEBCAM_RAW_VIDEO = "toggle_mode_showWebcamRawVideo
|
|||||||
static final String MODE_FLIP_WEBCAM_INPUT = "toggle_mode_flipWebcam";
|
static final String MODE_FLIP_WEBCAM_INPUT = "toggle_mode_flipWebcam";
|
||||||
static final String MODE_ROTATE_WEBCAM_INPUT = "toggle_mode_rotateWebcam";
|
static final String MODE_ROTATE_WEBCAM_INPUT = "toggle_mode_rotateWebcam";
|
||||||
|
|
||||||
|
static final String MODE_SEND_BUTTON_ACTIVATE = "button_mode_sendButtonActivate";
|
||||||
|
static final String MODE_SEND_BUTTON_DEACTIVATE = "button_mode_sendButtonDeactivate";
|
||||||
|
|
||||||
|
|
||||||
PVector statusTextPosition = new PVector(300.0, 12.0);
|
PVector statusTextPosition = new PVector(300.0, 12.0);
|
||||||
|
|
||||||
@ -2096,6 +2100,8 @@ void drawStatusText(int x, int y)
|
|||||||
drawbotStatus = "Polargraph READY! (PolargraphSD)";
|
drawbotStatus = "Polargraph READY! (PolargraphSD)";
|
||||||
else if (currentHardware >= HARDWARE_VER_MEGA)
|
else if (currentHardware >= HARDWARE_VER_MEGA)
|
||||||
drawbotStatus = "Polargraph READY! (Mega)";
|
drawbotStatus = "Polargraph READY! (Mega)";
|
||||||
|
else if (currentHardware >= HARDWARE_VER_POLARPRO)
|
||||||
|
drawbotStatus = "Polargraph READY! (PRO)";
|
||||||
else
|
else
|
||||||
drawbotStatus = "Polargraph READY! (Uno)";
|
drawbotStatus = "Polargraph READY! (Uno)";
|
||||||
}
|
}
|
||||||
@ -2474,10 +2480,18 @@ void serialEvent(Serial myPort)
|
|||||||
else if (incoming.startsWith("MEMORY"))
|
else if (incoming.startsWith("MEMORY"))
|
||||||
extractMemoryUsage(incoming);
|
extractMemoryUsage(incoming);
|
||||||
|
|
||||||
|
else if (incoming.startsWith("BUTTON"))
|
||||||
|
handleMachineButton(incoming);
|
||||||
|
|
||||||
if (drawbotReady)
|
if (drawbotReady)
|
||||||
drawbotConnected = true;
|
drawbotConnected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handleMachineButton(String msg)
|
||||||
|
{
|
||||||
|
machineMessageLog.add(msg);
|
||||||
|
}
|
||||||
|
|
||||||
void extractMemoryUsage(String mem)
|
void extractMemoryUsage(String mem)
|
||||||
{
|
{
|
||||||
String[] splitted = split(mem, ",");
|
String[] splitted = split(mem, ",");
|
||||||
@ -2664,9 +2678,9 @@ void dispatchCommandQueue()
|
|||||||
commandQueue.remove(0);
|
commandQueue.remove(0);
|
||||||
println("Dispatching command: " + command);
|
println("Dispatching command: " + command);
|
||||||
}
|
}
|
||||||
Checksum crc = new CRC32();
|
// Checksum crc = new CRC32();
|
||||||
crc.update(lastCommand.getBytes(), 0, lastCommand.length());
|
// crc.update(lastCommand.getBytes(), 0, lastCommand.length());
|
||||||
lastCommand = lastCommand+":"+crc.getValue();
|
// lastCommand = lastCommand+":"+crc.getValue();
|
||||||
println("Last command:" + lastCommand);
|
println("Last command:" + lastCommand);
|
||||||
myPort.write(lastCommand);
|
myPort.write(lastCommand);
|
||||||
myPort.write(10); // OH *$%! of COURSE you should terminate it.
|
myPort.write(10); // OH *$%! of COURSE you should terminate it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user