diff --git a/controlsActions.pde b/controlsActions.pde index cd50016..d596281 100644 --- a/controlsActions.pde +++ b/controlsActions.pde @@ -533,12 +533,14 @@ void numberbox_mode_changeMachineWidth(float value) clearBoxVectors(); float steps = getDisplayMachine().inSteps((int) value); getDisplayMachine().getSize().x = steps; + getDisplayMachine().maxLength = null; } void numberbox_mode_changeMachineHeight(float value) { clearBoxVectors(); float steps = getDisplayMachine().inSteps((int) value); getDisplayMachine().getSize().y = steps; + getDisplayMachine().maxLength = null; } void numberbox_mode_changeMMPerRev(float value) { @@ -615,7 +617,7 @@ void button_mode_sendPenWidth() NumberFormat nf = NumberFormat.getNumberInstance(Locale.UK); DecimalFormat df = (DecimalFormat)nf; df.applyPattern("###.##"); - addToRealtimeCommandQueue(CMD_CHANGEPENWIDTH+df.format(currentPenWidth)+",END"); + addToRealtimeCommandQueue(CMD_SETPENWIDTH+df.format(currentPenWidth)+",END"); } void numberbox_mode_changePenTestStartWidth(float value) diff --git a/drawing.pde b/drawing.pde index 07197a3..0e9f1aa 100644 --- a/drawing.pde +++ b/drawing.pde @@ -27,9 +27,9 @@ https://github.com/euphy/polargraphcontroller */ static final String CMD_CHANGELENGTH = "C01,"; -static final String CMD_CHANGEPENWIDTH = "C02,"; -static final String CMD_CHANGEMOTORSPEED = "C03,"; -static final String CMD_CHANGEMOTORACCEL = "C04,"; +static final String CMD_SETPENWIDTH = "C02,"; +//static final String CMD_CHANGEMOTORSPEED = "C03,"; +//static final String CMD_CHANGEMOTORACCEL = "C04,"; static final String CMD_DRAWPIXEL = "C05,"; static final String CMD_DRAWSCRIBBLEPIXEL = "C06,"; static final String CMD_DRAWRECT = "C07,"; diff --git a/polargraphcontroller.pde b/polargraphcontroller.pde index c6a8a54..8637405 100644 --- a/polargraphcontroller.pde +++ b/polargraphcontroller.pde @@ -685,7 +685,7 @@ void addEventListeners() void preLoadCommandQueue() { - addToCommandQueue(CMD_CHANGEPENWIDTH+currentPenWidth+",END"); + addToCommandQueue(CMD_SETPENWIDTH+currentPenWidth+",END"); addToCommandQueue(CMD_SETMOTORSPEED+currentMachineMaxSpeed+",END"); addToCommandQueue(CMD_SETMOTORACCEL+currentMachineAccel+",END"); } @@ -819,6 +819,7 @@ Panel getPanel(String panelName) void drawImagePage() { + noLoop(); strokeWeight(1); background(getBackgroundColour()); noFill(); @@ -843,13 +844,21 @@ void drawImagePage() showGroupBox(); showCurrentMachinePosition(); - if (displayingQueuePreview) - previewQueue(); + try { + 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) showText(250,45); drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y); showCommandQueue((int) getDisplayMachine().getOutline().getRight()+6, 20); + } void drawMachineOutline() @@ -1367,6 +1376,7 @@ void keyPressed() } void mouseDragged() { + loop(); if (mouseOverControls().isEmpty()) { if (mouseButton == CENTER) @@ -1384,6 +1394,10 @@ void mouseDragged() } } } +void mouseMoved() +{ + loop(); +} void mouseClicked() {