diff --git a/app/js/grbl-settings-defaults.js b/app/js/grbl-settings-defaults.js
index 15393a76..eb19d371 100644
--- a/app/js/grbl-settings-defaults.js
+++ b/app/js/grbl-settings-defaults.js
@@ -827,75 +827,13 @@ function selectMachine(type) {
// as per https://openbuilds.com/threads/blackbox-x32.19810/page-3#post-131285
$("#val-44-input").val(3)
$("#val-45-input").val(0)
- } else if (customFirmware == "acropen" && laststatus.machine.firmware.platform == "grblHAL") {
- // as per https://openbuilds.com/threads/blackbox-x32.19810/page-3#post-131285
- $("#val-44-input").val(3)
- $("#val-45-input").val(0)
- $("#val-33-input").val(50) // spindle pwm freq
- // $33 = 50Hz = 20ms (1/50s) repetion rate, $34-$36 are percentages of this. https://openbuilds.com/threads/blackbox-x32-servo-connection.20395/#post-134896
- // Set $33=50 (PWM frequency), $34=5, $35=5 and $36=10 to generate a “standard” PWM signal: 20ms repetition rate, 1 - 2ms pulse length range.
- // You may decrease $34 and $35 to output a shorter pulse than 1ms at min, and increase $36 to get a longer pulse than 2ms at max.
- $("#val-34-input").val(5) // off value
- $("#val-35-input").val(5) // min value
- $("#val-36-input").val(100) // max value
-
- } else if (customFirmware == "acro" && laststatus.machine.firmware.platform == "grbl") {
- Metro.dialog.create({
- title: "Custom Firmware Required",
- content: `
The machine type you selected, needs a custom firmware. Please use the Firmware Flashing Wizard to upload a custom firmware image to the controller to properly support this machine.
`,
- actions: [{
- caption: "No Thank you",
- cls: "js-dialog-close",
- onclick: function() {
- console.log("Do nothing")
- }
- },
- {
- caption: "Launch the Flashing Wizard",
- cls: "js-dialog-close success",
- onclick: function() {
- openFlashingTool();
- setTimeout(function() {
- // $('#grblAxesCount').data('select').val('2axes')
- }, 500)
- }
- },
-
- ]
- });
-
- console.log('This machine needs a custom firmware')
- } else if (customFirmware == "acropen" && laststatus.machine.firmware.platform == "grbl") {
- Metro.dialog.create({
- title: "Custom Firmware Required",
- content: `The machine type you selected, needs a custom firmware. Please use the Firmware Flashing Wizard to upload a custom firmware image to the controller to properly support this machine.
`,
- actions: [{
- caption: "No Thank you",
- cls: "js-dialog-close",
- onclick: function() {
- console.log("Do nothing")
- }
- },
- {
- caption: "Launch the Flashing Wizard",
- cls: "js-dialog-close success",
- onclick: function() {
- openFlashingTool();
- setTimeout(function() {
- //$('#grblAxesCount').data('select').val('servo')
- }, 500)
- }
- },
-
- ]
- });
-
- console.log('This machine needs a custom firmware')
}
- //}
-
}
+ // Force Limits on
+ $('#limitsinstalled:checkbox').prop('checked', true);
+
+
lastSelectedMachine = type;
sendGcode('$I=' + lastSelectedMachine)
checkifchanged()
diff --git a/app/js/grbl-settings.js b/app/js/grbl-settings.js
index 001f20cf..9e1fffec 100644
--- a/app/js/grbl-settings.js
+++ b/app/js/grbl-settings.js
@@ -375,10 +375,20 @@ function grblPopulate() {
$('#homeBtn').attr('disabled', true)
}
- if (grblParams['$33'] == 50 && grblParams['$34'] == 5 && grblParams['$35'] == 5 && grblParams['$36'] == 10) {
- $('#scribeinstalled:checkbox').prop('checked', true);
- } else {
- $('#scribeinstalled:checkbox').prop('checked', false);
+ // if (grblParams['$33'] == 50 && grblParams['$34'] == 5 && grblParams['$35'] == 5 && grblParams['$36'] == 10) {
+ // setSelectedToolhead('scribe')
+ // }
+
+ if (isMatchingConfig(grblParams, grblParams_scribe)) {
+ setSelectedToolhead('scribe')
+ } else if (isMatchingConfig(grblParams, grblParams_plasma)) {
+ setSelectedToolhead('plasma')
+ } else if (isMatchingConfig(grblParams, grblParams_router)) {
+ setSelectedToolhead('router11')
+ } else if (isMatchingConfig(grblParams, grblParams_laser)) {
+ setSelectedToolhead('laser')
+ } else if (isMatchingConfig(grblParams, grblParams_vfd)) {
+ setSelectedToolhead('vfd_spindle')
}
setTimeout(function() {
@@ -788,13 +798,14 @@ function enableLimits() {
// elm.scrollIntoView(true);
}
+var grblParams_scribe = {
+ $33: "50", //PWM Freq for RC Servo
+ $34: "5", //Spindle Off Value for RC Servo
+ $35: "5", //Spinde Min Value for RC Servo
+ $36: "10", //Spindle max Value for RC Servo
+}
+
function enableScribe() {
- var grblParams_scribe = {
- $33: "50", //PWM Freq for RC Servo
- $34: "5", //Spindle Off Value for RC Servo
- $35: "5", //Spinde Min Value for RC Servo
- $36: "10", //Spindle max Value for RC Servo
- }
for (var key in grblParams_scribe) {
if (grblParams_scribe.hasOwnProperty(key)) {
var j = key.substring(1)
@@ -812,15 +823,17 @@ function enableScribe() {
// elm.scrollIntoView(true);
}
+var grblParams_laser = {
+ $30: "1000", // S Max
+ $32: "1", // Laser Mode On
+ $33: "1000", //PWM Freq
+ $34: "0", //Spindle Off Value
+ $35: "0", //Spinde Min Value
+ $36: "100", //Spindle max Value
+}
+
function enableLaser() {
- var grblParams_laser = {
- $30: "1000", // S Max
- $32: "1", // Laser Mode On
- $33: "100", //PWM Freq
- $34: "0", //Spindle Off Value
- $35: "0", //Spinde Min Value
- $36: "100", //Spindle max Value
- }
+
for (var key in grblParams_laser) {
if (grblParams_laser.hasOwnProperty(key)) {
var j = key.substring(1)
@@ -838,15 +851,17 @@ function enableLaser() {
// elm.scrollIntoView(true);
}
+var grblParams_router = {
+ $30: "1000", // S Max
+ $32: "0", // Laser Mode On
+ $33: "5000", //PWM Freq
+ $34: "0", //Spindle Off Value
+ $35: "0", //Spinde Min Value
+ $36: "100", //Spindle max Value
+}
+
function enableRouter() {
- var grblParams_router = {
- $30: "1000", // S Max
- $32: "0", // Laser Mode On
- $33: "5000", //PWM Freq
- $34: "0", //Spindle Off Value
- $35: "0", //Spinde Min Value
- $36: "100", //Spindle max Value
- }
+
for (var key in grblParams_router) {
if (grblParams_router.hasOwnProperty(key)) {
var j = key.substring(1)
@@ -864,21 +879,23 @@ function enableRouter() {
// elm.scrollIntoView(true);
}
+var grblParams_plasma = {
+ $30: "1000", // S Max
+ $32: "0", // Laser Mode On
+ $33: "1000", //PWM Freq
+ $34: "0", //Spindle Off Value
+ $35: "0", //Spinde Min Value
+ $36: "100", //Spindle max Value
+}
+
function enablePlasma() {
- var grblParams_router = {
- $30: "1000", // S Max
- $32: "0", // Laser Mode On
- $33: "5000", //PWM Freq
- $34: "0", //Spindle Off Value
- $35: "0", //Spinde Min Value
- $36: "100", //Spindle max Value
- }
- for (var key in grblParams_router) {
- if (grblParams_router.hasOwnProperty(key)) {
+
+ for (var key in grblParams_plasma) {
+ if (grblParams_plasma.hasOwnProperty(key)) {
var j = key.substring(1)
var newVal = $("#val-" + j + "-input").val();
// console.log("$" + j + " = " + newVal)
- $("#val-" + j + "-input").val(parseFloat(grblParams_router[key]))
+ $("#val-" + j + "-input").val(parseFloat(grblParams_plasma[key]))
}
}
allowGrblSettingsViewScroll = false;
@@ -890,15 +907,17 @@ function enablePlasma() {
// elm.scrollIntoView(true);
}
+var grblParams_vfd = {
+ $30: "24000", // S Max
+ $32: "0", // Laser Mode On
+ $33: "1000", //PWM Freq
+ $34: "0", //Spindle Off Value
+ $35: "0", //Spinde Min Value
+ $36: "100", //Spindle max Value
+}
+
function enableVFD() {
- var grblParams_vfd = {
- $30: "24000", // S Max
- $32: "0", // Laser Mode On
- $33: "1000", //PWM Freq
- $34: "0", //Spindle Off Value
- $35: "0", //Spinde Min Value
- $36: "100", //Spindle max Value
- }
+
for (var key in grblParams_vfd) {
if (grblParams_vfd.hasOwnProperty(key)) {
var j = key.substring(1)
@@ -916,6 +935,16 @@ function enableVFD() {
// elm.scrollIntoView(true);
}
+function isMatchingConfig(currentParams, predefinedParams) {
+ for (let key in predefinedParams) {
+ // Compare values as numbers to handle type mismatches
+ if (parseFloat(currentParams[key]) !== parseFloat(predefinedParams[key])) {
+ return false;
+ }
+ }
+ return true;
+}
+
// Function to programmatically set the selected radio
function setSelectedToolhead(value) {