Add buttons to download base tune

This commit is contained in:
Josh Stewart 2019-07-09 14:56:05 +10:00
parent ec11e3a7af
commit c88c816872
3 changed files with 26 additions and 4 deletions

View File

@ -62,8 +62,9 @@
<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="Select Different Version" onclick="window.location.href='#loader';" /></li>
<li><input type='button' id="btnChoosePort" value="Choose Port" onclick="window.location.href='#port';" /></li>
<li><input type='button' value="Download Base Tune" id="btnBasetune" onclick="downloadTune();" /></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>
</ul>
</div>
</section>
@ -104,7 +105,8 @@
</section>
</div>
<ul class="actions">
<li><input type='button' value="Burn again" id="btnReinstall" onclick="uploadFW();" /></li>
<li><input type='button' value="Burn again" id="btnReinstall" onclick="uploadFW();" /></li>
<li><input type='button' value="Download Base Tune" id="btnBasetune" onclick="downloadTune();" /></li>
<li><input type='button' value="Exit" id="btnExit" onclick="quit();" /></li>
</ul>
</div>

View File

@ -70,6 +70,11 @@ ipcMain.on('download', (e, args) => {
}
//console.log("Filename: " + fullFile );
options = {};
if(filename == "Speeduino%20base%20tune.msq")
{
options = { saveAs: true };
}
fs.exists(fullFile, (exists) => {
if (exists) {
@ -77,7 +82,7 @@ ipcMain.on('download', (e, args) => {
e.sender.send( "download complete", fullFile, "exists" );
}
else {
download(BrowserWindow.getFocusedWindow(), args.url)
download(BrowserWindow.getFocusedWindow(), args.url, options)
.then(dl => e.sender.send( "download complete", dl.getSavePath(), dl.getState() ) )
.catch(console.error);
}

View File

@ -166,6 +166,21 @@ function downloadIni()
}
function downloadTune()
{
var e = document.getElementById('versionsSelect');
var DLurl = "https://raw.githubusercontent.com/noisymime/speeduino/" + e.options[e.selectedIndex].value + "/reference/Base%20Tunes/Speeduino%20base%20tune.msq";
console.log("Downloading: " + DLurl);
//Download the ini file
ipcRenderer.send("download", {
url: DLurl,
properties: {directory: "downloads"}
});
}
function uploadFW()
{
//Jump to the progress section