pull/298/head^2
openbuilds-engineer 2023-02-16 19:05:26 +02:00
rodzic 64db788916
commit ed43ec12cd
9 zmienionych plików z 12543 dodań i 156 usunięć

Wyświetl plik

@ -19,7 +19,7 @@ jobs:
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Prepare for app notarization
if: startsWith(matrix.os, 'macos')

Wyświetl plik

@ -1,3 +1,4 @@
v1.0.350: Updated all dependencies, Updated to Node 18, Removed Drivelist Dependency
v1.0.349: Added Multipass option to Surfacing Wizard, Experimental Job resume/recovery Wizard (use at own risk)
v1.0.345-8: Removed Carveco/Fabber links from Open Gcode menu. Fixed bug #292, Updated dark Mode CSS #291, Updated Acro profiles for grblHAL #288, Updated servo support for grblHAL #285, Decreased color shade of button focus box shadow to avoid confusion with distance selector #293, Updated Github Actions scrips
v1.0.344: Fixed bug in Dark Mode theme with Jog Distance Selected CSS

Wyświetl plik

@ -1470,63 +1470,6 @@
<div id="hiddendivs" style="display:none;">
<div class="dialog dark" data-role="dialog" id="usbPrepDialog" data-width="60%" data-overlay-click-close="false" data-to-top="true">
<div class="dialog-title"><i class="fas fa-upload fa-fw"></i> Prepare USB Flashdrive for Interface</div>
<div class="dialog-content" style="height: calc(100% - 100px);">
This wizard will help you add the supporting files to a USB flashdrive for use with OpenBuilds Interface
<hr>
<div class="row">
<div class="cell-md-3 mb-1">
<img src="img/interface/interfacev1.png" width="150" class="mt-5" />
</div>
<div class="cell-md-9 mb-1">
<ul>
<li class="text-secondary">Insert the USB flashdrive into this computer</li>
<li class="text-secondary">Select the correct drive below</li>
<li class="text-secondary">Click COPY to transfer the files</li>
<li class="text-secondary">Eject the flashdrive </li>
<li class="text-secondary">Insert it into the Interface</li>
</ul>
</div>
</div>
<hr>
<div class="row">
<div class="cell-md-3 mb-1">
Controller
</div>
<div class="cell-md-9 mb-1">
<select data-prepend="&nbsp;<i class='fas fa-microchip'></i>" data-role="select" data-filter="false" id="profileTargetController" data-editable="true" data-to-top="true">
<option value="" selected>Select a controller</option>
<option value="blackbox4x">OpenBuilds BlackBox 4X</option>
<option value="blackboxx32">OpenBuilds BlackBox X32</option>
<option value="genericgrbl">Generic Grbl 1.1 Controller</option>
<option value="genericgrblhal">Generic GrblHAL Controller</option>
</select>
</div>
</div>
<div class="row">
<div class="cell-md-3 mb-1">
Port
</div>
<div class="cell-md-9 mb-1">
<select data-prepend="&nbsp;<i class='fab fa-usb'></i>" data-role="select" data-filter="false" id="UsbDriveList" disabled data-editable="true" data-to-top="true">
<option value="">Waiting for USB Flashdrive</option>
</select>
</div>
</div>
</div>
<div class="dialog-actions ">
<button id="copyToUsbBtn" class="button success" onclick="copyFilesToUsb()" disabled>Copy supporting files to Flashdrive</button>
<button class="button js-dialog-close">Cancel</button>
</div>
</div>
<div class="dialog dark" id="downloadUpdate" data-role="dialog" data-overlay-click-close="false" data-to-top="true">
<div class="dialog-title">Update Ready</div>
<div class="dialog-content">

Wyświetl plik

