Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ firmware_flasher.initialize = async function (callback) {
$("a.load_remote_file").text(i18n.getMessage("firmwareFlasherButtonLoadOnline"));
}

function loadTargetList(targets) {
async function loadTargetList(targets) {
if (!targets || !ispConnected()) {
$('select[name="board"]').empty().append('<option value="0">Offline</option>');
$('select[name="firmware_version"]').empty().append('<option value="0">Offline</option>');
Expand Down Expand Up @@ -445,6 +445,7 @@ firmware_flasher.initialize = async function (callback) {
self.enableLoadRemoteFileButton(false);

const build_type = buildType_e.val();
const currentlySelectedBoard = $('select[name="board"]').val();

$('select[name="board"]')
.empty()
Expand All @@ -456,7 +457,16 @@ firmware_flasher.initialize = async function (callback) {

if (!GUI.connect_lock) {
try {
loadTargetList(await self.buildApi.loadTargets());
await loadTargetList(await self.buildApi.loadTargets());

// Restore the previously selected board if it was selected and still exists
if (
currentlySelectedBoard &&
currentlySelectedBoard !== "0" &&
$(`select[name="board"] option[value="${currentlySelectedBoard}"]`).length > 0
) {
$('select[name="board"]').val(currentlySelectedBoard).trigger("change");
}
} catch (err) {
console.error(err);
}
Expand Down