Merge pull request #34 from DeionSi/update-packages
Update packages and many small fixes
This commit is contained in:
commit
98e7d7252a
|
@ -2346,12 +2346,7 @@ input, select, textarea {
|
|||
}
|
||||
|
||||
select {
|
||||
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' preserveAspectRatio='none' viewBox='0 0 40 40'%3E%3Cpath d='M9.4,12.3l10.4,10.4l10.4-10.4c0.2-0.2,0.5-0.4,0.9-0.4c0.3,0,0.6,0.1,0.9,0.4l3.3,3.3c0.2,0.2,0.4,0.5,0.4,0.9 c0,0.4-0.1,0.6-0.4,0.9L20.7,31.9c-0.2,0.2-0.5,0.4-0.9,0.4c-0.3,0-0.6-0.1-0.9-0.4L4.3,17.3c-0.2-0.2-0.4-0.5-0.4-0.9 c0-0.4,0.1-0.6,0.4-0.9l3.3-3.3c0.2-0.2,0.5-0.4,0.9-0.4S9.1,12.1,9.4,12.3z' fill='rgba(255, 255, 255, 0.15)' /%3E%3C/svg%3E");
|
||||
background-size: 1.25rem;
|
||||
background-repeat: no-repeat;
|
||||
background-position: calc(100% - 1rem) center;
|
||||
height: 20.75em;
|
||||
padding-right: 2.75em;
|
||||
padding-top: 0.75em;
|
||||
padding-bottom: 0.75em;
|
||||
text-overflow: ellipsis;
|
||||
|
@ -2359,7 +2354,7 @@ input, select, textarea {
|
|||
|
||||
select option {
|
||||
color: #ffffff;
|
||||
background: #312450;
|
||||
background: none;
|
||||
}
|
||||
|
||||
select:focus::-ms-value {
|
||||
|
@ -2375,13 +2370,6 @@ input, select, textarea {
|
|||
background: #022b3a;
|
||||
}
|
||||
|
||||
.select5 option {
|
||||
color: #ffffff;
|
||||
background: #022b3a;
|
||||
padding-top: 4px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.select1 {
|
||||
height: 1.75em;
|
||||
width: 12em;
|
||||
|
@ -3221,40 +3209,20 @@ input, select, textarea {
|
|||
|
||||
/* Wrapper */
|
||||
|
||||
div.wrapper {
|
||||
padding-top: 3.5em;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wrapper > .inner {
|
||||
padding: 5em 5em 3em 5em ;
|
||||
padding: 1em 3em;
|
||||
max-width: 100%;
|
||||
width: 75em;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1680px) {
|
||||
|
||||
.wrapper > .inner {
|
||||
padding: 4em 4em 2em 4em ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1280px) {
|
||||
|
||||
.wrapper > .inner {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 736px) {
|
||||
|
||||
.wrapper > .inner {
|
||||
padding: 3em 2em 1em 2em ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.wrapper.alt {
|
||||
background-color: #261c3e;
|
||||
}
|
||||
|
@ -3898,33 +3866,13 @@ input, select, textarea {
|
|||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 736px) {
|
||||
|
||||
#sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Sponsor bar */
|
||||
#sponsor {
|
||||
padding: 2.5em 2.5em 0.5em 2.5em ;
|
||||
background: #EE6C4D;
|
||||
color: #FFFFFF;
|
||||
cursor: default;
|
||||
height: 7em;
|
||||
height: 0;
|
||||
left: 0;
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
top: 3.5em;
|
||||
width: 18em;
|
||||
z-index: 10000;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
line-height: 3.5em;
|
||||
transition-property:height;
|
||||
transition-duration:1s;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -19,10 +19,6 @@
|
|||
xsmall: [ null, '480px' ]
|
||||
});
|
||||
|
||||
// Hack: Enable IE flexbox workarounds.
|
||||
if (browser.name == 'ie')
|
||||
$body.addClass('is-ie');
|
||||
|
||||
// Play initial animations on page load.
|
||||
$window.on('load', function() {
|
||||
window.setTimeout(function() {
|
||||
|
@ -115,7 +111,7 @@
|
|||
|
||||
// Scrolly.
|
||||
$('.scrolly').scrolly({
|
||||
speed: 1000,
|
||||
speed: 200,
|
||||
offset: function() {
|
||||
|
||||
// If <=large, >small, and sidebar is present, use its height as the offset.
|
||||
|
|
115
index.html
115
index.html
|
@ -11,7 +11,6 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="assets/css/main.css" />
|
||||
|
||||
<script src="renderer.js" ></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -21,10 +20,11 @@
|
|||
<nav>
|
||||
<ul>
|
||||
<li><a href="#loader">Choose Firmware</a></li>
|
||||
<li><a href="#details">Firmware Details</a></li>
|
||||
<li style="display: none;"><a href="#details">Firmware Details</a></li>
|
||||
<li><a href="#port">Choose Port</a></li>
|
||||
<li><a href="#progress">Progress</a></li>
|
||||
<li><a href="#basetunes">Base Tunes</a></li>
|
||||
<li style="display: none;"><a href="#basetunewarning">Base Tunes</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<div class="wrapper">
|
||||
|
||||
<!-- Choose Version -->
|
||||
<section id="loader" class="wrapper style1 fullscreen fade-up" style="height: 100vh;">
|
||||
<section id="loader" class="wrapper style1" style="height: 100vh;">
|
||||
<div class="inner">
|
||||
<div style="display: none; text-align: center;" id="update_text"><a href="" id="update_url" target="_blank">A new version is available. Click here to download</a></div>
|
||||
<center><img src="assets/speeduino logo_white.png" width="235"/></center>
|
||||
|
@ -44,12 +44,12 @@
|
|||
<span class="icon fa-spinner" style="position: absolute; left: 48%; top: 42%;" id="fwVersionsSpinner"></span>
|
||||
<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" onclick="window.location.href='#port';" /></li>
|
||||
<li><input type='button' id="btnChoosePort" value="Choose Port" /></li>
|
||||
</ul>
|
||||
<p>Other actions:</p>
|
||||
<ul class="actions">
|
||||
<li><input type='button' id="btnDetails" value="View Firmware Notes" onclick="refreshDetails();" /></li>
|
||||
<li><input type='button' value="Get Base Tune" id="btnBasetune" onclick="window.location.href='#basetunes';" /></li>
|
||||
<li><input type='button' id="btnDetails" value="View Firmware Notes" /></li>
|
||||
<li><input type='button' value="Get Base Tune" id="btnBasetune" /></li>
|
||||
</ul>
|
||||
</p>
|
||||
<div id="error"></div>
|
||||
|
@ -58,32 +58,32 @@
|
|||
</section>
|
||||
|
||||
<!-- Firmware details -->
|
||||
<section id="details" class="wrapper style1-alt spotlights" style="display: none; height: 100vh;">
|
||||
<section id="details" class="wrapper style1-alt" style="height: 100vh;">
|
||||
<div class="inner">
|
||||
<h1>Firmware Notes</h1>
|
||||
<h2>Firmware Notes</h2>
|
||||
|
||||
<div class="features major" >
|
||||
<h2><div id="detailsHeading" style="padding-left: 0.55em;" ></div></h2>
|
||||
<div id="detailsText" style="padding-left: 0.9em; padding-right: 0.9em; overflow-y: scroll; height: 50vh;"></div>
|
||||
</div>
|
||||
<ul class="actions">
|
||||
<li><input type='button' value="Get Base Tune" id="btnBasetune" onclick="window.location.href='#basetunes';" /></li>
|
||||
<li><input type='button' id="btnDetails" value="Change Version" onclick="window.location.href='#loader';" /></li>
|
||||
<li><input type='button' id="btnChoosePort" value="Install" onclick="window.location.href='#port';" /></li>
|
||||
<li><input type='button' value="Get Base Tune" id="btnBasetune" /></li>
|
||||
<li><input type='button' id="btnLoader" value="Change Version" /></li>
|
||||
<li><input type='button' id="btnChoosePort" value="Install" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Choose Port -->
|
||||
<section id="port" class="wrapper style2 fullscreen fade-up" style="height: 100vh;">
|
||||
<section id="port" class="wrapper style2" style="height: 100vh;">
|
||||
<div class="inner">
|
||||
<h1>Select Serial Port</h1>
|
||||
<h2>Select Serial Port</h2>
|
||||
<p>Available Ports:
|
||||
<select name="ports" class="select" id="portsSelect" size="10" width="20"></select>
|
||||
<ul class="actions">
|
||||
<!-- <li><input type='button' value="Install Serial Drivers" onclick="installDrivers();" /></li> -->
|
||||
<li><input type='button' value="Refresh" onclick="refreshSerialPorts();" /></li>
|
||||
<li><input type='button' value="Upload" id="btnInstall" onclick="uploadFW();" /></li>
|
||||
<li><input type='button' value="Upload" id="btnInstall" /></li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -92,22 +92,30 @@
|
|||
</section>
|
||||
|
||||
<!-- Progress -->
|
||||
<section id="progress" class="wrapper style3 fade-up" style="height: 100vh;">
|
||||
<!-- Sponsor bar -->
|
||||
<section id="progress" class="wrapper style3" style="height: 100vh;">
|
||||
|
||||
<!-- Sponsor bar -->
|
||||
<div class="features" id="sponsorbox" style="display: none;">
|
||||
<section id="sponsor">
|
||||
<div class="inner">
|
||||
<p><center><a href="https://github.com/sponsors/noisymime" target="_blank">Speeduino is a volunteer run project. Click here if you're interested in supporting Speeduino's development</a><br /><span class="icon major fa-heart"></span></center></p>
|
||||
</div>
|
||||
<span class="icon major fa-heart"></span>
|
||||
<p><center>
|
||||
<a href="https://github.com/sponsors/noisymime" target="_blank">Speeduino is a volunteer run project. Click here if you're interested in supporting Speeduino's development</a>
|
||||
</center>
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="inner">
|
||||
|
||||
<h2>Progress</h2>
|
||||
|
||||
<div class="features">
|
||||
<section>
|
||||
<span class="icon major fa-pause" id="progressSpinner"></span>
|
||||
<p>
|
||||
<strong>Current Status:</strong>
|
||||
<span id="statusText"></span><span id="burnPercent"></span><br />
|
||||
<span id="iniFileText" style="display: none;">TunerStudio definition file: <a id="iniFileLink" onClick="openFileMgr();" ><span id="iniFileLocation"></span></a></span></span>
|
||||
<span id="iniFileText" style="display: none;">TunerStudio definition file: <a id="iniFileLink"><span id="iniFileLocation"></span></a></span></span>
|
||||
</p>
|
||||
</section>
|
||||
<section id="terminalSection" style="display: none;">
|
||||
|
@ -117,36 +125,20 @@
|
|||
</section>
|
||||
</div>
|
||||
<ul class="actions">
|
||||
<li><input type='button' id="btnChoosePort" value="Choose Port" onclick="window.location.href='#port';" /></li>
|
||||
<li><input type='button' value="Burn again" id="btnReinstall" onclick="uploadFW();" /></li>
|
||||
<li><input type='button' value="Get Base Tune" id="btnBasetune" onclick="window.location.href='#basetunes';" /></li>
|
||||
<li><input type='button' id="btnChoosePort" value="Choose Port" /></li>
|
||||
<li><input type='button' value="Burn again" id="btnReinstall" /></li>
|
||||
<li><input type='button' value="Get Base Tune" id="btnBasetune" /></li>
|
||||
</ul>
|
||||
<ul class="actions">
|
||||
<li><input type='button' value="Exit" id="btnExit" onclick="quit();" /></li>
|
||||
<li><input type='button' value="Exit" id="btnExit" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Firmware details -->
|
||||
<section id="details" class="wrapper style1-alt spotlights" style="display: none; height: 100vh;">
|
||||
<div class="inner">
|
||||
<h1>Firmware Notes</h1>
|
||||
|
||||
<div class="features major" >
|
||||
<h2><div id="detailsHeading" style="padding-left: 0.55em;" ></div></h2>
|
||||
<div id="detailsText" style="padding-left: 0.9em; padding-right: 0.9em; overflow-y: auto; height: 50vh;"></div>
|
||||
</div>
|
||||
<ul class="actions">
|
||||
<li><input type='button' id="btnDetails" value="Change Version" onclick="window.location.href='#loader';" /></li>
|
||||
<li><input type='button' id="btnChoosePort" value="Install" onclick="window.location.href='#port';" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Base Tune download -->
|
||||
<section id="basetunes" class="wrapper style4 fullscreen fade-up" style="height: 100vh;">
|
||||
<section id="basetunes" class="wrapper style4" style="height: 100vh;">
|
||||
<div class="inner">
|
||||
<h2 style="margin: 0;">Base Tunes</h1>
|
||||
<h2 style="margin: 0;">Base Tunes</h2>
|
||||
<p style="font-size: 12px;">
|
||||
Tune Author: <select id="basetunesAuthor" class="select1" onChange="refreshBasetunesFilters()" ></select>
|
||||
Make: <select id="basetunesMake" class="select1" onChange="refreshBasetunesFilters()" ></select>
|
||||
|
@ -155,35 +147,62 @@
|
|||
<p>
|
||||
Available Tunes
|
||||
<span class="icon fa-spinner" style="position: absolute; left: 48%; top: 42%;" id="baseTuneSpinner"></span>
|
||||
<select name="basetunes" class="select5" id="basetunesSelect" size="10" width="20" onChange="refreshBasetunesDescription()"></select>
|
||||
<select name="basetunes" id="basetunesSelect" size="10" width="20" onChange="refreshBasetunesDescription()"></select>
|
||||
<div class="features major" >
|
||||
<div id="tuneDetailsText" style="padding-left: 0.9em; padding-right: 0.9em; padding-top: 0.1em; overflow-y: auto; height: 17vh; font-size: 14px;"></div>
|
||||
</div>
|
||||
<ul class="actions">
|
||||
<li><input type='button' id="btnDownloadBasetune" value="Download tune" onclick="showBasetuneWarning();" /></li>
|
||||
<li><input type='button' value="Exit" id="btnExit" onclick="quit();" /></li>
|
||||
<li><input type='button' id="btnDownloadBasetune" value="Download tune" /></li>
|
||||
<li><input type='button' value="Exit" id="btnExit" /></li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<!-- Base tune warning -->
|
||||
<section id="basetunewarning" class="wrapper style5" style="height: 100vh;">
|
||||
<div class="inner">
|
||||
|
||||
<h1 style="text-align: center; width: 100%;">WARNING</h1>
|
||||
<div class="features major">
|
||||
|
||||
<p style="text-align: center; width: 100%;">Base tunes are intended as a starting point ONLY. They will require changes in order to work correctly with your engine!</p>
|
||||
<center><span class="icon fa-exclamation major" id="warningIcon"></span></center>
|
||||
<p style="text-align: center; width: 100%;">Take note of the board that has been used in this tune. If you are not using this board you need to change this setting immediately:</p>
|
||||
<p style="text-align: center; width: 100%;">
|
||||
<span class="icon fa-arrow-right" id="emphasisIcon"></span>
|
||||
<span style="font-weight: bold;" id="tuneBoard"></span>
|
||||
<span class="icon fa-arrow-left" id="emphasisIcon"></span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<ul class="actions modal">
|
||||
<li><input type='button' id="btnDownloadConfirm" value="Download" onclick="downloadBasetune();" /></li>
|
||||
<li><input type='button' id="btnDownloadCancel" value="Cancel" /></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!-- Footer -->
|
||||
<footer id="footer" class="wrapper style1-alt">
|
||||
<div class="inner">
|
||||
<ul class="menu">
|
||||
<li>© Josh Stewart. All rights reserved.</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li><li>Version: 0.0.3</li>
|
||||
<li>© Josh Stewart. All rights reserved.</li><li>Design: <a href="http://html5up.net" target="_blank">HTML5 UP</a></li><li>Version: 0.0.3</li>
|
||||
</ul>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script>window.$ = window.jQuery = require('./assets/js/jquery.min.js');</script>
|
||||
<script>window.$ = window.jQuery = require('jquery');</script>
|
||||
<script src="assets/js/jquery.scrollex.min.js"></script>
|
||||
<script src="assets/js/jquery.scrolly.min.js"></script>
|
||||
<script src="assets/js/skel.min.js"></script>
|
||||
<script src="assets/js/breakpoints.min.js"></script>
|
||||
<script src="assets/js/util.js"></script>
|
||||
<script src="assets/js/main.js"></script>
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
37
main.js
37
main.js
|
@ -1,6 +1,5 @@
|
|||
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||
const { app, BrowserWindow, ipcMain, shell } = require('electron')
|
||||
const {download} = require('electron-dl')
|
||||
const {spawn} = require('child_process');
|
||||
const {execFile} = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
@ -23,10 +22,18 @@ function createWindow ()
|
|||
backgroundColor: '#312450',
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
enableRemoteModule: true,
|
||||
contextIsolation: false,
|
||||
},
|
||||
});
|
||||
|
||||
// Open links in external browser
|
||||
win.webContents.setWindowOpenHandler(({ url }) => {
|
||||
if (url.startsWith('https:')) {
|
||||
shell.openExternal(url);
|
||||
}
|
||||
return { action: 'deny' };
|
||||
});
|
||||
|
||||
// auto hide menu bar (Win, Linux)
|
||||
win.setMenuBarVisibility(false);
|
||||
win.setAutoHideMenuBar(true);
|
||||
|
@ -50,11 +57,6 @@ function createWindow ()
|
|||
win = null
|
||||
})
|
||||
|
||||
//This forces any links that have a target of _blank to open in a browser rather than Electron window
|
||||
win.webContents.on('new-window', function(e, url) {
|
||||
e.preventDefault();
|
||||
require('electron').shell.openExternal(url);
|
||||
});
|
||||
}
|
||||
|
||||
//Required for newer versions of Electron to work with serialport
|
||||
|
@ -87,7 +89,8 @@ app.on('activate', () => {
|
|||
ipcMain.on('download', (e, args) => {
|
||||
filename = args.url.substring(args.url.lastIndexOf('/')+1);
|
||||
dlDir = app.getPath('downloads');
|
||||
fullFile = dlDir + "/" + filename;
|
||||
const path = require('node:path');
|
||||
fullFile = path.join(dlDir, filename);
|
||||
|
||||
//Special case for handling the build that is from master. This is ALWAYS downloaded as there's no way of telling when it was last updated.
|
||||
if(filename.includes("master"))
|
||||
|
@ -171,7 +174,6 @@ ipcMain.on('uploadFW', (e, args) => {
|
|||
var execArgs = ['-v', '-patmega2560', '-C', configName, '-cwiring', '-b 115200', '-P', args.port, '-D', '-U', hexFile];
|
||||
|
||||
console.log(executableName);
|
||||
//const child = spawn(executableName, execArgs);
|
||||
const child = execFile(executableName, execArgs);
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
|
@ -305,3 +307,18 @@ ipcMain.on('uploadFW', (e, args) => {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
ipcMain.handle('getAppVersion', async (e) => {
|
||||
return app.getVersion();
|
||||
});
|
||||
|
||||
ipcMain.handle('quit-app', () => {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
ipcMain.handle('show-ini', (event, location) => {
|
||||
if (location.endsWith('.ini'))
|
||||
{
|
||||
shell.showItemInFolder(location); // This function needs to be executed in main.js to bring file explorer to foreground
|
||||
}
|
||||
});
|
File diff suppressed because it is too large
Load Diff
21
package.json
21
package.json
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "SpeedyLoader",
|
||||
"name": "speedyloader",
|
||||
"version": "1.5.2",
|
||||
"description": "Speeduino universal firmware loader",
|
||||
"main": "main.js",
|
||||
|
@ -24,18 +24,17 @@
|
|||
},
|
||||
"homepage": "https://github.com/speeduino/SpeedyLoader",
|
||||
"devDependencies": {
|
||||
"electron": "^11.2.0",
|
||||
"electron-packager": "^15.2.0",
|
||||
"electron-rebuild": "^2.3.4"
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
"electron": "^22.0.1",
|
||||
"electron-packager": "^17.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"electron-dl": "^3.2.1",
|
||||
"json5": "^2.2.0",
|
||||
"marked": "^0.7.0",
|
||||
"request": "^2.88.0",
|
||||
"semver": "^6.1.3",
|
||||
"serialport": "^9.0.4",
|
||||
"usb": "^1.6.5"
|
||||
"@serialport/bindings-cpp": "^10.8.0",
|
||||
"electron-dl": "^3.5.0",
|
||||
"jquery": "^3.6.3",
|
||||
"marked": "^4.2.5",
|
||||
"semver": "^7.3.8",
|
||||
"usb": "^2.6.0"
|
||||
},
|
||||
"build": {
|
||||
"appId": "SpeedyLoader",
|
||||
|
|
337
renderer.js
337
renderer.js
|
@ -1,8 +1,6 @@
|
|||
const serialport = require('serialport')
|
||||
const serialport = require('@serialport/bindings-cpp')
|
||||
const usb = require('usb')
|
||||
const JSON5 = require('json5')
|
||||
const {ipcRenderer} = require("electron")
|
||||
const {remote} = require('electron')
|
||||
const { shell } = require('electron')
|
||||
|
||||
var basetuneList = [];
|
||||
|
@ -39,17 +37,17 @@ function getTeensyVersion(id)
|
|||
|
||||
function refreshSerialPorts()
|
||||
{
|
||||
serialport.list().then(ports => {
|
||||
serialport.autoDetect().list().then(ports => {
|
||||
console.log('Serial ports found: ', ports);
|
||||
|
||||
if (ports.length === 0) {
|
||||
document.getElementById('serialDetectError').textContent = 'No ports discovered'
|
||||
}
|
||||
|
||||
select = document.getElementById('portsSelect');
|
||||
const select = document.getElementById('portsSelect');
|
||||
|
||||
//Clear the current options
|
||||
for (i = 0; i <= select.options.length; i++)
|
||||
while (select.options.length)
|
||||
{
|
||||
select.remove(0); //Always 0 index (As each time an item is removed, everything shuffles up 1 place)
|
||||
}
|
||||
|
@ -127,35 +125,28 @@ function refreshDetails()
|
|||
var version = selectElement.options[selectElement.selectedIndex].value;
|
||||
var url = "https://api.github.com/repos/noisymime/speeduino/releases/tags/" + version;
|
||||
|
||||
document.getElementById('detailsText').innerHTML = "";
|
||||
document.getElementById('detailsHeading').innerHTML = version;
|
||||
|
||||
var request = require('request');
|
||||
const options = {
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': 'request'
|
||||
fetch(url)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
};
|
||||
return Promise.reject(response);
|
||||
})
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
|
||||
request.get(options, function (error, response, body) {
|
||||
if (!error ) {
|
||||
|
||||
console.log(body);
|
||||
var result = JSON.parse(body);
|
||||
|
||||
// Continue with your processing here.
|
||||
textField = document.getElementById('detailsText');
|
||||
|
||||
//Need to convert the Markdown that comes from Github to HTML
|
||||
var myMarked = require('marked');
|
||||
textField.innerHTML = myMarked(result.body);
|
||||
}
|
||||
//Need to convert the Markdown that comes from Github to HTML
|
||||
var myMarked = require('marked');
|
||||
document.getElementById('detailsText').innerHTML = myMarked.parse(result.body);
|
||||
document.getElementById('detailsHeading').innerHTML = version + " - " + result.name;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Could not download details.', error);
|
||||
});
|
||||
|
||||
//Finally, make the details section visible
|
||||
document.getElementById('details').style.display = "inline";
|
||||
//And jump to it
|
||||
window.location.href = "#details";
|
||||
}
|
||||
|
||||
function refreshAvailableFirmwares()
|
||||
|
@ -168,61 +159,61 @@ function refreshAvailableFirmwares()
|
|||
ChoosePortButton.disabled = true;
|
||||
basetuneButton.disabled = true;
|
||||
|
||||
var request = require('request');
|
||||
request.get('https://speeduino.com/fw/versions', {timeout: 20000}, function (error, response, body)
|
||||
{
|
||||
select = document.getElementById('versionsSelect');
|
||||
if (!error && response.statusCode == 200) {
|
||||
const select = document.getElementById('versionsSelect');
|
||||
|
||||
var lines = body.split('\n');
|
||||
// Continue with your processing here.
|
||||
|
||||
for(var i = 0;i < lines.length;i++)
|
||||
{
|
||||
var newOption = document.createElement('option');
|
||||
newOption.value = lines[i];
|
||||
newOption.innerHTML = lines[i];
|
||||
select.appendChild(newOption);
|
||||
}
|
||||
select.selectedIndex = 0;
|
||||
|
||||
//Remove the loading spinner
|
||||
loadingSpinner = document.getElementById("fwVersionsSpinner");
|
||||
loadingSpinner.style.display = "none";
|
||||
|
||||
refreshBasetunes();
|
||||
|
||||
//Re-enable the buttons
|
||||
DetailsButton.disabled = false;
|
||||
ChoosePortButton.disabled = false;
|
||||
basetuneButton.disabled = false;
|
||||
fetch('https://speeduino.com/fw/versions', { signal: AbortSignal.timeout(5000) } )
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.text();
|
||||
}
|
||||
else if(error)
|
||||
return Promise.reject(response);
|
||||
})
|
||||
.then((result) => {
|
||||
var lines = result.split('\n');
|
||||
// Continue with your processing here.
|
||||
|
||||
for(var i = 0;i < lines.length;i++)
|
||||
{
|
||||
console.log("Error retrieving available firmwares: " + error);
|
||||
var newOption = document.createElement('option');
|
||||
if(error.code === 'ETIMEDOUT')
|
||||
{
|
||||
newOption.value = "Connection timed out";
|
||||
newOption.innerHTML = "Connection timed out";
|
||||
}
|
||||
else
|
||||
{
|
||||
newOption.value = "Cannot retrieve firmware list";
|
||||
newOption.innerHTML = "Cannot retrieve firmware list. Check internet connection and restart";
|
||||
}
|
||||
newOption.value = lines[i];
|
||||
newOption.innerHTML = lines[i];
|
||||
select.appendChild(newOption);
|
||||
|
||||
//Remove the loading spinner
|
||||
loadingSpinner = document.getElementById("fwVersionsSpinner");
|
||||
loadingSpinner.style.display = "none";
|
||||
}
|
||||
else if(response.statusCode == 404)
|
||||
select.selectedIndex = 0;
|
||||
|
||||
//Remove the loading spinner
|
||||
loadingSpinner = document.getElementById("fwVersionsSpinner");
|
||||
loadingSpinner.style.display = "none";
|
||||
|
||||
refreshBasetunes();
|
||||
|
||||
//Re-enable the buttons
|
||||
DetailsButton.disabled = false;
|
||||
ChoosePortButton.disabled = false;
|
||||
basetuneButton.disabled = false;
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("Error retrieving available firmwares. ", error);
|
||||
|
||||
var newOption = document.createElement('option');
|
||||
if(error.code === 'ETIMEDOUT')
|
||||
{
|
||||
|
||||
newOption.value = "Connection timed out";
|
||||
newOption.innerHTML = "Connection timed out";
|
||||
}
|
||||
}
|
||||
);
|
||||
else
|
||||
{
|
||||
newOption.value = "Cannot retrieve firmware list";
|
||||
newOption.innerHTML = "Cannot retrieve firmware list. Check internet connection and restart";
|
||||
}
|
||||
select.appendChild(newOption);
|
||||
|
||||
//Remove the loading spinner
|
||||
loadingSpinner = document.getElementById("fwVersionsSpinner");
|
||||
loadingSpinner.style.display = "none";
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function refreshBasetunes()
|
||||
|
@ -235,26 +226,27 @@ function refreshBasetunes()
|
|||
//var url = "https://speeduino.com/fw/basetunes.json";
|
||||
var url = "https://github.com/speeduino/Tunes/raw/main/index.json";
|
||||
|
||||
var request = require('request');
|
||||
const options = {
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': 'request'
|
||||
fetch(url)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
};
|
||||
return Promise.reject(response);
|
||||
})
|
||||
.then((result) => {
|
||||
|
||||
request.get(options, function (error, response, body) {
|
||||
if (!error )
|
||||
{
|
||||
basetuneList = JSON5.parse(body);
|
||||
basetuneList = result;
|
||||
|
||||
//Remove the loading spinner
|
||||
loadingSpinner = document.getElementById("baseTuneSpinner");
|
||||
loadingSpinner.style.display = "none";
|
||||
//Remove the loading spinner
|
||||
loadingSpinner = document.getElementById("baseTuneSpinner");
|
||||
loadingSpinner.style.display = "none";
|
||||
|
||||
refreshBasetunes();
|
||||
}
|
||||
refreshBasetunes();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Could not download base tune list.', error);
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -325,7 +317,7 @@ function refreshBasetunes()
|
|||
function refreshBasetunesFilters()
|
||||
{
|
||||
//Get the display list object
|
||||
var select = document.getElementById('basetunesSelect');
|
||||
const select = document.getElementById('basetunesSelect');
|
||||
|
||||
//Get the currently selected Author
|
||||
selectElement = document.getElementById('basetunesAuthor');
|
||||
|
@ -361,7 +353,6 @@ function refreshBasetunesFilters()
|
|||
//console.log("Tune url: " + url);
|
||||
//console.log("Found a valid tune: " + basetuneList[tune].displayName);
|
||||
var newOption = document.createElement('option');
|
||||
newOption.style.background = "#022b3a";
|
||||
newOption.dataset.filename = basetuneList[tune].filename;
|
||||
newOption.dataset.make = basetuneList[tune].make;
|
||||
newOption.dataset.description = basetuneList[tune].description;
|
||||
|
@ -439,38 +430,6 @@ function downloadIni()
|
|||
|
||||
}
|
||||
|
||||
function showBasetuneWarning()
|
||||
{
|
||||
let mainWindow = remote.BrowserWindow.getFocusedWindow();
|
||||
warningWindow = new remote.BrowserWindow({ width: 550, height: 380, modal: true, parent: mainWindow, show: false })
|
||||
|
||||
var select = document.getElementById('basetunesSelect');
|
||||
selectedTune = select.options[select.selectedIndex];
|
||||
|
||||
// auto hide menu bar (Win, Linux)
|
||||
warningWindow.setMenuBarVisibility(false);
|
||||
warningWindow.setAutoHideMenuBar(true);
|
||||
|
||||
// remove completely when app is packaged (Win, Linux)
|
||||
if (remote.app.isPackaged) {
|
||||
warningWindow.removeMenu();
|
||||
}
|
||||
|
||||
board = selectedTune.dataset.board
|
||||
warningWindow.loadURL(`file://${__dirname}/warning.html?board=` + board);
|
||||
|
||||
warningWindow.once('ready-to-show', () => {
|
||||
warningWindow.show();
|
||||
})
|
||||
|
||||
warningWindow.on('close', () => {
|
||||
warningWindow = null;
|
||||
downloadBasetune();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function downloadBasetune()
|
||||
{
|
||||
console.log("downloading");
|
||||
|
@ -487,6 +446,9 @@ function downloadBasetune()
|
|||
url: DLurl,
|
||||
properties: {directory: "downloads"}
|
||||
});
|
||||
|
||||
const baseTuneLink = document.querySelectorAll('a[href="#basetunes"]');
|
||||
baseTuneLink[0].click();
|
||||
}
|
||||
|
||||
//Installing the Windows drivers
|
||||
|
@ -499,8 +461,6 @@ function installDrivers()
|
|||
|
||||
function uploadFW()
|
||||
{
|
||||
//Jump to the progress section
|
||||
window.location.href = "#progress";
|
||||
|
||||
//Start the spinner
|
||||
var spinner = document.getElementById('progressSpinner');
|
||||
|
@ -549,7 +509,7 @@ function uploadFW()
|
|||
console.log("Using port: " + uploadPort);
|
||||
|
||||
//Show the sponsor banner
|
||||
document.getElementById('sponsor').style.height = "7em"
|
||||
document.getElementById('sponsorbox').style.display = "block"
|
||||
|
||||
//Begin the upload
|
||||
if(uploadBoard.includes("TEENSY"))
|
||||
|
@ -593,7 +553,7 @@ function uploadFW()
|
|||
statusText.innerHTML = "Upload to Speeduino failed";
|
||||
|
||||
//Hide the donation bar as it makes the terminal go offscreen
|
||||
document.getElementById('sponsor').style.height = 0;
|
||||
document.getElementById('sponsorbox').style.display = "none"
|
||||
|
||||
//Mke the terminal/error section visible
|
||||
document.getElementById('terminalSection').style.display = "block";
|
||||
|
@ -609,59 +569,43 @@ function uploadFW()
|
|||
|
||||
}
|
||||
|
||||
//Opens a native file manager window at the location of the downloaded ini file
|
||||
function openFileMgr()
|
||||
async function checkForUpdates()
|
||||
{
|
||||
var location = document.getElementById('iniFileLocation').innerHTML
|
||||
if (location != "")
|
||||
{
|
||||
shell.showItemInFolder(location);
|
||||
}
|
||||
}
|
||||
//Adds the current version number to the Titlebar
|
||||
let current_version = await ipcRenderer.invoke("getAppVersion");
|
||||
document.getElementById('title').innerHTML = "Speeduino Universal Firmware Loader (v" + current_version + ")"
|
||||
|
||||
function quit()
|
||||
{
|
||||
let w = remote.getCurrentWindow();
|
||||
w.close();
|
||||
}
|
||||
|
||||
function checkForUpdates()
|
||||
{
|
||||
var url = "https://api.github.com/repos/speeduino/SpeedyLoader/releases/latest";
|
||||
|
||||
//document.getElementById('detailsHeading').innerHTML = version;
|
||||
|
||||
var request = require('request');
|
||||
const options = {
|
||||
url: url,
|
||||
headers: {
|
||||
'User-Agent': 'request'
|
||||
}
|
||||
};
|
||||
|
||||
request.get(options, function (error, response, body) {
|
||||
if (!error )
|
||||
fetch(url)
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
return Promise.reject(response);
|
||||
})
|
||||
.then((result) => {
|
||||
|
||||
latest_version = result.tag_name.substring(1);
|
||||
console.log("Latest version: " + latest_version);
|
||||
|
||||
var semver = require('semver');
|
||||
if(semver.gt(latest_version, current_version))
|
||||
{
|
||||
var result = JSON.parse(body);
|
||||
latest_version = result.tag_name.substring(1);
|
||||
console.log("Latest version: " + latest_version);
|
||||
|
||||
var semver = require('semver');
|
||||
if(semver.gt(latest_version, remote.app.getVersion()))
|
||||
{
|
||||
//New version has been found
|
||||
document.getElementById('update_url').setAttribute("href", result.html_url);
|
||||
document.getElementById('update_text').style.display = "block";
|
||||
}
|
||||
//New version has been found
|
||||
document.getElementById('update_url').setAttribute("href", result.html_url);
|
||||
document.getElementById('update_text').style.display = "block";
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Could not get latest version.', error);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
//Adds the current version number to the Titlebar
|
||||
document.getElementById('title').innerHTML = "Speeduino Universal Firmware Loader (v" + remote.app.getVersion() + ")"
|
||||
|
||||
refreshAvailableFirmwares();
|
||||
refreshBasetunes();
|
||||
refreshSerialPorts();
|
||||
|
@ -669,3 +613,58 @@ window.onload = function () {
|
|||
|
||||
};
|
||||
|
||||
$(function(){
|
||||
|
||||
// Button handlers
|
||||
$(document).on('click', '#btnChoosePort', function(event) {
|
||||
$("[href='#port']").trigger('click');
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnBasetune', function(event) {
|
||||
$("[href='#basetunes']").trigger('click');
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnLoader', function(event) {
|
||||
$("[href='#loader']").trigger('click');
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnDetails', function(event) {
|
||||
refreshDetails();
|
||||
$("[href='#details']").trigger('click');
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnInstall', function(event) {
|
||||
$("[href='#progress']").trigger('click');
|
||||
uploadFW();
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnReinstall', function(event) {
|
||||
$("[href='#progress']").trigger('click');
|
||||
uploadFW();
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnDownloadBasetune', function(event) {
|
||||
const select = document.getElementById('basetunesSelect');
|
||||
const selectedTune = select.options[select.selectedIndex];
|
||||
document.getElementById("tuneBoard").innerHTML = selectedTune.dataset.board;
|
||||
|
||||
$("[href='#basetunewarning']").trigger('click');
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnDownloadCancel', function(event) {
|
||||
$("[href='#basetunes']").trigger('click');
|
||||
});
|
||||
|
||||
$(document).on('click', '#btnExit', function(event) {
|
||||
ipcRenderer.invoke('quit-app');
|
||||
});
|
||||
|
||||
$(document).on('click', '#iniFileLink', function(event) {
|
||||
var location = document.getElementById('iniFileLocation').innerHTML
|
||||
if (location != "")
|
||||
{
|
||||
ipcRenderer.invoke('show-ini', location);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
35
warning.html
35
warning.html
|
@ -1,35 +0,0 @@
|
|||
<html>
|
||||
<link rel="stylesheet" href="assets/css/main.css" />
|
||||
<script>
|
||||
function updateBoard()
|
||||
{
|
||||
board = (location.search.split('board=')[1]||'').split('&')[0]
|
||||
document.getElementById("tuneBoard").innerHTML = decodeURI(board);
|
||||
}
|
||||
</script>
|
||||
<body onload="updateBoard()">
|
||||
|
||||
<!-- Choose Version -->
|
||||
<section id="loader" class="wrapper style5 fullscreen fade-up" style="padding: 0; margin: 0;">
|
||||
|
||||
<!--<h1>Firmware Loader</h1>-->
|
||||
<div class="inner" style="padding: 0; margin: 0;">
|
||||
<p><h1 class="modal" style="margin: 0;">WARNING</h1></p>
|
||||
</div>
|
||||
<div class="features major modal" style="margin-left: 15px; margin-right: 15px; padding-top: 1; padding-bottom: 1; margin-bottom: 8px;">
|
||||
|
||||
<div style="padding-left: .9em; padding-right: 0.9em; overflow-y: auto; ">
|
||||
<p style="margin-bottom: 5;">Base tunes are intended as a starting point ONLY. They will require changes in order to work correctly with your engine</p>
|
||||
<center><span class="icon fa-exclamation major" style="margin: 0; justify-content: center;" id="warningIcon"></span></center>
|
||||
<p >Take note of the board that has been used in this tune. If you are not using this board you will to change this setting immediately: <br /><span class="icon fa-arrow-right" style="margin: 0; justify-content: center;" id="emphasisIcon"></span> <span style="font-weight: bold;" id="tuneBoard"></span> <span class="icon fa-arrow-left" style="margin: 0; justify-content: center;" id="emphasisIcon"></span></p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<ul class="actions modal">
|
||||
<li><input type='button' id="btnDownloadConfirm" value="Download" onclick="window.close();" /></li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue