File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ firmware_flasher.initialize = async function (callback) {
239239 $ ( "a.load_remote_file" ) . text ( i18n . getMessage ( "firmwareFlasherButtonLoadOnline" ) ) ;
240240 }
241241
242- function loadTargetList ( targets ) {
242+ async function loadTargetList ( targets ) {
243243 if ( ! targets || ! ispConnected ( ) ) {
244244 $ ( 'select[name="board"]' ) . empty ( ) . append ( '<option value="0">Offline</option>' ) ;
245245 $ ( 'select[name="firmware_version"]' ) . empty ( ) . append ( '<option value="0">Offline</option>' ) ;
@@ -445,6 +445,7 @@ firmware_flasher.initialize = async function (callback) {
445445 self . enableLoadRemoteFileButton ( false ) ;
446446
447447 const build_type = buildType_e . val ( ) ;
448+ const currentlySelectedBoard = $ ( 'select[name="board"]' ) . val ( ) ;
448449
449450 $ ( 'select[name="board"]' )
450451 . empty ( )
@@ -456,7 +457,16 @@ firmware_flasher.initialize = async function (callback) {
456457
457458 if ( ! GUI . connect_lock ) {
458459 try {
459- loadTargetList ( await self . buildApi . loadTargets ( ) ) ;
460+ await loadTargetList ( await self . buildApi . loadTargets ( ) ) ;
461+
462+ // Restore the previously selected board if it was selected and still exists
463+ if (
464+ currentlySelectedBoard &&
465+ currentlySelectedBoard !== "0" &&
466+ $ ( `select[name="board"] option[value="${ currentlySelectedBoard } "]` ) . length > 0
467+ ) {
468+ $ ( 'select[name="board"]' ) . val ( currentlySelectedBoard ) . trigger ( "change" ) ;
469+ }
460470 } catch ( err ) {
461471 console . error ( err ) ;
462472 }
You can’t perform that action at this time.
0 commit comments