GrblHal Build date on Troubleshooting tab, and Restore AutoBackups

master
unknown 2024-12-05 19:04:09 +02:00
rodzic 99ad875cb2
commit ba00fe3efc
3 zmienionych plików z 56 dodań i 12 usunięć

Wyświetl plik

@ -36,6 +36,7 @@ function loadGrblBackupFile(f) {
checkifchanged();
enableLimits(); // Enable or Disable
displayDirInvert();
$("#grblSettingsAdvTab").click();
}
}
}
@ -78,6 +79,40 @@ function restoreAutoBackup(index) {
console.log('Restoring backup:', selectedBackup);
// Call your function to restore the backup here, e.g., update grblParams
// Example: grblParams = selectedBackup.grblParams;
// Retrieve grblParams from the backup
const grblParamsBackup = selectedBackup.grblParams;
// Iterate through the keys in the grblParams object and apply them using jQuery
for (const key in grblParamsBackup) {
if (grblParamsBackup.hasOwnProperty(key)) {
const paramValue = grblParamsBackup[key];
const parsedValue = parseFloat(paramValue);
// Check if the parsed value is a valid number
if (!isNaN(parsedValue)) {
// Update the input field based on the parameter using jQuery
const inputElement = $("#val-" + key.substring(1) + "-input");
if (inputElement.length) {
inputElement.val(parsedValue); // Apply the value to the input field
}
} else {
console.warn(`Invalid value for ${key}: ${paramValue}`);
}
// Optionally, fix or apply any GrblHAL-specific settings
fixGrblHALSettings(key.substring(1)); // Adjust as needed
// Optionally, other functions you might call for updating the machine state
// Example: checkifchanged(); enableLimits(); displayDirInvert();
}
}
// Call any post-restoration functions you need (e.g., re-enable limits, etc.)
checkifchanged();
enableLimits();
displayDirInvert();
$("#grblSettingsAdvTab").click();
}
@ -189,8 +224,8 @@ function grblPopulate() {
<form id="grblSettingsTable">
<ul data-role="tabs" data-expand="true" class="mb-2">
<li onclick="showBasicSettings()"><a href="#"><small><i class="fas fa-fw fa-cog mr-1 fg-darkGreen"></i>Basic Settings</a></small></li>
<li onclick="showAdvSettings()"><a href="#"><small><i class="fas fa-fw fa-cogs mr-1 fg-darkRed"></i>Advanced Settings</a></small></li>
<li id="grblSettingsBasicTab" onclick="showBasicSettings()"><a href="#"><small><i class="fas fa-fw fa-cog mr-1 fg-darkGreen"></i>Basic Settings</a></small></li>
<li id="grblSettingsAdvTab" onclick="showAdvSettings()"><a href="#"><small><i class="fas fa-fw fa-cogs mr-1 fg-darkRed"></i>Advanced Settings</a></small></li>
</ul>
@ -521,9 +556,9 @@ function checkifchanged() {
(!compareAsNumber && newVal !== oldVal)) {
hasChanged = true;
console.log("changed: " + key);
console.log("old: " + oldVal);
console.log("new: " + newVal);
// console.log("changed: " + key);
// console.log("old: " + oldVal);
// console.log("new: " + newVal);
if (!$("#val-" + j + "-input").parent().is('td')) {
$("#val-" + j + "-input").parent().addClass('alert');

Wyświetl plik

@ -60,9 +60,7 @@ function showGrbl(bool, firmware) {
if (localStorage.getItem('jogOverride')) {
jogOverride(localStorage.getItem('jogOverride'))
}
if (laststatus !== undefined) {
$("#firmwareversionstatus").html(laststatus.machine.firmware.platform + " " + laststatus.machine.firmware.version);
};
}
function printLogModern(icon, source, string, printLogCls) {
@ -743,6 +741,10 @@ function initSocket() {
}
$("#firmwareversionstatus").html(status.machine.firmware.platform + " " + status.machine.firmware.version + " (" + status.machine.firmware.date + ")");

Wyświetl plik

@ -1197,10 +1197,18 @@ io.on("connection", function(socket) {
// Grbl $I parser
if (data.indexOf("[VER:") === 0) {
status.machine.name = data.split(':')[2].split(']')[0].toLowerCase()
// Extracting the full version (1.1f)
const version = data.split(':')[1].split('.')[0] + '.' + data.split(':')[1].split('.')[1];
// Extracting the date (20240402)
const date = data.split(':')[1].split('.')[2];
status.machine.firmware.version = version;
status.machine.firmware.date = date;
io.sockets.emit("status", status);
status.machine.name = data.split(':')[2].split(']')[0].toLowerCase()
io.sockets.emit("machinename", data.split(':')[2].split(']')[0].toLowerCase());
status.machine.firmware.date = data.split(':')[1].split(".")[2];
}
if (data.indexOf("[OPT:") === 0) {
@ -1393,7 +1401,6 @@ io.on("connection", function(socket) {
io.sockets.emit('data', output);
}
}
status.machine.firmware.date = "";
// debug_log("GRBL detected");
// setTimeout(function() {
// io.sockets.emit('grbl', status.machine.firmware)
@ -4002,7 +4009,7 @@ async function getSystemInfo() {
}, 60000); // 60,000 ms = 1 minute
// Log the initial systemInformation object
console.log(JSON.stringify(systemInformation, null, 2));
debug_log(JSON.stringify(systemInformation, null, 2));
// Return the systemInformation object (if needed for further use)
io.sockets.emit("sysinfo", systemInformation);