Initial work on allowing local firmware
This commit is contained in:
parent
e92463ba0d
commit
ab1364436c
|
@ -45,6 +45,7 @@
|
|||
<select name="firmwares" class="select" id="versionsSelect" size="10" width="20" onClick="refreshBasetunes();"></select>
|
||||
<ul class="actions">
|
||||
<li><input type='button' id="btnChoosePort" value="Choose Port" /></li>
|
||||
<li><input type='button' id="btnSelectLocal" value="Use Local Firmware" /></li>
|
||||
</ul>
|
||||
<p>Other actions:</p>
|
||||
<ul class="actions">
|
||||
|
|
15
main.js
15
main.js
|
@ -1,4 +1,4 @@
|
|||
const { app, BrowserWindow, ipcMain, shell } = require('electron')
|
||||
const { app, BrowserWindow, ipcMain, shell, dialog } = require('electron')
|
||||
const {download} = require('electron-dl')
|
||||
const {execFile} = require('child_process');
|
||||
const fs = require('fs');
|
||||
|
@ -137,6 +137,19 @@ ipcMain.on('installWinDrivers', (e, args) => {
|
|||
|
||||
});
|
||||
|
||||
ipcMain.on('selectLocalFirmware', (e, args) => {
|
||||
localFirmware = dialog.showOpenDialogSync({
|
||||
properties: ['openFile'],
|
||||
title: "Select hex file",
|
||||
filters: [{ name: 'Firmware hex', extensions: ['hex'] }] })
|
||||
|
||||
if(localFirmware != undefined)
|
||||
{
|
||||
console.log("Localfirmware selected: " + localFirmware[0] + "")
|
||||
e.sender.send( "add local hex", localFirmware[0], 1 );
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('uploadFW', (e, args) => {
|
||||
|
||||
if(avrdudeIsRunning == true) { return; }
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "speedyloader",
|
||||
"version": "1.5.1",
|
||||
"version": "1.5.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "speedyloader",
|
||||
"version": "1.5.1",
|
||||
"version": "1.5.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
|
|
37
renderer.js
37
renderer.js
|
@ -89,6 +89,7 @@ function refreshSerialPorts()
|
|||
{
|
||||
//Unknown device, assume it's a mega2560
|
||||
newOption.setAttribute("board", "ATMEGA2560");
|
||||
console.log(ports[i].vendorId)
|
||||
}
|
||||
select.add(newOption);
|
||||
}
|
||||
|
@ -378,7 +379,29 @@ function refreshBasetunesDescription()
|
|||
descriptionElement.innerHTML = selectElement.options[selectElement.selectedIndex].dataset.description;
|
||||
}
|
||||
|
||||
function downloadHex(board)
|
||||
ipcRenderer.on("add local hex", (event, filename, state) =>
|
||||
{
|
||||
//Check if Local option already exists
|
||||
var lastOption = document.getElementById('versionsSelect').lastElementChild
|
||||
if(lastOption.innerHTML == "Local")
|
||||
{
|
||||
console.log("Local option already exists, updating");
|
||||
lastOption.value = filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
var newOption = document.createElement('option');
|
||||
newOption.dataset.filename = filename;
|
||||
newOption.innerHTML = "Local";
|
||||
var select = document.getElementById('versionsSelect');
|
||||
select.appendChild(newOption);
|
||||
}
|
||||
|
||||
//Jump to the port selection screen
|
||||
$("[href='#port']").trigger('click');
|
||||
})
|
||||
|
||||
function downloadHex(board, localFile="")
|
||||
{
|
||||
|
||||
var e = document.getElementById('versionsSelect');
|
||||
|
@ -417,8 +440,13 @@ function downloadHex(board)
|
|||
|
||||
function downloadIni()
|
||||
{
|
||||
|
||||
var e = document.getElementById('versionsSelect');
|
||||
if(e.options[e.selectedIndex].innerHTML == "Local")
|
||||
{
|
||||
console.log("Local version selected, not downloading ini");
|
||||
return;
|
||||
}
|
||||
|
||||
var DLurl = "https://speeduino.com/fw/" + e.options[e.selectedIndex].value + ".ini";
|
||||
console.log("Downloading: " + DLurl);
|
||||
|
||||
|
@ -500,6 +528,7 @@ function uploadFW()
|
|||
}
|
||||
else if(extension == "hex")
|
||||
{
|
||||
console.log("Uploading da file!!");
|
||||
statusText.innerHTML = "Beginning upload..."
|
||||
|
||||
//Retrieve the select serial port
|
||||
|
@ -620,6 +649,10 @@ $(function(){
|
|||
$("[href='#port']").trigger('click');
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnSelectLocal', function(event) {
|
||||
ipcRenderer.send('selectLocalFirmware');
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnBasetune', function(event) {
|
||||
$("[href='#basetunes']").trigger('click');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue