|
@@ -103,7 +103,6 @@ serialScanner.on("error", onError);
|
|
* Updates UI to say it's ready
|
|
* Updates UI to say it's ready
|
|
*/
|
|
*/
|
|
function readyToFlash() {
|
|
function readyToFlash() {
|
|
- form.style.opacity = 1;
|
|
|
|
appStatus.textContent = "Ready";
|
|
appStatus.textContent = "Ready";
|
|
enableInputs();
|
|
enableInputs();
|
|
}
|
|
}
|
|
@@ -188,6 +187,7 @@ function flashWithManifest(manifest) {
|
|
.then((result) => {
|
|
.then((result) => {
|
|
new Notification("Flash Finished!");
|
|
new Notification("Flash Finished!");
|
|
readyToFlash();
|
|
readyToFlash();
|
|
|
|
+ restoreUI();
|
|
log.info("Flashed to latest Espruino build!", result);
|
|
log.info("Flashed to latest Espruino build!", result);
|
|
});
|
|
});
|
|
}).catch((error) => {
|
|
}).catch((error) => {
|
|
@@ -256,33 +256,29 @@ function updateProgressBar(percent, svg){
|
|
}
|
|
}
|
|
|
|
|
|
function prepareUIForFlashing(callback) {
|
|
function prepareUIForFlashing(callback) {
|
|
- let marginLeft = 0;
|
|
|
|
- let incrementor = 0.01;
|
|
|
|
let percent = 100;
|
|
let percent = 100;
|
|
-
|
|
|
|
- let centerLeft = (appWrapper.clientWidth - logoWrapper.clientWidth) / 2;
|
|
|
|
|
|
+ appWrapper.classList.remove("finished");
|
|
|
|
+ appWrapper.classList.add("flashing");
|
|
|
|
|
|
- let interval = setInterval(() => {
|
|
|
|
- incrementor += 0.015;
|
|
|
|
- marginLeft += 1.5 / incrementor;
|
|
|
|
- if(marginLeft <= centerLeft) {
|
|
|
|
- logoWrapper.style.marginLeft = marginLeft + "px";
|
|
|
|
- } else {
|
|
|
|
- clearInterval(interval);
|
|
|
|
- }
|
|
|
|
- }, 10);
|
|
|
|
-
|
|
|
|
let percentInterval = setInterval(() => {
|
|
let percentInterval = setInterval(() => {
|
|
percent -= 1;
|
|
percent -= 1;
|
|
- form.style.opacity = percent / 100;
|
|
|
|
updateProgressBar(percent, svg);
|
|
updateProgressBar(percent, svg);
|
|
if(percent === 0) {
|
|
if(percent === 0) {
|
|
clearInterval(percentInterval);
|
|
clearInterval(percentInterval);
|
|
- callback();
|
|
|
|
|
|
+ if(callback) callback();
|
|
}
|
|
}
|
|
}, 1);
|
|
}, 1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function restoreUI(callback) {
|
|
|
|
+ let percent = 0;
|
|
|
|
+ appWrapper.classList.remove("flashing");
|
|
|
|
+ appWrapper.classList.add("finished");
|
|
|
|
+
|
|
|
|
+ updateProgressBar(100, svg);
|
|
|
|
+ if(callback) callback();
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Get's manifest list for possibilities for flashing,
|
|
* Get's manifest list for possibilities for flashing,
|
|
* scans serial ports and sets up timer for checking for changes.
|
|
* scans serial ports and sets up timer for checking for changes.
|