@ -99,14 +99,18 @@ $(document).ready(function() {
// File Open Button compatible with Node 19+ dialogs
if (!disableElectron19FileOpen) {
console.log("Native Dialog not disabled in Troubleshooting")
if (navigator.userAgent.indexOf('Electron') >= 0) {
console.log("Native Dialog Button Enabled")
$("#openGcodeBtn").hide()
$("#openGcodeBtnElectron19").show()
} else {
console.log("Native Dialog Button Disabled")
$("#openGcodeBtn").show()
$("#openGcodeBtnElectron19").hide()
}
} else {
console.log("Native Dialog is Disabled in Troubleshooting")
$("#openGcodeBtn").show()
$("#openGcodeBtnElectron19").hide()
}

Wyświetl plik

@ -130,7 +130,6 @@ function initSocket() {
printLogModern(icon, source, string, printLogCls)
setTimeout(function() {
populatePortsMenu();
populateDrivesMenu();
}, 2000);
socket.on('disconnect', function() {
@ -147,6 +146,16 @@ function initSocket() {
$("#websocketstatus").html("Connected")
});
socket.on('interfaceDrive', function(data) {
console.log(data)
if (data.length > 1) {
$("#interfaceDriveLetterBtn").html("<i class='fab fa-usb'></i> Selected: " + data)
if ($("#profileTargetController").val() != "") {
$(".interfaceCopyBtn").removeClass('disabled');
}
}
})
socket.on('gcodeupload', function(data) {
var icon = ''
var source = "api"
@ -589,22 +598,6 @@ function initSocket() {
populatePortsMenu();
}
if (!_.isEqual(status.interface.diskdrives, laststatus.interface.diskdrives)) {
var string = "Detected a change in available disk drives: ";
for (i = 0; i < status.interface.diskdrives.length; i++) {
if (status.interface.diskdrives[i].isUSB || !status.interface.diskdrives[i].isSystem) {
string += "[" + status.interface.diskdrives[i].mountpoints[0].path + "], "
}
}
var icon = ''
var source = "usb drives"
//var string = string
var printLogCls = "fg-dark"
printLogModern(icon, source, string, printLogCls)
laststatus.interface.diskdrives = status.interface.diskdrives;
populateDrivesMenu();
}
}
if (status.comms.runStatus.indexOf("Door") == 0) {
@ -1099,39 +1092,39 @@ function closePort() {
$('#consoletab').click();
}
function populateDrivesMenu() {
if (laststatus) {
var response = `<select id="select1" data-role="select" class="mt-4"><optgroup label="USB Flashdrives">`
var usbDrives = []
for (i = 0; i < laststatus.interface.diskdrives.length; i++) {
if (laststatus.interface.diskdrives[i].isUSB || !laststatus.interface.diskdrives[i].isSystem) {
usbDrives.push(laststatus.interface.diskdrives[i])
}
};
if (!usbDrives.length > 0) {
response += `<option value="">Waiting for USB Flashdrive</option>`
} else {
for (i = 0; i < usbDrives.length; i++) {
response += `<option value="` + usbDrives[i].mountpoints[0].path + `">` + usbDrives[i].mountpoints[0].path + ` ` + usbDrives[i].description + `</option>`;
};
}
response += `</optgroup></select>`
var select = $("#UsbDriveList").data("select");
if (select) {
select.data(response);
if (!usbDrives.length > 0) {
$('#UsbDriveList').parent(".select").addClass('disabled')
$("#copyToUsbBtn").attr('disabled', true);
} else {
$('#UsbDriveList').parent(".select").removeClass('disabled')
$("#copyToUsbBtn").attr('disabled', false);
}
}
}
}
// function populateDrivesMenu() { // removed in 1.0.350 due to Drivelist stability issues
// if (laststatus) {
// var response = `<select id="select1" data-role="select" class="mt-4"><optgroup label="USB Flashdrives">`
//
// var usbDrives = []
//
// for (i = 0; i < laststatus.interface.diskdrives.length; i++) {
// if (laststatus.interface.diskdrives[i].isUSB || !laststatus.interface.diskdrives[i].isSystem) {
// usbDrives.push(laststatus.interface.diskdrives[i])
// }
// };
//
// if (!usbDrives.length > 0) {
// response += `<option value="">Waiting for USB Flashdrive</option>`
// } else {
// for (i = 0; i < usbDrives.length; i++) {
// response += `<option value="` + usbDrives[i].mountpoints[0].path + `">` + usbDrives[i].mountpoints[0].path + ` ` + usbDrives[i].description + `</option>`;
// };
// }
// response += `</optgroup></select>`
// var select = $("#UsbDriveList").data("select");
// if (select) {
// select.data(response);
// if (!usbDrives.length > 0) {
// $('#UsbDriveList').parent(".select").addClass('disabled')
// $("#copyToUsbBtn").attr('disabled', true);
// } else {
// $('#UsbDriveList').parent(".select").removeClass('disabled')
// $("#copyToUsbBtn").attr('disabled', false);
// }
// }
// }
// }
function populatePortsMenu() {
if (laststatus) {

Wyświetl plik

@ -1,36 +1,96 @@
function populateFlashDrivePrepForm() {
Metro.dialog.open("#usbPrepDialog");
var interfacePrepToolTemplate = `
This wizard will help you add the supporting files to a USB flashdrive for use with OpenBuilds Interface
<hr>
<div class="row">
<div class="cell-md-3 mb-1">
<img src="img/interface/interfacev1.png" width="150" class="mt-5" />
</div>
<div class="cell-md-9 mb-1">
<ul>
<li class="text-secondary">Insert the USB flashdrive into this computer</li>
<li class="text-secondary">Select the correct controller below</li>
<li class="text-secondary">Select the correct drive below</li>
<li class="text-secondary">Click COPY to transfer the files</li>
<li class="text-secondary">Eject the flashdrive </li>
<li class="text-secondary">Insert it into the Interface</li>
</ul>
</div>
</div>
<hr>
<div class="row">
<div class="cell-md-3 mb-1">
Controller
</div>
<div class="cell-md-9 mb-1">
<select onchange="interfaceReadyToCopy()" data-prepend="&nbsp;<i class='fas fa-microchip'></i>" data-role="select" data-filter="false" id="profileTargetController" data-editable="true" data-to-top="true">
<option value="" selected>Select a controller</option>
<option value="blackbox4x">OpenBuilds BlackBox 4X</option>
<option value="blackboxx32">OpenBuilds BlackBox X32</option>
<option value="genericgrbl">Generic Grbl 1.1 Controller</option>
<option value="genericgrblhal">Generic GrblHAL Controller</option>
</select>
</div>
</div>
<div class="row">
<div class="cell-md-3 mb-1">
USB Drive
</div>
<div class="cell-md-9 mb-1">
<button style="width: 100%;" id="interfaceDriveLetterBtn" type="button" class="button" onclick="socket.emit('openInterfaceDir')"><i class='fab fa-usb'></i> Select USB Flashdrive</button>
<!-- <select data-prepend="&nbsp;<i class='fab fa-usb'></i>" data-role="select" data-filter="false" id="UsbDriveList" disabled data-editable="true" data-to-top="true">
<option value="">Waiting for USB Flashdrive</option>
</select> -->
</div>
</div>
`
//Metro.dialog.open("#usbPrepDialog");
Metro.dialog.create({
title: "No controller selected",
clsDialog: "dark",
totop: "true",
width: "60%",
content: interfacePrepToolTemplate,
actions: [{
caption: "Cancel",
cls: "js-dialog-close alert",
// onclick: function() {
// macro1repeat = false;
// printLog("Repeating Macro Exited")
// }
}, {
caption: "Copy supporting files to Flashdrive",
cls: "js-dialog-close success disabled interfaceCopyBtn",
onclick: function() {
copyFilesToUsb()
}
}]
});
}
function interfaceReadyToCopy() {
// drive: laststatus.interface.diskdrive,
// controller: $("#profileTargetController").val()
if ($("#interfaceDriveLetterBtn").html() == "<i class='fab fa-usb'></i> Select USB Flashdrive" && $("#profileTargetController").val() != "") {
$(".interfaceCopyBtn").removeClass('disabled');
}
}
function copyFilesToUsb() {
if ($("#profileTargetController").val() != "") {
$('#controlTab').click();
$('#consoletab').click();
data = {
drive: $("#UsbDriveList").val(),
controller: $("#profileTargetController").val()
}
socket.emit("writeInterfaceUsbDrive", data)
Metro.dialog.close("#usbPrepDialog");
} else {
Metro.dialog.create({
title: "No controller selected",
clsDialog: "dark",
totop: "true",
content: `
Please tell us whether you intend using the OpenBuilds Interface with a BlackBox 4X controller, or a BlackBox X32 controller. This will ensure we copy the correct required files to the USB drive to enable your Interface to work with the controller
`,
actions: [{
caption: "Try again",
cls: "js-dialog-close alert",
// onclick: function() {
// macro1repeat = false;
// printLog("Repeating Macro Exited")
// }
}]
});
$('#controlTab').click();
$('#consoletab').click();
data = {
drive: laststatus.interface.diskdrive,
controller: $("#profileTargetController").val()
}
socket.emit("writeInterfaceUsbDrive", data)
Metro.dialog.close("#usbPrepDialog");
}

Wyświetl plik

@ -35,14 +35,22 @@ var app = express();
var http = require("http").Server(app);
var https = require('https');
var ioServer = require('socket.io');
//var ioServer = require('socket.io');
const {
Server: ioServer
} = require('socket.io');
var io = new ioServer();
var fs = require('fs');
var path = require("path");
const join = require('path').join;
var mkdirp = require('mkdirp');
const drivelist = require('drivelist');
const {
mkdirp
} = require('mkdirp')
//const drivelist = require('drivelist'); // removed in 1.0.350 due to Drivelist stability issues
require('hazardous');
// FluidNC test
@ -435,7 +443,7 @@ var status = {
alarm: ""
},
interface: {
diskdrives: [],
diskdrive: false,
firmware: {
availVersion: "",
installedVersion: "",
@ -472,16 +480,16 @@ async function findChangedPorts() {
findPorts()
}
async function findDisks() {
const drives = await drivelist.list();
status.interface.diskdrives = drives;
}
// async function findDisks() {
// const drives = await drivelist.list();
// status.interface.diskdrives = drives;
// } // removed in 1.0.350 due to Drivelist stability issues
var PortCheckinterval = setInterval(function() {
if (status.comms.connectionStatus == 0) {
findChangedPorts();
}
findDisks();
//findDisks(); // removed in 1.0.350 due to Drivelist stability issues
}, 1000);
// var telnetCheckinterval = setInterval(function() {
@ -689,6 +697,20 @@ io.on("connection", function(socket) {
})
})
socket.on("openInterfaceDir", function(data) {
dialog.showOpenDialog(jogWindow, {
properties: ['openDirectory'],
title: "Select the USB Flashdrive you want to use with Interface"
}).then(result => {
console.log(result.canceled)
console.log(result.filePaths)
io.sockets.emit("interfaceDrive", result.filePaths[0]);
status.interface.diskdrive = result.filePaths[0]
}).catch(err => {
console.log(err)
})
})
socket.on("openbuilds", function(data) {
const {
shell
@ -920,6 +942,7 @@ io.on("connection", function(socket) {
socket.on("writeInterfaceUsbDrive", function(data) {
debug_log(data)
//data.drive = mountpoint dest
//data.controller = type of controller
if (data.controller == "blackbox4x" || data.controller == "genericgrbl") {

Plik diff jest za duży Load Diff

Wyświetl plik

@ -6,7 +6,7 @@
"author": "github.com/openbuilds <support@openbuilds.com>",
"devDependencies": {
"copyfiles": "^2.4.1",
"electron": "^19.0.17",
"electron": "^23.1.0",
"electron-builder": "^23.3.3",
"electron-rebuild": "^3.2.9",
"ncp": "^2.0.0"
@ -14,27 +14,24 @@
"dependencies": {
"avrgirl-arduino": "^5.0.1",
"detect-rpi": "^1.4.0",
"directory-tree": "^2.3.1",
"drivelist": "OpenBuilds/drivelist9",
"electron-builder-notarize": "^1.5.0",
"electron-builder-notarize": "^1.5.1",
"electron-updater": "^5.2.1",
"evilscan": "^1.9.1",
"express": "^4.18.1",
"formidable": "^1.2.6",
"formidable": "^2.1.1",
"hazardous": "^0.3.0",
"https": "^1.0.0",
"ip": "^1.1.8",
"jscs-loader": "^0.3.0",
"lodash": "^4.17.21",
"md5": "^2.3.0",
"mkdirp": "^1.0.4",
"multer": "^1.4.4",
"mkdirp": "^2.1.3",
"multer": "^1.4.5-lts.1",
"ncp": "^2.0.0",
"node-abi": "^3.28.0",
"node-gyp": "^9.3.0",
"rimraf": "^3.0.2",
"serialport": "^10.4.0",
"socket.io": "^2.5.0"
"node-abi": "^3.33.0",
"node-gyp": "^9.3.1",
"serialport": "^10.5.0",
"socket.io": "^4.6.0"
},
"main": "index.js",
"scripts": {