From 936d918402d764d692e85e7d9cfaba4778eb49b9 Mon Sep 17 00:00:00 2001 From: MurKit Date: Fri, 21 Apr 2017 01:35:17 +0300 Subject: [PATCH 1/3] Dropdown selects the actual selected port (#15) Also mentioned against issue #14. --- SerialPortWindow.pde | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SerialPortWindow.pde b/SerialPortWindow.pde index 09b02a8..98f8d8d 100644 --- a/SerialPortWindow.pde +++ b/SerialPortWindow.pde @@ -31,9 +31,9 @@ ControlFrameSimple addSerialPortControlFrame(String theName, int theWidth, int t ScrollableList sl = p.cp5().addScrollableList("dropdown_serialPort") .setPosition(10, 10) - .setSize(150, 100) + .setSize(150, 150) .setBarHeight(20) - .setItemHeight(20) + .setItemHeight(16) .plugTo(this, "dropdown_serialPort"); sl.addItem("No serial connection", -1); @@ -61,9 +61,11 @@ ControlFrameSimple addSerialPortControlFrame(String theName, int theWidth, int t void dropdown_serialPort(int newSerialPort) { println("In dropdown_serialPort, newSerialPort: " + newSerialPort); + + // No serial in list is slot 0 in code because of list index + // So shift port index by one newSerialPort -= 1; - if (newSerialPort == -2) { } From 0c687ed23484d29e608e6411275a5f20d27bd600 Mon Sep 17 00:00:00 2001 From: Sandy Noble Date: Sun, 25 Jun 2017 17:12:18 +0100 Subject: [PATCH 2/3] Fixed some gcode importing gotchas --- polargraphcontroller.pde | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/polargraphcontroller.pde b/polargraphcontroller.pde index 67c36d6..b4867d7 100644 --- a/polargraphcontroller.pde +++ b/polargraphcontroller.pde @@ -1297,6 +1297,7 @@ RShape loadShapeFromGCodeFile(String filename) { boolean reportStatus = true; while ((line = reader.readLine ()) != null) { lineNo++; + println("Line: " + line); if (reportStatus) { float percent = ((float)lineNo / (float)countLines) * 100.0; @@ -1320,10 +1321,8 @@ RShape loadShapeFromGCodeFile(String filename) { println(e.toString()); continue; } + println("Ins: " + ins); Integer code = Math.round(ins.get("G")); - if (code >= 2) { - continue; - } Float z = ins.get("Z"); if (z != null) { @@ -1366,19 +1365,6 @@ RShape loadShapeFromGCodeFile(String filename) { parent.addMoveTo(x, y); } } -// RPoint[][] points = parent.getPointsInPaths(); -// totalPoints = 0; -// if (points != null) { -// for (int i = 0; i unpackGCodeInstruction(String line) throws Exception { String[] splitted = line.trim().split(" "); for (int i = 0; i < splitted.length; i++) { String axis = splitted[i].substring(0, 1); - Float value = Float.parseFloat(splitted[i].substring(1)); + String sanitisedValue = splitted[i].substring(1); + println("BEfore:" + sanitisedValue); + sanitisedValue = sanitisedValue.replace(",", "."); + println("After: " + sanitisedValue); + + Float value = Float.parseFloat(sanitisedValue); if ("X".equalsIgnoreCase(axis) || "Y".equalsIgnoreCase(axis) || "Z".equalsIgnoreCase(axis) || "G".equalsIgnoreCase(axis)) { - instruction.put(axis, value); + instruction.put(axis.toUpperCase(), value); } } // println("instruction: " + instruction); if (instruction.isEmpty()) { - throw new Exception(); + throw new Exception("Empty instruction"); } } + catch (NumberFormatException nfe) { + println("Number format exception: " + nfe.getMessage()); + } catch (Exception e) { + println("e: " + e); throw new Exception("Exception while reading the lines from a gcode file: " + line + ", " + e.getMessage()); } + println("Instruction: " + instruction); return instruction; } From f32f22abaea380a6259bf68b0d98b9153b078e3e Mon Sep 17 00:00:00 2001 From: Sandy Noble Date: Sun, 25 Jun 2017 17:22:29 +0100 Subject: [PATCH 3/3] v2.4.3 fixes for D2S gcode import --- polargraphcontroller.pde | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polargraphcontroller.pde b/polargraphcontroller.pde index 01b8c53..cbbbbea 100644 --- a/polargraphcontroller.pde +++ b/polargraphcontroller.pde @@ -58,7 +58,7 @@ import java.lang.reflect.Method; int majorVersionNo = 2; int minorVersionNo = 4; -int buildNo = 2; +int buildNo = 3; String programTitle = "Polargraph Controller v" + majorVersionNo + "." + minorVersionNo + " build " + buildNo; ControlP5 cp5; @@ -1330,7 +1330,7 @@ RShape loadShapeFromGCodeFile(String filename) { boolean reportStatus = true; while ((line = reader.readLine ()) != null) { lineNo++; - println("Line: " + line); +// println("Line: " + line); if (reportStatus) { float percent = ((float)lineNo / (float)countLines) * 100.0; @@ -1354,7 +1354,7 @@ RShape loadShapeFromGCodeFile(String filename) { println(e.toString()); continue; } - println("Ins: " + ins); +// println("Ins: " + ins); Integer code = Math.round(ins.get("G")); Float z = ins.get("Z");