Skip to content

Commit be4a9e1

Browse files
authored
Merge pull request #2904 from klutvott123/reboot-options
Make "Activate bootloader" button use bootloader in flash if it exists
2 parents 58014b2 + 145d567 commit be4a9e1

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/js/fc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,15 @@ const FC = {
824824
return hasVcp;
825825
},
826826

827+
boardHasFlashBootloader() {
828+
let hasFlashBootloader = false;
829+
if (semver.gte(this.CONFIG.apiVersion, API_VERSION_1_42)) {
830+
hasFlashBootloader = bit_check(this.CONFIG.targetCapabilities, this.TARGET_CAPABILITIES_FLAGS.HAS_FLASH_BOOTLOADER);
831+
}
832+
833+
return hasFlashBootloader;
834+
},
835+
827836
FILTER_TYPE_FLAGS: {
828837
PT1: 0,
829838
BIQUAD: 1,

src/js/msp/MSPHelper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function MspHelper() {
4040
BOOTLOADER: 1,
4141
MSC: 2,
4242
MSC_UTC: 3,
43+
BOOTLOADER_FLASH: 4,
4344
};
4445

4546
self.RESET_TYPES = {

src/js/tabs/setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ TABS.setup.initialize = function (callback) {
9393

9494
$('a.rebootBootloader').click(function () {
9595
const buffer = [];
96-
buffer.push(mspHelper.REBOOT_TYPES.BOOTLOADER);
96+
buffer.push(FC.boardHasFlashBootloader() ? mspHelper.REBOOT_TYPES.BOOTLOADER_FLASH : mspHelper.REBOOT_TYPES.BOOTLOADER);
9797
MSP.send_message(MSPCodes.MSP_SET_REBOOT, buffer, false);
9898
});
9999
} else {

0 commit comments

Comments
 (0)