From 90b90e6d44cd52d26fd4200c7019225785e71209 Mon Sep 17 00:00:00 2001 From: Slobodan Date: Wed, 14 May 2025 15:45:10 +0200 Subject: [PATCH 1/4] fixed to work with processing 4.4.1 current stable release Just updated code to work with current stable processing --- gctrl.pde | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gctrl.pde b/gctrl.pde index 4c1730b..f4578d7 100644 --- a/gctrl.pde +++ b/gctrl.pde @@ -1,7 +1,7 @@ import java.awt.event.KeyEvent; import javax.swing.JOptionPane; import processing.serial.*; - +import javax.swing.JFrame; Serial port = null; // select and modify the appropriate line for your operating system @@ -28,7 +28,8 @@ void openSerialPort() void selectSerialPort() { - String result = (String) JOptionPane.showInputDialog(this, + JFrame frame = new JFrame(); + String result = (String) JOptionPane.showInputDialog(frame, "Select the serial port that corresponds to your Arduino board.", "Select serial port", JOptionPane.PLAIN_MESSAGE, From 672fd9a295430d650ca65c6a2adfb27970b6314f Mon Sep 17 00:00:00 2001 From: Slobodan Date: Fri, 30 May 2025 23:37:55 +0200 Subject: [PATCH 2/4] Changed imperial to metric Updated G-code sender to work with mm instead mils --- gctrl.pde | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/gctrl.pde b/gctrl.pde index f4578d7..e73fcbc 100644 --- a/gctrl.pde +++ b/gctrl.pde @@ -3,7 +3,7 @@ import javax.swing.JOptionPane; import processing.serial.*; import javax.swing.JFrame; Serial port = null; - +PImage img; // select and modify the appropriate line for your operating system // leave as null to use interactive port (press 'p' in the program) String portname = null; @@ -12,7 +12,7 @@ String portname = null; //String portname = "COM6"; // Windows boolean streaming = false; -float speed = 0.001; +float speed = 0.1; String[] gcode; int i = 0; @@ -45,7 +45,9 @@ void selectSerialPort() void setup() { - size(500, 250); + size(800, 350); + openSerialPort(); + img = loadImage("myImage.png"); // <-- Make sure your image is in the data folder! openSerialPort(); } @@ -53,29 +55,37 @@ void draw() { background(0); fill(255); - int y = 24, dy = 12; - text("INSTRUCTIONS", 12, y); y += dy; - text("p: select serial port", 12, y); y += dy; - text("1: set speed to 0.001 inches (1 mil) per jog", 12, y); y += dy; - text("2: set speed to 0.010 inches (10 mil) per jog", 12, y); y += dy; - text("3: set speed to 0.100 inches (100 mil) per jog", 12, y); y += dy; - text("arrow keys: jog in x-y plane", 12, y); y += dy; - text("page up & page down: jog in z axis", 12, y); y += dy; - text("$: display grbl settings", 12, y); y+= dy; - text("h: go home", 12, y); y += dy; - text("0: zero machine (set home to the current location)", 12, y); y += dy; - text("g: stream a g-code file", 12, y); y += dy; - text("x: stop streaming g-code (this is NOT immediate)", 12, y); y += dy; + textSize(16); + int y = 24, dy = 18; + text("INSTRUCTIONS", 22, y); y += dy; + + text("p: select serial port", 18, y); y += dy; + text("Press 1,2 or 3 to set jog amount ", 22, y); y += dy; + text("1: set speed to 1 mm per step (1,0 mm) per jog", 18, y); y += dy; + text("2: set speed to 2.5 mm per step (2,5 mil) per jog", 18, y); y += dy; + text("3: set speed to 5.0 mm per step (5 mm) per jog", 18, y); y += dy; + text("arrow keys: jog in x-y plane", 18, y); y += dy; + text("page up & page down: jog in z axis", 18, y); y += dy; + text("$: display grbl settings", 18, y); y+= dy; + text("h: go home", 18, y); y += dy; + text("0: zero machine (set home to the current location)", 18, y); y += dy; + text("f: stream a g-code file", 18, y); y += dy; + text("x: stop streaming g-code (this is NOT immediate)", 18, y); y += dy; y = height - dy; - text("current jog speed: " + speed + " inches per step", 12, y); y -= dy; - text("current serial port: " + portname, 12, y); y -= dy; + text("current jog speed: " + speed + " mm per step", 18, y); y -= dy; + text("current serial port: " + portname, 18, y); y -= dy; + + // Draw the image on the right side + int imgX = width - img.width - 20; // 20 pixels padding from right edge + int imgY = 20; // 20 pixels from top + image(img, imgX, imgY); } void keyPressed() { - if (key == '1') speed = 0.001; - if (key == '2') speed = 0.01; - if (key == '3') speed = 0.1; + if (key == '1') speed = 1.0; + if (key == '2') speed = 2.5; + if (key == '3') speed = 5.0; if (!streaming) { if (keyCode == LEFT) port.write("G91\nG20\nG00 X-" + speed + " Y0.000 Z0.000\n"); @@ -144,4 +154,3 @@ void serialEvent(Serial p) if (s.trim().startsWith("ok")) stream(); if (s.trim().startsWith("error")) stream(); // XXX: really? } - From 15bed8f0cc4d10a9fd48b2ead2060d33547915fb Mon Sep 17 00:00:00 2001 From: Slobodan Date: Sat, 31 May 2025 00:09:30 +0200 Subject: [PATCH 3/4] Removed picture from GUI Just comment out picture on right side of window --- gctrl.pde | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gctrl.pde b/gctrl.pde index e73fcbc..91884fc 100644 --- a/gctrl.pde +++ b/gctrl.pde @@ -3,7 +3,7 @@ import javax.swing.JOptionPane; import processing.serial.*; import javax.swing.JFrame; Serial port = null; -PImage img; +// PImage img; // select and modify the appropriate line for your operating system // leave as null to use interactive port (press 'p' in the program) String portname = null; @@ -45,9 +45,9 @@ void selectSerialPort() void setup() { - size(800, 350); + size(500, 350); openSerialPort(); - img = loadImage("myImage.png"); // <-- Make sure your image is in the data folder! + //img = loadImage("myImage.png"); // <-- Make sure your image is in the data folder! openSerialPort(); } @@ -76,9 +76,9 @@ void draw() text("current serial port: " + portname, 18, y); y -= dy; // Draw the image on the right side - int imgX = width - img.width - 20; // 20 pixels padding from right edge - int imgY = 20; // 20 pixels from top - image(img, imgX, imgY); + //int imgX = width - img.width - 20; // 20 pixels padding from right edge + //int imgY = 20; // 20 pixels from top + //image(img, imgX, imgY); } void keyPressed() From 04299b07204bf70ea8a731662f9d4413de679f34 Mon Sep 17 00:00:00 2001 From: Slobodan Date: Sat, 31 May 2025 00:53:11 +0200 Subject: [PATCH 4/4] Update README --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 4f38fb2..15ff104 100644 --- a/README +++ b/README @@ -2,3 +2,4 @@ gctrl: a simple GUI for grbl A simple Processing sketch that acts as an interface to grbl . +Download latest Processing from https://github.com/processing/processing4