File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import Latin1 from 'crypto-js/enc-latin1';
22import HashMD5 from 'crypto-js/md5' ;
33import {
44 ESPLoader ,
5- type FlashOptions ,
65 type IEspLoaderTerminal ,
76 type LoaderOptions ,
87 Transport ,
@@ -306,22 +305,23 @@ export default class FlashManager {
306305 onProgress ( written / total ) ;
307306 }
308307
309- const flashOptions = {
310- fileArray : [
311- {
308+ try {
309+ await this . loader . writeFlash ( {
310+ fileArray : [ {
312311 data : arrayBufferToString ( data ) ,
313312 address : 0 ,
313+ } ] ,
314+ flashSize : 'keep' ,
315+ flashMode : 'keep' ,
316+ flashFreq : 'keep' ,
317+ eraseAll,
318+ compress : true ,
319+ reportProgress,
320+ calculateMD5Hash : ( image ) => {
321+ this . terminal . writeLine ( 'Validating image...' ) ;
322+ return HashMD5 ( Latin1 . parse ( image ) ) . toString ( ) ;
314323 } ,
315- ] ,
316- flashSize : 'keep' ,
317- eraseAll,
318- compress : true ,
319- reportProgress,
320- calculateMD5Hash : ( image ) => HashMD5 ( Latin1 . parse ( image ) ) . toString ( ) ,
321- } as FlashOptions ;
322-
323- try {
324- await this . loader . writeFlash ( flashOptions ) ;
324+ } ) ;
325325 this . terminal . writeLine ( 'Flash complete' ) ;
326326 return true ;
327327 } catch ( e ) {
You can’t perform that action at this time.
0 commit comments