Skip to content

Commit

Permalink
Made firmware upload procedure more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcio T committed Mar 18, 2022
1 parent 1757418 commit 5eeecca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion run-localhost.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cd src-app
python3.9 -m http.server 8000
python3.8 -m http.server 8000
19 changes: 10 additions & 9 deletions src-app/js/SettingsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1719,19 +1719,20 @@ class UpdateFirmwarePage {
}
// An upgrade set includes the various print scripts as well as the firmware files.
let files = [];
const scripts = ProfileManager.getSection("scripts");
if(scripts) {
files.push(SynDaverWiFi.fileFromStr("scripts/pause.gco", scripts.pause_print_gcode || ""));
files.push(SynDaverWiFi.fileFromStr("scripts/cancel.gco", scripts.stop_print_gcode || ""));
files.push(SynDaverWiFi.fileFromStr("scripts/resume.gco", scripts.resume_print_gcode || ""));
files.push(SynDaverWiFi.fileFromStr("scripts/badprobe.gco", scripts.probe_fail_gcode || ""));
}
if(wireless.uploads) {
const scripts = ProfileManager.getSection("scripts");
for(const pair of wireless.uploads) {
files.push(await SynDaverWiFi.fileFromUrl(pair[0], pair[1]));
let uploadDst = pair[0];
let uploadSrc = pair[1];
if(uploadSrc.startsWith("scripts:")) {
uploadSrc = uploadSrc.replace(/^scripts:\s*/);
files.push(SynDaverWiFi.fileFromStr(uploadDst, scripts[uploadSrc] || ""));
} else {
files.push(await SynDaverWiFi.fileFromUrl(uploadDst, uploadSrc));
}
}
}
if(wireless.length == 0) {
if(files.length == 0) {
alert("Nothing to upload. The wireless configuration in the profile may be incomplete.");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src-app/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ importScripts('lib/util/misc/Wikify.js');
// Based on https://deanhume.com/displaying-a-new-version-available-progressive-web-app/

const info = {
cacheVersion: 203
cacheVersion: 204
};

const cacheName = 'v' + info.cacheVersion;
Expand Down

0 comments on commit 5eeecca

Please sign in to comment.