@@ -783,19 +783,11 @@ firmware_flasher.initialize = async function (callback) {
783783
784784 console . log ( `${ self . logHead } Selected port:` , port ) ;
785785
786- // Common function to reset flashing state on errors
787- const resetFlashingState = ( ) => {
788- self . resetFlashingState ( ) ;
789- } ;
790-
791786 if ( isDFU ) {
792787 tracking . sendEvent ( tracking . EVENT_CATEGORIES . FLASHING , "DFU Flashing" , {
793788 filename : self . filename || null ,
794789 } ) ;
795- DFU . connect ( port , firmware , options ) . catch ( ( error ) => {
796- console . error ( `${ self . logHead } DFU connection failed:` , error ) ;
797- resetFlashingState ( ) ;
798- } ) ;
790+ DFU . connect ( port , firmware , options ) ;
799791 } else if ( isSerial ) {
800792 if ( $ ( "input.updating" ) . is ( ":checked" ) ) {
801793 options . no_reboot = true ;
@@ -817,15 +809,12 @@ firmware_flasher.initialize = async function (callback) {
817809
818810 DFU . requestPermission ( )
819811 . then ( ( device ) => {
820- DFU . connect ( device . path , firmware , options ) . catch ( ( error ) => {
821- console . error ( `${ self . logHead } DFU permission connection failed:` , error ) ;
822- resetFlashingState ( ) ;
823- } ) ;
812+ DFU . connect ( device . path , firmware , options ) ;
824813 } )
825814 . catch ( ( error ) => {
826815 // Error or user cancelled: reset flashing state and re-enable button
827816 console . error ( `${ self . logHead } DFU permission request failed:` , error ) ;
828- resetFlashingState ( ) ;
817+ self . resetFlashingState ( ) ;
829818 } ) ;
830819 }
831820 }
0 commit comments