diff --git a/locales/en/messages.json b/locales/en/messages.json index bc3724d0..fdae7dc8 100644 --- a/locales/en/messages.json +++ b/locales/en/messages.json @@ -3294,6 +3294,10 @@ "message": "Configurator has successfully detected and verified the board: {{boardName}}", "description": "Board verification has succeeded." }, + "firmwareFlasherBoardVerficationTargetNotAvailable": { + "message": "Configurator has detected the board: {{boardName}} but no official Betaflight target was found", + "description": "Board verification has succeeded, but the target is not available as offical Betaflight target." + }, "firmwareFlasherBoardVerificationFail": { "message": "Configurator failed 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", "description": "Sometimes MSP values cannot be read from firmware correctly" diff --git a/src/js/tabs/firmware_flasher.js b/src/js/tabs/firmware_flasher.js index 6633eeb5..7ee5251a 100644 --- a/src/js/tabs/firmware_flasher.js +++ b/src/js/tabs/firmware_flasher.js @@ -797,9 +797,23 @@ firmware_flasher.initialize = function (callback) { function onFinish() { const board = FC.CONFIG.boardName; + const boardSelect = $('select[name="board"]'); + const boardSelectOptions = $('select[name="board"] option'); + const target = boardSelect.val(); + let targetAvailable = false; + if (board) { - $('select[name="board"]').val(board).trigger('change'); - GUI.log(i18n.getMessage('firmwareFlasherBoardVerificationSuccess', {boardName: board})); + boardSelectOptions.each((_, e) => { + if ($(e).text() === board) { + targetAvailable = true; + } + }); + + if (board !== target) { + boardSelect.val(board).trigger('change'); + } + GUI.log(i18n.getMessage(targetAvailable ? 'firmwareFlasherBoardVerificationSuccess' : 'firmwareFlasherBoardVerficationTargetNotAvailable', + { boardName: board })); } else { GUI.log(i18n.getMessage('firmwareFlasherBoardVerificationFail')); } @@ -869,7 +883,7 @@ firmware_flasher.initialize = function (callback) { function updateDetectBoardButton() { const isDfu = portPickerElement.val().includes('DFU'); const isBusy = GUI.connect_lock; - const isLoaded = self.releases ? Object.keys(self.releases).length > 1 : false; + const isLoaded = self.releases ? Object.keys(self.releases).length > 0 : false; const isAvailable = PortHandler.port_available || false; const isButtonDisabled = isDfu || isBusy || !isLoaded || !isAvailable;