mirror of
https://github.com/euphy/polargraphcontroller
synced 2024-11-15 10:47:56 +01:00
Made checksumming turn-onable and offable.
This commit is contained in:
parent
111a9b9478
commit
c94a365d2b
@ -2096,12 +2096,12 @@ void drawStatusText(int x, int y)
|
|||||||
if (drawbotReady)
|
if (drawbotReady)
|
||||||
{
|
{
|
||||||
fill(0, 200, 0);
|
fill(0, 200, 0);
|
||||||
if (currentHardware >= HARDWARE_VER_MEGA_POLARSHIELD)
|
if (currentHardware >= HARDWARE_VER_POLARPRO)
|
||||||
|
drawbotStatus = "Polargraph READY! (PRO)";
|
||||||
|
else if (currentHardware >= HARDWARE_VER_MEGA_POLARSHIELD)
|
||||||
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)";
|
||||||
}
|
}
|
||||||
@ -2424,7 +2424,8 @@ void setHardwareVersionFromIncoming(String readyString)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (HARDWARE_VER_MEGA == verInt
|
if (HARDWARE_VER_MEGA == verInt
|
||||||
|| HARDWARE_VER_MEGA_POLARSHIELD == verInt)
|
|| HARDWARE_VER_MEGA_POLARSHIELD == verInt
|
||||||
|
|| HARDWARE_VER_POLARPRO == verInt)
|
||||||
newHardwareVersion = verInt;
|
newHardwareVersion = verInt;
|
||||||
else
|
else
|
||||||
newHardwareVersion = HARDWARE_VER_UNO;
|
newHardwareVersion = HARDWARE_VER_UNO;
|
||||||
@ -2678,9 +2679,11 @@ void dispatchCommandQueue()
|
|||||||
commandQueue.remove(0);
|
commandQueue.remove(0);
|
||||||
println("Dispatching command: " + command);
|
println("Dispatching command: " + command);
|
||||||
}
|
}
|
||||||
// Checksum crc = new CRC32();
|
if (useChecksum()) {
|
||||||
// crc.update(lastCommand.getBytes(), 0, lastCommand.length());
|
Checksum crc = new CRC32();
|
||||||
// lastCommand = lastCommand+":"+crc.getValue();
|
crc.update(lastCommand.getBytes(), 0, lastCommand.length());
|
||||||
|
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.
|
||||||
@ -2692,6 +2695,10 @@ void dispatchCommandQueue()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean useChecksum() {
|
||||||
|
return currentHardware == 200;
|
||||||
|
}
|
||||||
|
|
||||||
void addToCommandQueue(String command)
|
void addToCommandQueue(String command)
|
||||||
{
|
{
|
||||||
synchronized (commandQueue)
|
synchronized (commandQueue)
|
||||||
|
Loading…
Reference in New Issue
Block a user