Skip to content

Commit c4f7a8f

Browse files
authored
Merge pull request #2775 from haslinghuis/fix_flash_status
Fix board select trigger after flashing
2 parents f3f8df6 + b44b7ec commit c4f7a8f

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

locales/en/messages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3291,6 +3291,10 @@
32913291
"message": "Configurator has <span class=\"message-positive\">successfully</span> detected and verified the board: <strong>{{boardName}}</strong>",
32923292
"description": "Board verification has succeeded."
32933293
},
3294+
"firmwareFlasherBoardVerficationTargetNotAvailable": {
3295+
"message": "Configurator has detected the board: <strong>{{boardName}}</strong> but no official Betaflight target was found",
3296+
"description": "Board verification has succeeded, but the target is not available as offical Betaflight target."
3297+
},
32943298
"firmwareFlasherBoardVerificationFail": {
32953299
"message": "Configurator <span class=\"message-negative\">failed</span> to verify the board, if this does not work please try switching tab slowly to retry, make a new usb connection or connect first if you might have forgotten to apply custom defaults",
32963300
"description": "Sometimes MSP values cannot be read from firmware correctly"

src/js/tabs/firmware_flasher.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,23 @@ firmware_flasher.initialize = function (callback) {
797797

798798
function onFinish() {
799799
const board = FC.CONFIG.boardName;
800+
const boardSelect = $('select[name="board"]');
801+
const boardSelectOptions = $('select[name="board"] option');
802+
const target = boardSelect.val();
803+
let targetAvailable = false;
804+
800805
if (board) {
801-
$('select[name="board"]').val(board).trigger('change');
802-
GUI.log(i18n.getMessage('firmwareFlasherBoardVerificationSuccess', {boardName: board}));
806+
boardSelectOptions.each((_, e) => {
807+
if ($(e).text() === board) {
808+
targetAvailable = true;
809+
}
810+
});
811+
812+
if (board !== target) {
813+
boardSelect.val(board).trigger('change');
814+
}
815+
GUI.log(i18n.getMessage(targetAvailable ? 'firmwareFlasherBoardVerificationSuccess' : 'firmwareFlasherBoardVerficationTargetNotAvailable',
816+
{ boardName: board }));
803817
} else {
804818
GUI.log(i18n.getMessage('firmwareFlasherBoardVerificationFail'));
805819
}
@@ -869,7 +883,7 @@ firmware_flasher.initialize = function (callback) {
869883
function updateDetectBoardButton() {
870884
const isDfu = portPickerElement.val().includes('DFU');
871885
const isBusy = GUI.connect_lock;
872-
const isLoaded = self.releases ? Object.keys(self.releases).length > 1 : false;
886+
const isLoaded = self.releases ? Object.keys(self.releases).length > 0 : false;
873887
const isAvailable = PortHandler.port_available || false;
874888
const isButtonDisabled = isDfu || isBusy || !isLoaded || !isAvailable;
875889

0 commit comments

Comments
 (0)