flashing tool update

pull/212/head
openbuilds-engineer 2020-11-23 21:06:28 +02:00
rodzic 1327ea95eb
commit 219c78b1f9
9 zmienionych plików z 353 dodań i 103 usunięć

Wyświetl plik

@ -20,7 +20,7 @@
}
.jogbtn:disabled {
pointer-events:none;
pointer-events: none;
}
.dro {
@ -35,7 +35,7 @@
padding-right: 6px;
padding-left: 6px;
line-height: 32px;
font-weight:900;
font-weight: 900;
font-size: 18px;
cursor: pointer;
}
@ -55,13 +55,13 @@
line-height: 34px;
border-radius: 2px;
border: 1px solid #ddd;
font-weight:700;
font-weight: 700;
font-size: 18px;
cursor: default;
text-align: right;
border: none;
outline: none;
display:none;
display: none;
}
.glossybtn:link, .glossybtn:visited {
@ -85,10 +85,11 @@
.glossybtn:hover {
text-decoration: none;
background: rgba(164,206,249, 0.2);
border: 1px solid rgb(164,206,249);
}
background: rgba(164, 206, 249, 0.2);
border: 1px solid rgb(164, 206, 249);
}
/* CSS Mini SwitchCheckbox */
/* <label class="toggle">
@ -105,21 +106,26 @@
position: absolute;
width: 1px;
}
.toggle-component {
margin-bottom: 3rem;
}
.toggle-component p {
margin: 0.7rem 0;
}
.toggle {
display: table;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
margin-bottom: 0px;
}
.toggle input:focus + div {
.toggle input:focus+div {
text-decoration: underline;
}
.toggle > div {
.toggle>div {
cursor: pointer;
border-radius: 14px;
width: 36px;
@ -131,10 +137,12 @@
transition: 150ms ease-out;
font-size: 0;
}
.toggle > div:hover {
.toggle>div:hover {
box-shadow: 0 0 4px #4a4e51;
}
.toggle > div:before {
.toggle>div:before {
will-change: translate;
display: block;
position: absolute;
@ -147,15 +155,16 @@
border-radius: 50%;
transition: 150ms;
}
.toggle input:checked + div {
.toggle input:checked+div {
background: #fff;
border-color: #lightgray;
}
.toggle input:checked + div:before {
.toggle input:checked+div:before {
color: #4a4e51;
transform: translateX(19px);
background: #4a4e51;
}
/* End CSS mini Switch */

Wyświetl plik

