craigsdennis 9 lat temu
rodzic
commit
3b47eabb16
1 zmienionych plików z 14 dodań i 0 usunięć
  1. 14 0
      back-end/rom_comm.js

+ 14 - 0
back-end/rom_comm.js

@@ -240,6 +240,8 @@ class RomComm {
         if (command === commands.FLASH_DOWNLOAD_DATA) {
         if (command === commands.FLASH_DOWNLOAD_DATA) {
             // There are additional headers here....
             // There are additional headers here....
             checksum = this.calculateChecksum(data.slice(16));
             checksum = this.calculateChecksum(data.slice(16));
+        } else if (command === commands.FLASH_DOWNLOAD_DONE) {
+            // Nothing to see here
         } else {
         } else {
             checksum = this.calculateChecksum(data);
             checksum = this.calculateChecksum(data);
         }
         }
@@ -362,6 +364,18 @@ class RomComm {
         });
         });
     }
     }
 
 
+    flashFinish(reboot) {
+        let buffer = new ArrayBuffer(4);
+        let dv = new DataView(buffer);
+        // ???:csd - That flip is correct...probably a better word
+        dv.setUint32(0, reboot ? 0 : 1, true);
+        return this.sendCommand(commands.FLASH_DOWNLOAD_DONE, new Buffer(buffer))
+            .then((result) => {
+                log.info("Received result", result);
+                this.isInBootLoader = false;
+            });
+    }
+
 
 
     // https://github.com/themadinventor/esptool/blob/master/esptool.py#L108
     // https://github.com/themadinventor/esptool/blob/master/esptool.py#L108
     // https://github.com/igrr/esptool-ck/blob/master/espcomm/espcomm.c#L103
     // https://github.com/igrr/esptool-ck/blob/master/espcomm/espcomm.c#L103