Skip to content

Commit

Permalink
Merge pull request #2904 from klutvott123/reboot-options
Browse files Browse the repository at this point in the history
Make "Activate bootloader" button use bootloader in flash if it exists
  • Loading branch information
haslinghuis authored Apr 24, 2022
2 parents 58014b2 + 145d567 commit be4a9e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/js/fc.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,15 @@ const FC = {
return hasVcp;
},

boardHasFlashBootloader() {
let hasFlashBootloader = false;
if (semver.gte(this.CONFIG.apiVersion, API_VERSION_1_42)) {
hasFlashBootloader = bit_check(this.CONFIG.targetCapabilities, this.TARGET_CAPABILITIES_FLAGS.HAS_FLASH_BOOTLOADER);
}

return hasFlashBootloader;
},

FILTER_TYPE_FLAGS: {
PT1: 0,
BIQUAD: 1,
Expand Down
1 change: 1 addition & 0 deletions src/js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function MspHelper() {
BOOTLOADER: 1,
MSC: 2,
MSC_UTC: 3,
BOOTLOADER_FLASH: 4,
};

self.RESET_TYPES = {
Expand Down
2 changes: 1 addition & 1 deletion src/js/tabs/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TABS.setup.initialize = function (callback) {

$('a.rebootBootloader').click(function () {
const buffer = [];
buffer.push(mspHelper.REBOOT_TYPES.BOOTLOADER);
buffer.push(FC.boardHasFlashBootloader() ? mspHelper.REBOOT_TYPES.BOOTLOADER_FLASH : mspHelper.REBOOT_TYPES.BOOTLOADER);
MSP.send_message(MSPCodes.MSP_SET_REBOOT, buffer, false);
});
} else {
Expand Down

0 comments on commit be4a9e1

Please sign in to comment.