Some debugging help.

This commit is contained in:
Sandy Noble 2020-03-21 12:47:22 +00:00
parent 8e263852ee
commit f8f1f78ce3
3 changed files with 23 additions and 7 deletions

View File

@ -533,12 +533,14 @@ void numberbox_mode_changeMachineWidth(float value)
clearBoxVectors(); clearBoxVectors();
float steps = getDisplayMachine().inSteps((int) value); float steps = getDisplayMachine().inSteps((int) value);
getDisplayMachine().getSize().x = steps; getDisplayMachine().getSize().x = steps;
getDisplayMachine().maxLength = null;
} }
void numberbox_mode_changeMachineHeight(float value) void numberbox_mode_changeMachineHeight(float value)
{ {
clearBoxVectors(); clearBoxVectors();
float steps = getDisplayMachine().inSteps((int) value); float steps = getDisplayMachine().inSteps((int) value);
getDisplayMachine().getSize().y = steps; getDisplayMachine().getSize().y = steps;
getDisplayMachine().maxLength = null;
} }
void numberbox_mode_changeMMPerRev(float value) void numberbox_mode_changeMMPerRev(float value)
{ {
@ -615,7 +617,7 @@ void button_mode_sendPenWidth()
NumberFormat nf = NumberFormat.getNumberInstance(Locale.UK); NumberFormat nf = NumberFormat.getNumberInstance(Locale.UK);
DecimalFormat df = (DecimalFormat)nf; DecimalFormat df = (DecimalFormat)nf;
df.applyPattern("###.##"); df.applyPattern("###.##");
addToRealtimeCommandQueue(CMD_CHANGEPENWIDTH+df.format(currentPenWidth)+",END"); addToRealtimeCommandQueue(CMD_SETPENWIDTH+df.format(currentPenWidth)+",END");
} }
void numberbox_mode_changePenTestStartWidth(float value) void numberbox_mode_changePenTestStartWidth(float value)

View File

@ -27,9 +27,9 @@
https://github.com/euphy/polargraphcontroller https://github.com/euphy/polargraphcontroller
*/ */
static final String CMD_CHANGELENGTH = "C01,"; static final String CMD_CHANGELENGTH = "C01,";
static final String CMD_CHANGEPENWIDTH = "C02,"; static final String CMD_SETPENWIDTH = "C02,";
static final String CMD_CHANGEMOTORSPEED = "C03,"; //static final String CMD_CHANGEMOTORSPEED = "C03,";
static final String CMD_CHANGEMOTORACCEL = "C04,"; //static final String CMD_CHANGEMOTORACCEL = "C04,";
static final String CMD_DRAWPIXEL = "C05,"; static final String CMD_DRAWPIXEL = "C05,";
static final String CMD_DRAWSCRIBBLEPIXEL = "C06,"; static final String CMD_DRAWSCRIBBLEPIXEL = "C06,";
static final String CMD_DRAWRECT = "C07,"; static final String CMD_DRAWRECT = "C07,";

View File

@ -685,7 +685,7 @@ void addEventListeners()
void preLoadCommandQueue() void preLoadCommandQueue()
{ {
addToCommandQueue(CMD_CHANGEPENWIDTH+currentPenWidth+",END"); addToCommandQueue(CMD_SETPENWIDTH+currentPenWidth+",END");
addToCommandQueue(CMD_SETMOTORSPEED+currentMachineMaxSpeed+",END"); addToCommandQueue(CMD_SETMOTORSPEED+currentMachineMaxSpeed+",END");
addToCommandQueue(CMD_SETMOTORACCEL+currentMachineAccel+",END"); addToCommandQueue(CMD_SETMOTORACCEL+currentMachineAccel+",END");
} }
@ -819,6 +819,7 @@ Panel getPanel(String panelName)
void drawImagePage() void drawImagePage()
{ {
noLoop();
strokeWeight(1); strokeWeight(1);
background(getBackgroundColour()); background(getBackgroundColour());
noFill(); noFill();
@ -843,13 +844,21 @@ void drawImagePage()
showGroupBox(); showGroupBox();
showCurrentMachinePosition(); showCurrentMachinePosition();
if (displayingQueuePreview) try {
previewQueue(); if (displayingQueuePreview)
previewQueue();
}
catch (ConcurrentModificationException cme)
{
// not doing anything with this exception - I don't mind if it's wrong on the screen for a second or two.
println("Caught the pesky ConcurrentModificationException: " + cme.getMessage());
}
if (displayingInfoTextOnInputPage) if (displayingInfoTextOnInputPage)
showText(250,45); showText(250,45);
drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y); drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y);
showCommandQueue((int) getDisplayMachine().getOutline().getRight()+6, 20); showCommandQueue((int) getDisplayMachine().getOutline().getRight()+6, 20);
} }
void drawMachineOutline() void drawMachineOutline()
@ -1367,6 +1376,7 @@ void keyPressed()
} }
void mouseDragged() void mouseDragged()
{ {
loop();
if (mouseOverControls().isEmpty()) if (mouseOverControls().isEmpty())
{ {
if (mouseButton == CENTER) if (mouseButton == CENTER)
@ -1384,6 +1394,10 @@ void mouseDragged()
} }
} }
} }
void mouseMoved()
{
loop();
}
void mouseClicked() void mouseClicked()
{ {