mirror of
https://github.com/euphy/polargraphcontroller
synced 2025-01-08 19:24:25 +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;
|
||||
}
|
||||
|
||||
void button_mode_sendButtonActivate()
|
||||
{
|
||||
addToCommandQueue(CMD_ACTIVATE_MACHINE_BUTTON+",END");
|
||||
}
|
||||
void button_mode_sendButtonDeactivate()
|
||||
{
|
||||
addToCommandQueue(CMD_DEACTIVATE_MACHINE_BUTTON+",END");
|
||||
}
|
||||
|
||||
|
||||
|
@ -781,6 +781,9 @@ List<String> getControlNamesForDetailPanel()
|
||||
controlNames.add(MODE_CHANGE_MACHINE_ACCELERATION);
|
||||
controlNames.add(MODE_SEND_MACHINE_SPEED);
|
||||
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);
|
||||
|
||||
@ -954,6 +957,8 @@ Map<String, String> buildControlLabels()
|
||||
result.put(MODE_FLIP_WEBCAM_INPUT, "Flip video");
|
||||
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;
|
||||
@ -1094,6 +1099,9 @@ Set<String> buildControlNames()
|
||||
result.add(MODE_SHOW_WEBCAM_RAW_VIDEO);
|
||||
result.add(MODE_FLIP_WEBCAM_INPUT);
|
||||
result.add(MODE_ROTATE_WEBCAM_INPUT);
|
||||
|
||||
result.add(MODE_SEND_BUTTON_ACTIVATE);
|
||||
result.add(MODE_SEND_BUTTON_DEACTIVATE);
|
||||
|
||||
|
||||
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_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_MOST_POINTS_FIRST = 1;
|
||||
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_MEGA = 100;
|
||||
static final int HARDWARE_VER_MEGA_POLARSHIELD = 200;
|
||||
static final int HARDWARE_VER_POLARPRO = 300;
|
||||
int currentHardware = HARDWARE_VER_MEGA_POLARSHIELD;
|
||||
|
||||
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_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);
|
||||
|
||||
@ -2096,6 +2100,8 @@ void drawStatusText(int x, int y)
|
||||
drawbotStatus = "Polargraph READY! (PolargraphSD)";
|
||||
else if (currentHardware >= HARDWARE_VER_MEGA)
|
||||
drawbotStatus = "Polargraph READY! (Mega)";
|
||||
else if (currentHardware >= HARDWARE_VER_POLARPRO)
|
||||
drawbotStatus = "Polargraph READY! (PRO)";
|
||||
else
|
||||
drawbotStatus = "Polargraph READY! (Uno)";
|
||||
}
|
||||
@ -2473,11 +2479,19 @@ void serialEvent(Serial myPort)
|
||||
drawbotReady = false;
|
||||
else if (incoming.startsWith("MEMORY"))
|
||||
extractMemoryUsage(incoming);
|
||||
|
||||
else if (incoming.startsWith("BUTTON"))
|
||||
handleMachineButton(incoming);
|
||||
|
||||
if (drawbotReady)
|
||||
drawbotConnected = true;
|
||||
}
|
||||
|
||||
void handleMachineButton(String msg)
|
||||
{
|
||||
machineMessageLog.add(msg);
|
||||
}
|
||||
|
||||
void extractMemoryUsage(String mem)
|
||||
{
|
||||
String[] splitted = split(mem, ",");
|
||||
@ -2664,9 +2678,9 @@ void dispatchCommandQueue()
|
||||
commandQueue.remove(0);
|
||||
println("Dispatching command: " + command);
|
||||
}
|
||||
Checksum crc = new CRC32();
|
||||
crc.update(lastCommand.getBytes(), 0, lastCommand.length());
|
||||
lastCommand = lastCommand+":"+crc.getValue();
|
||||
// Checksum crc = new CRC32();
|
||||
// crc.update(lastCommand.getBytes(), 0, lastCommand.length());
|
||||
// lastCommand = lastCommand+":"+crc.getValue();
|
||||
println("Last command:" + lastCommand);
|
||||
myPort.write(lastCommand);
|
||||
myPort.write(10); // OH *$%! of COURSE you should terminate it.
|
||||
|
Loading…
Reference in New Issue
Block a user