@ -60,7 +60,6 @@
<i class="fas fa-download"></i>
</span>
<span class="caption">Backup<br>Settings</span>
<span class="badge bg-green fg-white">New!</span>
</button>
<span class="title">Grbl Settings</span>
</div>
@ -219,7 +218,6 @@
</span>
</span>
<span class="caption grblmode">Probe</span>
<span class="badge bg-green fg-white">New!</span>
</button>
@ -321,7 +319,7 @@
<li class="divider fg-lightGray"></li>
<li onclick="keyboardShortcutsEditor();"><a href="#"><i class="far fa-edit fa-fw"></i> Customize Shortcut Key Assignments</a></li>
<li class="divider fg-lightGray"></li>
<li onclick="populateGrblBuilderToolForm();"><a href="#"><img src="img/grbl.png" /> Flashing Tool</a></li>
<li onclick="populateGrblBuilderToolForm();"><a href="#"><i class="fas fa-microchip fa-fw"></i> Firmware Flashing Tool</a></li>
</ul>
</div>
@ -1120,23 +1118,51 @@
<div id="hiddendivs" style="display:none;">
<div class="dialog dark" data-role="dialog" id="grblFlashDialog" data-width="60%" data-actions-align="right" data-overlay-click-close="true">
<div class="dialog-title"><img src="img/grbltop.png" /> Custom Grbl Flashing Tool</div>
<div class="dialog-title"><i class="fas fa-microchip fa-fw"></i> Firmware Flashing Tool</div>
<div class="dialog-content" style="height: calc(100% - 100px);">
<p class="text-small mb-4">You can use this wizard to flash customized instances of Grbl Firmware onto a compatible controller<br>Only use with care, or when instructed by Support</p>
<form>
<p class="text-small mb-4">You can use this wizard to flash Firmware onto compatible controllers<br>Only use with care, or when instructed by Support</p>
<div class="row">
<div class="cell-md-4 mb-1">
Controller Type
</div>
<div class="cell-md-8 mb-1">
<select data-prepend="&nbsp;<i class='fas fa-microchip'></i>" data-role="select" data-filter="false" id="flashController" data-editable="true">
<option value="interface">OpenBuilds Interface</option>
<option value="uno" selected>OpenBuilds BlackBox 4X</option>
<option value="xprov4">Spark Concepts xPro v3/4</option>
<option value="uno">Arduino Uno</option>
<option value="nano">Arduino Nano</option>
</select>
</div>
</div>
<div class="row" id="flash-tool-interface-fw-row" style="display: none;">
<div class="cell-md-4 mb-1">
Firmware Version
</div>
<div class="cell-md-8 mb-1">
<select data-prepend="&nbsp;<i class='fas fa-cube'></i>" data-role="select" data-filter="false" id="interfaceFirmwareVer" data-editable="true">
<option value="online">Latest available version</option>
<option value="custom">Custom: firmware binary file</option>
</select>
</div>
</div>
<div class="row" id="flash-tool-machine-row">
<div class="cell-md-4 mb-1">
Machine Style
</div>
<div class="cell-md-8 mb-1">
<select data-prepend="&nbsp;<i class='fas fa-cube'></i>" data-role="select" data-filter="false" id="grblAxesCount" data-editable="true">
<option value=3axes>3 Axes</option>
<option value=2axes>2 Axes</option>
<option value=servo>2 Axes + RC Servo</option>
<option value="3axes">3 Axes</option>
<option value="2axes">2 Axes</option>
<option value="servo">2 Axes + RC Servo</option>
<option value="custom">Custom: firmware hex file</option>
</select>
</div>
</div>
<div class="row">
<div class="row" id="flash-tool-door-row">
<div class="cell-md-4 mb-1">
Door Interlock
</div>
@ -1148,19 +1174,7 @@
</select>
</div>
</div>
<div class="row">
<div class="cell-md-4 mb-1">
Controller Type
</div>
<div class="cell-md-8 mb-1">
<select data-prepend="&nbsp;<i class='fas fa-microchip'></i>" data-role="select" data-filter="false" id="flashGrblController" data-editable="true">
<option value="uno">OpenBuilds BlackBox 4X</option>
<option value="xprov4">Spark Concepts xPro v3/4</option>
<option value="uno">Arduino Uno</option>
<option value="nano">Arduino Nano</option>
</select>
</div>
</div>
<div class="row">
<div class="cell-md-4 mb-1">
Port
@ -1171,10 +1185,24 @@
</select>
</div>
</div>
<div class="row" id="flash-tool-custom-row" style="display: none;">
<div class="cell-md-4 mb-1">
Firmware Image
</div>
<div class="cell-md-8 mb-1">
<form id="customFirmwareForm" enctype="multipart/form-data">
<button class="button alert shadow btn-file" action="#"><input class="btn-file" id="firmwareBin" type="file" accept=".bin, .hex" name="firmwareBin" /><i class="far fa-folder-open fa-fw"></i> Use custom firmware image</button>
<br>
<small id="customFirmwareSet"></small>
</form>
</div>
</div>
</div>
<div class="dialog-actions">
<button class="button success js-dialog-close" onclick="flashGrblfromWizard()">Flash</button>
<button class="button success js-dialog-close" onclick="flashFirmwarefromWizard()">Flash</button>
<button class="button js-dialog-close">Cancel</button>
</div>
</div>
@ -1188,7 +1216,7 @@
<div class="row mb-2">
<label class="cell-sm-6">Router Bit Diameter</label>
<div class="cell-sm-6">
<input id="surfaceDiameter" type="number" data-role="input" data-append="mm" data-clear-button="false" value="22" data-editable="true">
<input id="surfaceDiameter" type="number" data-role="input" data-append="mm" data-clear-button="false" placeholder="22" value="22" data-editable="true">
<small class="text-muted">Diameter of your bit / endmill</small>
</div>
</div>
@ -1196,7 +1224,7 @@
<div class="row mb-2">
<label class="cell-sm-6">Stepover</label>
<div class="cell-sm-6">
<input id="surfaceStepover" type="number" data-role="input" data-append="%" data-clear-button="false" value="40" data-editable="true">
<input id="surfaceStepover" type="number" data-role="input" data-append="%" data-clear-button="false" placeholder="40" value="40" data-editable="true">
<small class="text-muted">Stepover between passes </small>
</div>
</div>
@ -1204,7 +1232,7 @@
<div class="row mb-2 border-bottom bd-lightGray">
<label class="cell-sm-6">Feedrate</label>
<div class="cell-sm-6">
<input id="surfaceFeedrate" type="number" maxlength="5" data-role="input" data-append="mm/min" data-clear-button="false" value="800" data-editable="true"
<input id="surfaceFeedrate" type="number" maxlength="5" data-role="input" data-append="mm/min" data-clear-button="false" placeholder="800" value="800" data-editable="true"
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);">
<small class="text-muted">Cutting speed</small>
</div>
@ -1213,14 +1241,14 @@
<div class="row mb-2">
<label class="cell-sm-6">Width<br> <small class="text-muted">X-Axis</small></label>
<div class="cell-sm-6">
<input id="surfaceX" type="number" data-role="input" data-append="mm" data-clear-button="false" value="200" data-editable="true">
<input id="surfaceX" type="number" data-role="input" data-append="mm" data-clear-button="false" placeholder="200" value="200" data-editable="true">
</div>
</div>
<div class="row mb-2 border-bottom bd-lightGray">
<label class="cell-sm-6">Length<br> <small class="text-muted">Y-Axis</small></label>
<div class="cell-sm-6">
<input id="surfaceY" type="number" data-role="input" data-append="mm" data-clear-button="false" value="300" data-editable="true">
<input id="surfaceY" type="number" data-role="input" data-append="mm" data-clear-button="false" placeholder="300" value="300" data-editable="true">
<small class="text-muted">Width and Length of the area to machine flat</small>
</div>
</div>
@ -1228,7 +1256,7 @@
<div class="row mb-2 border-bottom bd-lightGray">
<label class="cell-sm-6">Skim Depth</label>
<div class="cell-sm-6">
<input id="surfaceDepth" type="number" data-role="input" data-append="mm" data-clear-button="false" value="2" data-editable="true">
<input id="surfaceDepth" type="number" data-role="input" data-append="mm" data-clear-button="false" placeholder="2" value="2" data-editable="true">
<small class="text-muted">How much material to remove</small>
</div>
</div>
@ -1236,7 +1264,7 @@
<div class="row mb-2 border-bottom bd-lightGray">
<label class="cell-sm-6">Spindle RPM</label>
<div class="cell-sm-6">
<input id="surfaceRPM" type="number" data-role="input" data-append="mm" data-clear-button="false" value="1000" data-editable="true">
<input id="surfaceRPM" type="number" data-role="input" data-append="mm" data-clear-button="false" placeholder="1000" value="1000" data-editable="true">
<small class="text-muted">Spindle RPM for variable spindles</small>
</div>
</div>

