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) {
239
239
$ ( "a.load_remote_file" ) . text ( i18n . getMessage ( "firmwareFlasherButtonLoadOnline" ) ) ;
240
240
}
241
241
242
- function loadTargetList ( targets ) {
242
+ async function loadTargetList ( targets ) {
243
243
if ( ! targets || ! ispConnected ( ) ) {
244
244
$ ( 'select[name="board"]' ) . empty ( ) . append ( '<option value="0">Offline</option>' ) ;
245
245
$ ( 'select[name="firmware_version"]' ) . empty ( ) . append ( '<option value="0">Offline</option>' ) ;
@@ -445,6 +445,7 @@ firmware_flasher.initialize = async function (callback) {
445
445
self . enableLoadRemoteFileButton ( false ) ;
446
446
447
447
const build_type = buildType_e . val ( ) ;
448
+ const currentlySelectedBoard = $ ( 'select[name="board"]' ) . val ( ) ;
448
449
449
450
$ ( 'select[name="board"]' )
450
451
. empty ( )
@@ -456,7 +457,16 @@ firmware_flasher.initialize = async function (callback) {
456
457
457
458
if ( ! GUI . connect_lock ) {
458
459
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
+ }
460
470
} catch ( err ) {
461
471
console . error ( err ) ;
462
472
}
You can’t perform that action at this time.
0 commit comments