From 71adf60acfa591e5421a3ff307e1c99d9403aab9 Mon Sep 17 00:00:00 2001
From: openbuilds-engineer
Date: Mon, 9 Nov 2020 21:35:02 +0200
Subject: [PATCH] 1.0.256
---
CHANGELOG.txt | 3 +-
app/js/jog.js | 133 ++++++++++++++++++++++++++++++++++++--------------
index.js | 4 +-
package.json | 2 +-
4 files changed, 101 insertions(+), 41 deletions(-)
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index ad2bfbe..8611358 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,4 +1,5 @@
-v1.0.255: Fixed an typo in Probe wizard
+v1.0.256: Enhanced Continuous Jog to prevent running
+v1.0.255: Fixed an typo in Probe wizard, test of Soft Limits calculation Changes
v1.0.254: Fixed Continous Jog calculation bug
v1.0.253: Fix 3D Viewer Bug with Fusion outputs #157
v1.0.252: Fix for hold:0 status on jog with soft-limits
diff --git a/app/js/jog.js b/app/js/jog.js
index 98a3a9a..3239bb4 100644
--- a/app/js/jog.js
+++ b/app/js/jog.js
@@ -360,7 +360,7 @@ $(document).ready(function() {
$('.xM').on('touchstart mousedown', function(ev) {
ev.preventDefault();
if (allowContinuousJog) { // startJog();
- if (!waitingForStatus && laststatus.comms.runStatus == "Idle") {
+ if (!waitingForStatus && laststatus.comms.runStatus !== "Jog") {
var direction = "X-";
var distance = 1000;
@@ -370,14 +370,22 @@ $(document).ready(function() {
var mindistance = parseInt(grblParams.$130)
var maxdistance = 0; // Grbl all negative coordinates
// Negative move:
- distance = (mindistance + (parseFloat(laststatus.machine.position.offset.x) + parseFloat(laststatus.machine.position.work.x))) - 5
+ distance = (mindistance + (parseFloat(laststatus.machine.position.offset.x) + parseFloat(laststatus.machine.position.work.x))) - 1
+ distance = distance.toFixed(3);
+ if (distance < 1) {
+ toastJogWillHit("X-");
+ }
}
}
var feed = $('#jograte').val();
- socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
- continuousJogRunning = true;
- waitingForStatus = true;
- $('.xM').click();
+ if (distance >= 1) {
+ socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
+ continuousJogRunning = true;
+ waitingForStatus = true;
+ $('.xM').click();
+ }
+ } else {
+ toastJogNotIdle();
}
} else {
var feedrate = $('#jograte').val();
@@ -397,7 +405,7 @@ $(document).ready(function() {
// console.log("xp down")
ev.preventDefault();
if (allowContinuousJog) { // startJog();
- if (!waitingForStatus && laststatus.comms.runStatus == "Idle") {
+ if (!waitingForStatus && laststatus.comms.runStatus !== "Jog") {
var direction = "X";
var distance = 1000;
if (Object.keys(grblParams).length > 0) {
@@ -406,14 +414,22 @@ $(document).ready(function() {
var mindistance = parseInt(grblParams.$130)
var maxdistance = 0; // Grbl all negative coordinates
// Positive move:
- distance = (maxdistance - (parseFloat(laststatus.machine.position.offset.x) + parseFloat(laststatus.machine.position.work.x))) - 5
+ distance = (maxdistance - (parseFloat(laststatus.machine.position.offset.x) + parseFloat(laststatus.machine.position.work.x))) - 1
+ distance = distance.toFixed(3);
+ if (distance < 1) {
+ toastJogWillHit("X+");
+ }
}
}
var feed = $('#jograte').val();
- socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
- continuousJogRunning = true;
- waitingForStatus = true;
- $('.xP').click();
+ if (distance >= 1) {
+ socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
+ continuousJogRunning = true;
+ waitingForStatus = true;
+ $('.xP').click();
+ }
+ } else {
+ toastJogNotIdle();
}
} else {
var feedrate = $('#jograte').val();
@@ -433,7 +449,7 @@ $(document).ready(function() {
$('.yM').on('touchstart mousedown', function(ev) {
ev.preventDefault();
if (allowContinuousJog) { // startJog();
- if (!waitingForStatus && laststatus.comms.runStatus == "Idle") {
+ if (!waitingForStatus && laststatus.comms.runStatus !== "Jog") {
var direction = "Y-";
var distance = 1000;
@@ -443,15 +459,23 @@ $(document).ready(function() {
var mindistance = parseInt(grblParams.$131)
var maxdistance = 0; // Grbl all negative coordinates
// Negative move:
- distance = (mindistance + (parseFloat(laststatus.machine.position.offset.y) + parseFloat(laststatus.machine.position.work.y))) - 5
+ distance = (mindistance + (parseFloat(laststatus.machine.position.offset.y) + parseFloat(laststatus.machine.position.work.y))) - 1
+ distance = distance.toFixed(3);
+ if (distance < 1) {
+ toastJogWillHit("Y-");
+ }
}
}
var feed = $('#jograte').val();
- socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
- continuousJogRunning = true;
- waitingForStatus = true;
- $('.yM').click();
+ if (distance >= 1) {
+ socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
+ continuousJogRunning = true;
+ waitingForStatus = true;
+ $('.yM').click();
+ }
+ } else {
+ toastJogNotIdle();
}
} else {
var feedrate = $('#jograte').val();
@@ -470,7 +494,7 @@ $(document).ready(function() {
$('.yP').on('touchstart mousedown', function(ev) {
ev.preventDefault();
if (allowContinuousJog) { // startJog();
- if (!waitingForStatus && laststatus.comms.runStatus == "Idle") {
+ if (!waitingForStatus && laststatus.comms.runStatus !== "Jog") {
var direction = "Y";
var distance = 1000;
@@ -480,15 +504,23 @@ $(document).ready(function() {
var mindistance = parseInt(grblParams.$131)
var maxdistance = 0; // Grbl all negative coordinates
// Positive move:
- distance = (maxdistance - (parseFloat(laststatus.machine.position.offset.y) + parseFloat(laststatus.machine.position.work.y))) - 5
+ distance = (maxdistance - (parseFloat(laststatus.machine.position.offset.y) + parseFloat(laststatus.machine.position.work.y))) - 1
+ distance = distance.toFixed(3);
+ if (distance < 1) {
+ toastJogWillHit("Y+");
+ }
}
}
var feed = $('#jograte').val();
- socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
- continuousJogRunning = true;
- waitingForStatus = true;
- $('#yP').click();
+ if (distance >= 1) {
+ socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
+ continuousJogRunning = true;
+ waitingForStatus = true;
+ $('#yP').click();
+ }
+ } else {
+ toastJogNotIdle();
}
} else {
var feedrate = $('#jograte').val();
@@ -507,7 +539,7 @@ $(document).ready(function() {
$('.zM').on('touchstart mousedown', function(ev) {
ev.preventDefault();
if (allowContinuousJog) { // startJog();
- if (!waitingForStatus && laststatus.comms.runStatus == "Idle") {
+ if (!waitingForStatus && laststatus.comms.runStatus !== "Jog") {
var direction = "Z-";
var distance = 1000;
@@ -517,15 +549,23 @@ $(document).ready(function() {
var mindistance = parseInt(grblParams.$132)
var maxdistance = 0; // Grbl all negative coordinates
// Negative move:
- distance = (mindistance + (parseFloat(laststatus.machine.position.offset.z) + parseFloat(laststatus.machine.position.work.z))) - 5
+ distance = (mindistance + (parseFloat(laststatus.machine.position.offset.z) + parseFloat(laststatus.machine.position.work.z))) - 1
+ distance = distance.toFixed(3);
+ if (distance < 1) {
+ toastJogWillHit("Z-");
+ }
}
}
var feed = $('#jograte').val();
- socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
- continuousJogRunning = true;
- waitingForStatus = true;
- $('.zM').click();
+ if (distance >= 1) {
+ socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
+ continuousJogRunning = true;
+ waitingForStatus = true;
+ $('.zM').click();
+ }
+ } else {
+ toastJogNotIdle();
}
} else {
var feedrate = $('#jograte').val();
@@ -544,7 +584,7 @@ $(document).ready(function() {
$('.zP').on('touchstart mousedown', function(ev) {
ev.preventDefault();
if (allowContinuousJog) { // startJog();
- if (!waitingForStatus && laststatus.comms.runStatus == "Idle") {
+ if (!waitingForStatus && laststatus.comms.runStatus !== "Jog") {
var direction = "Z";
var distance = 1000;
@@ -554,15 +594,22 @@ $(document).ready(function() {
var mindistance = parseInt(grblParams.$132)
var maxdistance = 0; // Grbl all negative coordinates
// Positive move:
- distance = (maxdistance - (parseFloat(laststatus.machine.position.offset.z) + parseFloat(laststatus.machine.position.work.z))) - 5
+ distance = (maxdistance - (parseFloat(laststatus.machine.position.offset.z) + parseFloat(laststatus.machine.position.work.z))) - 1
+ distance = distance.toFixed(3);
+ if (distance < 1) {
+ toastJogWillHit("Z+");
+ }
}
}
-
var feed = $('#jograte').val();
- socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
- continuousJogRunning = true;
- waitingForStatus = true;
- $('.zP').click();
+ if (distance >= 1) {
+ socket.emit('runCommand', "$J=G91 G21 " + direction + distance + " F" + feed + "\n");
+ continuousJogRunning = true;
+ waitingForStatus = true;
+ $('.zP').click();
+ }
+ } else {
+ toastJogNotIdle();
}
} else {
var feedrate = $('#jograte').val();
@@ -706,4 +753,16 @@ function home() {
} else if (laststatus != undefined && laststatus.machine.firmware.type == 'smoothie') {
sendGcode('G28')
}
+}
+
+function toastJogWillHit(axis) {
+ printLog("[ jog ] Unable to jog toward " + axis + ", will hit soft-limit")
+ var toast = Metro.toast.create;
+ toast("Unable to jog toward " + axis + ", will hit soft-limit", null, 1000, "bg-darkRed fg-white")
+}
+
+function toastJogNotIdle(axis) {
+ printLog("[ jog ] Wait for machine to be Idle, before jogging")
+ var toast = Metro.toast.create;
+ toast("Wait for machine to be Idle, before jogging", null, 1000, "bg-darkRed fg-white")
}
\ No newline at end of file
diff --git a/index.js b/index.js
index d0bef8b..3080236 100644
--- a/index.js
+++ b/index.js
@@ -578,7 +578,7 @@ io.on("connection", function(socket) {
// jogWindow.setOverlayIcon(nativeImage.createFromPath(iconAlarm), 'Alarm');
// }
// }
- }, 100);
+ }, 50);
@@ -979,7 +979,7 @@ io.on("connection", function(socket) {
if (status.comms.connectionStatus > 0) {
addQRealtime("?");
}
- }, 100);
+ }, 50);
} else if (data.indexOf("LPC176") >= 0) { // LPC1768 or LPC1769 should be Smoothieware
status.comms.blocked = false;
debug_log("Smoothieware detected");
diff --git a/package.json b/package.json
index 3209ba9..7d2b8a3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "OpenBuildsCONTROL",
- "version": "1.0.255",
+ "version": "1.0.256",
"license": "AGPL-3.0",
"description": "OpenBuildsCONTROL CNC Machine Interface Software",
"author": "github.com/openbuilds ",