Wyświetl plik

@ -151,6 +151,12 @@ $(document).ready(function() {
safeToUpdateSliders = false;
}).mouseup(function(e) {
safeToUpdateSliders = true;
// Added to cancel Jog moves even when user moved the mouse off the button before releasing
if (allowContinuousJog) {
if (continuousJogRunning) {
cancelJog()
}
}
}).mouseleave(function(e) {
safeToUpdateSliders = true;
});
@ -367,6 +373,9 @@ $(document).ready(function() {
$('.xM').on('touchstart mousedown', function(ev) {
if (ev.which != 1) {
return
}
ev.preventDefault();
var hasSoftLimits = false;
if (Object.keys(grblParams).length > 0) {
@ -417,6 +426,9 @@ $(document).ready(function() {
$('.xP').on('touchstart mousedown', function(ev) {
// console.log("xp down")
if (ev.which != 1) {
return
}
ev.preventDefault();
var hasSoftLimits = false;
if (Object.keys(grblParams).length > 0) {
@ -465,6 +477,9 @@ $(document).ready(function() {
});
$('.yM').on('touchstart mousedown', function(ev) {
if (ev.which != 1) {
return
}
ev.preventDefault();
var hasSoftLimits = false;
if (Object.keys(grblParams).length > 0) {
@ -514,6 +529,9 @@ $(document).ready(function() {
});
$('.yP').on('touchstart mousedown', function(ev) {
if (ev.which != 1) {
return
}
ev.preventDefault();
var hasSoftLimits = false;
if (Object.keys(grblParams).length > 0) {
@ -563,6 +581,9 @@ $(document).ready(function() {
});
$('.zM').on('touchstart mousedown', function(ev) {
if (ev.which != 1) {
return
}
ev.preventDefault();
var hasSoftLimits = false;
if (Object.keys(grblParams).length > 0) {
@ -612,6 +633,9 @@ $(document).ready(function() {
});
$('.zP').on('touchstart mousedown', function(ev) {
if (ev.which != 1) {
return
}
ev.preventDefault();
var hasSoftLimits = false;
if (Object.keys(grblParams).length > 0) {

Wyświetl plik

@ -5,7 +5,9 @@ $(document).ready(function() {
function checkUpdate() {
if (!isMac && webgl) {
setTimeout(function() {
// console.log('checking for update')
printLog("<span class='fg-red'>[ update ] </span><span class='fg-green'>Checking for Updates</span>")

Wyświetl plik

@ -301,6 +301,18 @@ function initSocket() {
string = string.replace('flash complete.', "<span class='fg-red'><i class='fas fa-times fa-fw fg-red fa-fw'> </i> FLASH FAILED!</span> ");
string = string.replace('', "<span class='fg-green'><i class='fas fa-check fa-fw fg-green fa-fw'></i> ");
string = string.replace('', "</span>");
if (string.indexOf("Hash of data verified") != -1) {
string = "<span class='fg-green'><i class='fas fa-check fa-fw fg-green fa-fw'></i>" + string + "</span>"
}
if (string.indexOf("could not open port") != -1) {
string = "<span class='fg-red'><i class='fas fa-times fa-fw fg-red fa-fw'></i>" + string + "</span>"
}
if (string.indexOf("something went wrong") != -1) {
string = "<span class='fg-red'><i class='fas fa-times fa-fw fg-red fa-fw'></i>" + string + "</span>"
}
if (string.indexOf("fatal error occurred") != -1) {
string = "<span class='fg-red'><i class='fas fa-times fa-fw fg-red fa-fw'></i>" + string + "</span>"
}
printLog("<span class='fg-red'>[ Firmware Upgrade ] </span>" + string)
// $('#sendCommand').click();

Wyświetl plik

@ -1,37 +1,160 @@
function flashGrblfromTroubleshooting() {
var data = {
port: $("#portUSB").val(),
file: $("#flashGrblHex").val(),
board: $("#flashGrblController").val()
$(document).ready(function() {
$("#flashController").on("change", function() {
if (this.value == "interface") {
$("#flash-tool-machine-row").hide();
$("#flash-tool-door-row").hide();
$("#flash-tool-interface-fw-row").show();
if ($("#interfaceFirmwareVer").val() == "custom") {
$("#flash-tool-custom-row").show();
} else {
$("#flash-tool-custom-row").hide();
}
socket.emit('flashGrbl', data)
}
$("#customFirmwareSet").html("Please select the Interface Firmware binary file you want to flash");
} else {
$("#flash-tool-machine-row").show();
$("#flash-tool-door-row").show();
$("#flash-tool-interface-fw-row").hide();
$("#flash-tool-custom-row").hide();
$("#customFirmwareSet").html("Please select the Grbl Firmware hex file you want to flash");
}
});
$("#grblAxesCount").on("change", function() {
if (this.value == "custom") {
$("#flash-tool-door-row").hide();
$("#flash-tool-custom-row").show();
$("#customFirmwareSet").html("Please select the Grbl Firmware hex file you want to flash");
} else {
$("#flash-tool-door-row").show();
$("#flash-tool-custom-row").hide();
}
});
$("#interfaceFirmwareVer").on("change", function() {
if (this.value == "custom") {
$("#flash-tool-custom-row").show();
$("#customFirmwareSet").html("Please select the Interface Firmware binary file you want to flash");
} else {
$("#flash-tool-custom-row").hide();
}
});
// var fileOpen = document.getElementById('firmwareBin');
// if (fileOpen) {
// fileOpen.addEventListener('change', readEspFirmwareFile, false);
// }
function readEspFirmwareFile() {
console.log("Sending")
var form = document.getElementById('customFirmwareForm');
var formData = new FormData(form);
var xhr = new XMLHttpRequest();
xhr.onload = function() {
if (xhr.status == 200) {
$("#customFirmwareSet").html(xhr.response)
}
};
// Add any event handlers here...
xhr.open('POST', '/uploadCustomFirmware', true);
xhr.send(formData);
}
});
function populateGrblBuilderToolForm() {
//$("#filetoflash").empty();
Metro.dialog.open("#grblFlashDialog");
var opts = `<option value="online">Latest available v` + laststatus.interface.firmware.availVersion + `</option>`;
opts += `<option value="custom">Custom: firmware binary file</option>`;
var select = $("#interfaceFirmwareVer").data("select");
select.data(opts);
}
function flashGrblfromWizard() {
var formdata = {
axesCount: $("#grblAxesCount").val(),
door: $("#grblDoorEnable").val(),
flashGrblController: $("#flashGrblController").val(),
port: $("#portUSB2").val()
};
$("#filetoflash").html('run file: ' + JSON.stringify(formdata));
$("#filetoflash").append("<hr>grbl-" + formdata.axesCount + "-" + formdata.door + ".hex");
function flashFirmwarefromWizard() {
if ($("#flashController").val() != "interface") {
var data = {
port: $("#portUSB").val(),
file: "grbl-" + formdata.axesCount + "-" + formdata.door + ".hex",
board: $("#flashGrblController").val()
port: $("#portUSB2").val(),
file: "grbl-" + $("#grblAxesCount").val() + "-" + $("#grblDoorEnable").val() + ".hex",
board: $("#flashController").val(),
customImg: false
}
if ($("#grblAxesCount").val() == "custom") {
// Custom Firmware
if ($("#firmwareBin").val().length > 0) {
var form = document.getElementById('customFirmwareForm');
var formData = new FormData(form);
var xhr = new XMLHttpRequest();
xhr.onload = function() {
if (xhr.status == 200) {
$("#customFirmwareSet").html(xhr.response);
data.customImg = true;
data.file = $("#firmwareBin").val();
socket.emit('flashGrbl', data);
}
};
// Add any event handlers here...
xhr.open('POST', '/uploadCustomFirmware', true);
xhr.send(formData);
} else {
$('#controlTab').click();
$('#consoletab').click();
printLog("<span class='fg-red'>[ Firmware Upgrade ] </span><span class='fg-red'><i class='fas fa-times fa-fw fg-red fa-fw'></i>You selected the option to use a custom firmware file, but failed to select a file to use for the operation. Please try again</span>")
}
} else {
// Precompiled Firmwares
socket.emit('flashGrbl', data)
}
} else if ($("#flashController").val() == "interface") {
var data = {
port: $("#portUSB2").val(),
file: "firmware.bin", // version that ships with Interface
board: $("#flashController").val()
}
if ($("#interfaceFirmwareVer").val() == "custom") {
// custom image
if ($("#firmwareBin").val().length > 0) {
var form = document.getElementById('customFirmwareForm');
var formData = new FormData(form);
var xhr = new XMLHttpRequest();
xhr.onload = function() {
if (xhr.status == 200) {
$("#customFirmwareSet").html(xhr.response);
data.file = $("#firmwareBin").val();
socket.emit('flashInterface', data);
}
};
// Add any event handlers here...
xhr.open('POST', '/uploadCustomFirmware', true);
xhr.send(formData);
} else {
$('#controlTab').click();
$('#consoletab').click();
printLog("<span class='fg-red'>[ Firmware Upgrade ] </span><span class='fg-red'><i class='fas fa-times fa-fw fg-red fa-fw'></i>You selected the option to use a custom firmware file, but failed to select a file to use for the operation. Please try again</span>")
}
} else {
// latest included firmware
socket.emit('flashInterface', data)
}
} else {
console.log("no controller selected")
}
}
// grbl-3axes-nodoor.hex
// grbl-3axes-opendoor.hex
// grbl-3axes-closeddoor.hex

Wyświetl plik

@ -129,6 +129,7 @@ var appIcon = null,
mainWindow = null
var autoUpdater
var updateIsDownloading = false;
if (isElectron()) {
autoUpdater = require("electron-updater").autoUpdater
@ -392,6 +393,12 @@ var status = {
activePort: "" // or activeIP in the case of wifi/telnet?
},
alarm: ""
},
interface: {
firmware: {
availVersion: "",
downloadedVersion: ""
}
}
};
@ -662,6 +669,12 @@ io.on("connection", function(socket) {
})
//download(url, dest, cb)
socket.on("flashGrbl", function(data) {
var port = data.port;
@ -1022,7 +1035,7 @@ io.on("connection", function(socket) {
if (status.comms.connectionStatus > 0) {
addQRealtime("?");
}
}, 50);
}, 100);
} else if (data.indexOf("LPC176") >= 0) { // LPC1768 or LPC1769 should be Smoothieware
status.comms.blocked = false;
debug_log("Smoothieware detected");
@ -2505,6 +2518,48 @@ function startChrome() {
}
// Interface Programming
// grab latest firmware.bin for Interface on startup
var file = fs.createWriteStream(path.join(__dirname, "firmware.bin"));
https.get("https://raw.githubusercontent.com/OpenBuilds/firmware/main/interface/firmware.bin", function(response) {
response.pipe(file);
file.on('finish', function() {
file.close(function() {
const options = {
hostname: 'raw.githubusercontent.com',
port: 443,
path: '/OpenBuilds/firmware/main/interface/version.txt',
method: 'GET'
}
const req = https.request(options, res => {
console.log(`statusCode: ${res.statusCode}`)
res.on('data', d => {
status.interface.firmware.availVersion = parseFloat(d.toString())
})
})
req.on('error', error => {
console.error(error)
})
req.end()
var output = {
'command': '',
'response': "Downloaded firmware.bin v" + status.interface.firmware.availVersion
}
io.sockets.emit('data', output);
});
});
})
var firmwareImagePath = path.join(__dirname, './firmware.bin');
var spawn = require('child_process').spawn;
const multer = require('multer');
@ -2596,11 +2651,7 @@ function flashInterface(data) {
status.comms.connectionStatus = 0;
});
}
// end Interface Programming

Wyświetl plik

@ -1,6 +1,6 @@
{
"name": "OpenBuildsCONTROL",
"version": "1.0.258",
"version": "1.0.260",
"license": "AGPL-3.0",
"description": "OpenBuildsCONTROL CNC Machine Interface Software",
"author": "github.com/openbuilds <webmaster@openbuilds.com>",
@ -19,14 +19,15 @@
"formidable": "^1.2.2",
"https": "^1.0.0",
"ip": "^1.1.5",
"jscs-loader": "^0.3.0",
"lodash": "^4.17.19",
"md5": "^2.3.0",
"mkdirp": "^1.0.4",
"multer": "^1.4.2",
"node-abi": "^2.18.0",
"rimraf": "^3.0.2",
"serialport": "^9.0.1",
"socket.io": "^2.3.0",
"jscs-loader": "^0.3.0"
"socket.io": "^2.3.0"
},
"main": "index.js",
"scripts": {