Merge pull request #2775 from haslinghuis/fix_flash_status

Fix board select trigger after flashing
10.8-maintenance
haslinghuis 2022-01-29 04:39:16 +01:00 committed by GitHub
commit c4f7a8f0bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -3291,6 +3291,10 @@
"message": "Configurator has <span class=\"message-positive\">successfully</span> detected and verified the board: <strong>{{boardName}}</strong>",
"description": "Board verification has succeeded."
},
"firmwareFlasherBoardVerficationTargetNotAvailable": {
"message": "Configurator has detected the board: <strong>{{boardName}}</strong> 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 <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",
"description": "Sometimes MSP values cannot be read from firmware correctly"

View File

@ -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;