@@ -29,7 +29,6 @@ const firmware_flasher = {
2929 selectedBoard : undefined ,
3030 cloudBuildKey : null ,
3131 cloudBuildOptions : null ,
32- isFlashing : false ,
3332 intel_hex : undefined , // standard intel hex in string format
3433 parsed_hex : undefined , // parsed raw hex in array format
3534 isConfigLocal : false , // Set to true if the user loads one locally
@@ -807,16 +806,12 @@ firmware_flasher.initialize = async function (callback) {
807806 // Maybe the board is in DFU mode, but it does not have permissions. Ask for them.
808807 console . log ( `${ self . logHead } No valid port detected, asking for permissions` ) ;
809808
810- DFU . requestPermission ( )
811- . then ( ( device ) => {
812- DFU . connect ( device . path , firmware , options ) ;
813- } )
814- . catch ( ( error ) => {
815- // Error or user cancelled: reset flashing state and re-enable button
816- console . error ( `${ self . logHead } DFU permission request failed:` , error ) ;
817- self . resetFlashingState ( ) ;
818- } ) ;
809+ DFU . requestPermission ( ) . then ( ( device ) => {
810+ DFU . connect ( device . path , firmware , options ) ;
811+ } ) ;
819812 }
813+
814+ GUI . interval_resume ( "sponsor" ) ;
820815 }
821816
822817 let result = getConfig ( "erase_chip" ) ;
@@ -1265,7 +1260,6 @@ firmware_flasher.initialize = async function (callback) {
12651260
12661261 const aborted = function ( message ) {
12671262 GUI . connect_lock = false ;
1268- self . isFlashing = false ;
12691263 self . enableFlashButton ( true ) ;
12701264 self . enableLoadRemoteFileButton ( true ) ;
12711265 self . enableLoadFileButton ( true ) ;
@@ -1391,7 +1385,6 @@ firmware_flasher.initialize = async function (callback) {
13911385 // Preserve current firmware message state before flashing
13921386 self . preservePreFlashingState ( ) ;
13931387
1394- self . isFlashing = true ;
13951388 GUI . interval_pause ( "sponsor" ) ;
13961389
13971390 self . enableFlashButton ( false ) ;
@@ -1414,7 +1407,6 @@ firmware_flasher.initialize = async function (callback) {
14141407 : i18n . getMessage ( "firmwareFlasherUF2SaveFailed" ) ,
14151408 saved ? self . FLASH_MESSAGE_TYPES . VALID : self . FLASH_MESSAGE_TYPES . INVALID ,
14161409 ) ;
1417- self . isFlashing = false ;
14181410 GUI . interval_resume ( "sponsor" ) ;
14191411 self . enableFlashButton ( true ) ;
14201412 self . enableLoadRemoteFileButton ( true ) ;
@@ -1511,9 +1503,8 @@ firmware_flasher.enableDfuExitButton = function (enabled) {
15111503} ;
15121504
15131505firmware_flasher . resetFlashingState = function ( ) {
1514- console . log ( `${ this . logHead } Resetting flashing state` ) ;
1515- this . isFlashing = false ;
1516- this . enableFlashButton ( this . parsed_hex || this . uf2_binary ? true : false ) ; // Only enable if firmware is loaded
1506+ console . log ( `${ this . logHead } Reset flashing state` ) ;
1507+ this . enableFlashButton ( ! ! this . parsed_hex || ! ! this . uf2_binary ) ; // Only enable if firmware is loaded
15171508 this . enableDfuExitButton ( PortHandler . dfuAvailable ) ;
15181509 this . enableLoadRemoteFileButton ( true ) ;
15191510 this . enableLoadFileButton ( true ) ;
0 commit comments