Przeglądaj źródła

Merge pull request #32 from thingsSDK/error-on-open

Error on open
Andrew Chalkley 9 lat temu
rodzic
commit
dbc878fdcb
2 zmienionych plików z 9 dodań i 2 usunięć
  1. 1 1
      back-end/rom_comm.js
  2. 8 1
      front-end/js/app.js

+ 1 - 1
back-end/rom_comm.js

@@ -83,7 +83,7 @@ class RomComm extends EventEmitter {
     }
 
     bindPort() {
-        this._port.on('error', error => log.error("PORT ERROR", error));
+        this._port.on('error', (error) => log.error("PORT ERROR", error));
         this.in = new slip.SlipDecoder();
         this.out = new slip.SlipEncoder();
         this._port.pipe(this.in);

+ 8 - 1
front-end/js/app.js

@@ -94,6 +94,7 @@ serialScanner.on("deviceAdded", (port) => {
 });
 
 serialScanner.on("deviceRemoved", (port) => {
+    portsSelect.remove(port);
     new Notification(`Removed: ${port}!`);
 });
 
@@ -202,16 +203,22 @@ function flashWithManifest(manifest) {
                     log.info("Flashed to latest Espruino build!", result);
                 });
         }).catch((error) => {
+            esp.close();
             new Notification("An error occured during flashing.");
             isFlashing = false;
             log.error("Oh noes!", error);
+            restoreUI();
         });
-    }).on("entry", (progress) => {
+    })
+    .on("error", onError)
+    .on("entry", (progress) => {
         //For the download/extract progress. The other half is flashing.
         const extractPercent = Math.round((correctStepNumber++/numberOfSteps) * 50);
         updateProgressBar(extractPercent, svg);
         appStatus.textContent = progress.display;
     });
+    
+    
 }
 
 function cloneSVGNode(node) {