@@ -253,31 +253,10 @@ class DFUDevice {
253253
254254 // Set address to flash start
255255 await this . setAddress ( this . startAddress ) ;
256- progressCallback ( { stage : 'erase' , percent : 5 , message : 'Erasing flash...' } ) ;
257-
258- // Mass erase (0x41 at address 0x08000000)
259- await this . erase ( this . startAddress ) ;
260- progressCallback ( { stage : 'erase' , percent : 10 , message : 'Flash erased' } ) ;
261-
262- // Wait a moment for the device to stabilize after mass erase
263- await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
264-
265- // Check status to ensure we are still connected and ready
266- try {
267- const status = await this . getStatus ( ) ;
268- if ( status . state === DFU_STATE . DFU_ERROR ) {
269- await this . clearStatus ( ) ;
270- }
271- } catch ( e ) {
272- console . warn ( 'Status check failed between erase and write:' , e ) ;
273- }
274-
275- progressCallback ( { stage : 'write' , percent : 10 , message : 'Preparing to write...' } ) ;
276-
277- // Set address again for writing
278- await this . setAddress ( this . startAddress ) ;
256+
257+ progressCallback ( { stage : 'write' , percent : 5 , message : 'Writing firmware...' } ) ;
279258
280- // Download firmware in chunks
259+ // Download firmware in chunks (implicit erase by bootloader)
281260 const totalBlocks = Math . ceil ( firmwareData . byteLength / this . transferSize ) ;
282261 let blockNum = 2 ; // Start at block 2 (0 and 1 used for commands)
283262
0 commit comments