mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 21:35:33 +03:00
Merge pull request #1113 from mikeller/add_bootloader_msc_button
Added buttons for reboot into boot loader and MSC modes.
This commit is contained in:
commit
606e4045d9
9 changed files with 155 additions and 5 deletions
|
@ -9,12 +9,21 @@
|
||||||
"error": {
|
"error": {
|
||||||
"message": "Error: {{errorMessage}}"
|
"message": "Error: {{errorMessage}}"
|
||||||
},
|
},
|
||||||
|
"errorTitle": {
|
||||||
|
"message": "Error"
|
||||||
|
},
|
||||||
"warningTitle": {
|
"warningTitle": {
|
||||||
"message": "Warning"
|
"message": "Warning"
|
||||||
},
|
},
|
||||||
"noticeTitle": {
|
"noticeTitle": {
|
||||||
"message": "Notice"
|
"message": "Notice"
|
||||||
},
|
},
|
||||||
|
"operationNotSupported": {
|
||||||
|
"message": "This operation is not supported by your hardware."
|
||||||
|
},
|
||||||
|
"storageDeviceNotReady": {
|
||||||
|
"message": "The storage device is not ready. In the case of a microSD card, make sure it is properly recognised by your flight controller."
|
||||||
|
},
|
||||||
"options_title": {
|
"options_title": {
|
||||||
"message": "Application Options"
|
"message": "Application Options"
|
||||||
},
|
},
|
||||||
|
@ -598,8 +607,14 @@
|
||||||
"initialSetupButtonRestore": {
|
"initialSetupButtonRestore": {
|
||||||
"message": "Restore"
|
"message": "Restore"
|
||||||
},
|
},
|
||||||
|
"initialSetupButtonRebootBootloader": {
|
||||||
|
"message": "Activate Boot Loader / DFU"
|
||||||
|
},
|
||||||
"initialSetupBackupRestoreText": {
|
"initialSetupBackupRestoreText": {
|
||||||
"message": "<strong>Backup</strong> your configuration in case of an accident, <strong>CLI</strong> settings are <span class=\"message-negative\">not</span> included - See 'dump' cli command"
|
"message": "<strong>Backup</strong> your configuration in case of an accident, <strong>CLI</strong> settings are <span class=\"message-negative\">not</span> included - use the command 'diff all' in CLI for this."
|
||||||
|
},
|
||||||
|
"initialSetupRebootBootloaderText": {
|
||||||
|
"message": "Reboot into <strong>boot loader / DFU</strong> mode."
|
||||||
},
|
},
|
||||||
"initialSetupBackupSuccess": {
|
"initialSetupBackupSuccess": {
|
||||||
"message": "Backup saved <span class=\"message-positive\">successfully</span>"
|
"message": "Backup saved <span class=\"message-positive\">successfully</span>"
|
||||||
|
@ -3576,6 +3591,18 @@
|
||||||
"onboardLoggingOnboardSDCard": {
|
"onboardLoggingOnboardSDCard": {
|
||||||
"message": "Onboard SD card"
|
"message": "Onboard SD card"
|
||||||
},
|
},
|
||||||
|
"onboardLoggingMsc": {
|
||||||
|
"message": "Mass Storage Mode"
|
||||||
|
},
|
||||||
|
"onboardLoggingMscNote": {
|
||||||
|
"message": "Reboot into <strong>mass storage device (MSC)</strong> mode. Once activated, the onboard flash or SD card on your flight controller will be recognised as a storage device by your computer, and allow you to download your log files. Eject and power cycel your flight controller to leave mass storage device mode."
|
||||||
|
},
|
||||||
|
"onboardLoggingRebootMscText": {
|
||||||
|
"message": "Activate Mass Storage Device Mode"
|
||||||
|
},
|
||||||
|
"onboardLoggingMscNotReady": {
|
||||||
|
"message": "Mass storage mode can not be activated because the storage device is not ready."
|
||||||
|
},
|
||||||
"dialogConfirmResetTitle": {
|
"dialogConfirmResetTitle": {
|
||||||
"message": "Confirm"
|
"message": "Confirm"
|
||||||
},
|
},
|
||||||
|
|
|
@ -206,6 +206,22 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.require-msc-supported {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-onboard_logging.msc-supported .require-msc-supported {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.require-msc-not-ready {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-onboard_logging.msc-not-ready .require-msc-not-ready {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
|
@media only screen and (max-width: 1055px) , only screen and (max-device-width: 1055px) {
|
||||||
.tab-onboard_logging table thead tr:first-child {
|
.tab-onboard_logging table thead tr:first-child {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
@ -300,4 +316,4 @@
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
text-shadow: none;
|
text-shadow: none;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,4 +642,16 @@ function openNewWindowsInExternalBrowser() {
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log("require does not exist, maybe inside chrome");
|
console.log("require does not exist, maybe inside chrome");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showErrorDialog(message) {
|
||||||
|
var dialog = $('.dialogError')[0];
|
||||||
|
|
||||||
|
$('.dialogError-content').html(message);
|
||||||
|
|
||||||
|
$('.dialogError-closebtn').click(function() {
|
||||||
|
dialog.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.showModal();
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,12 @@ function MspHelper () {
|
||||||
'RUNCAM_DEVICE_CONTROL': 14, // support communitate with RunCam Device
|
'RUNCAM_DEVICE_CONTROL': 14, // support communitate with RunCam Device
|
||||||
'LIDAR_TF': 15
|
'LIDAR_TF': 15
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.REBOOT_TYPES = {
|
||||||
|
FIRMWARE: 0,
|
||||||
|
BOOTLOADER: 1,
|
||||||
|
MSC: 2
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
MspHelper.prototype.reorderPwmProtocols = function (protocol) {
|
MspHelper.prototype.reorderPwmProtocols = function (protocol) {
|
||||||
|
@ -617,6 +623,17 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSPCodes.MSP_SET_REBOOT:
|
case MSPCodes.MSP_SET_REBOOT:
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
|
||||||
|
var rebootType = data.read8();
|
||||||
|
if (rebootType === self.REBOOT_TYPES.MSC) {
|
||||||
|
if (data.read8() === 0) {
|
||||||
|
console.log('Storage device not ready.');
|
||||||
|
|
||||||
|
showErrorDialog(i18n.getMessage('storageDeviceNotReady'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
console.log('Reboot request accepted');
|
console.log('Reboot request accepted');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1187,6 +1204,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
console.log('Unknown code detected: ' + code);
|
console.log('Unknown code detected: ' + code);
|
||||||
} else {
|
} else {
|
||||||
console.log('FC reports unsupported message error: ' + code);
|
console.log('FC reports unsupported message error: ' + code);
|
||||||
|
|
||||||
|
switch (code) {
|
||||||
|
case MSPCodes.MSP_SET_REBOOT:
|
||||||
|
showErrorDialog(i18n.getMessage('operationNotSupported'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// trigger callbacks, cleanup/remove callback after trigger
|
// trigger callbacks, cleanup/remove callback after trigger
|
||||||
|
@ -1209,7 +1231,6 @@ MspHelper.prototype.process_data = function(dataHandler) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode the request body for the MSP request with the given code and return it as an array of bytes.
|
* Encode the request body for the MSP request with the given code and return it as an array of bytes.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -145,6 +145,20 @@ TABS.onboard_logging.initialize = function (callback) {
|
||||||
$("div.blackboxRate").show();
|
$("div.blackboxRate").show();
|
||||||
}
|
}
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
|
||||||
|
if (SDCARD.supported || DATAFLASH.supported) {
|
||||||
|
|
||||||
|
$(".tab-onboard_logging")
|
||||||
|
.toggleClass("msc-supported", true);
|
||||||
|
|
||||||
|
$('a.onboardLoggingRebootMsc').click(function () {
|
||||||
|
var buffer = [];
|
||||||
|
buffer.push(2);
|
||||||
|
MSP.send_message(MSPCodes.MSP_SET_REBOOT, buffer, false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update_html();
|
update_html();
|
||||||
|
|
||||||
|
@ -296,6 +310,18 @@ TABS.onboard_logging.initialize = function (callback) {
|
||||||
.toggleClass("sdcard-error", SDCARD.state === MSP.SDCARD_STATE_FATAL)
|
.toggleClass("sdcard-error", SDCARD.state === MSP.SDCARD_STATE_FATAL)
|
||||||
.toggleClass("sdcard-initializing", SDCARD.state === MSP.SDCARD_STATE_CARD_INIT || SDCARD.state === MSP.SDCARD_STATE_FS_INIT)
|
.toggleClass("sdcard-initializing", SDCARD.state === MSP.SDCARD_STATE_CARD_INIT || SDCARD.state === MSP.SDCARD_STATE_FS_INIT)
|
||||||
.toggleClass("sdcard-ready", SDCARD.state === MSP.SDCARD_STATE_READY);
|
.toggleClass("sdcard-ready", SDCARD.state === MSP.SDCARD_STATE_READY);
|
||||||
|
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
|
||||||
|
var mscIsReady = (DATAFLASH.totalSize > 0) || (SDCARD.state === MSP.SDCARD_STATE_READY);
|
||||||
|
$(".tab-onboard_logging")
|
||||||
|
.toggleClass("msc-not-ready", !mscIsReady);
|
||||||
|
|
||||||
|
if (!mscIsReady) {
|
||||||
|
$('a.onboardLoggingRebootMsc').addClass('disabled');
|
||||||
|
} else {
|
||||||
|
$('a.onboardLoggingRebootMsc').removeClass('disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (SDCARD.state) {
|
switch (SDCARD.state) {
|
||||||
case MSP.SDCARD_STATE_NOT_PRESENT:
|
case MSP.SDCARD_STATE_NOT_PRESENT:
|
||||||
|
|
|
@ -59,9 +59,24 @@ TABS.setup.initialize = function (callback) {
|
||||||
|
|
||||||
self.initializeInstruments();
|
self.initializeInstruments();
|
||||||
|
|
||||||
|
|
||||||
$('#arming-disable-flag-row').attr('title', i18n.getMessage('initialSetupArmingDisableFlagsTooltip'));
|
$('#arming-disable-flag-row').attr('title', i18n.getMessage('initialSetupArmingDisableFlagsTooltip'));
|
||||||
|
|
||||||
|
if (semver.gte(CONFIG.apiVersion, "1.40.0")) {
|
||||||
|
if (isExpertModeEnabled()) {
|
||||||
|
$('.initialSetupRebootBootloader').show();
|
||||||
|
} else {
|
||||||
|
$('.initialSetupRebootBootloader').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('a.rebootBootloader').click(function () {
|
||||||
|
var buffer = [];
|
||||||
|
buffer.push(1);
|
||||||
|
MSP.send_message(MSPCodes.MSP_SET_REBOOT, buffer, false);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('.initialSetupRebootBootloader').hide();
|
||||||
|
}
|
||||||
|
|
||||||
// UI Hooks
|
// UI Hooks
|
||||||
$('a.calibrateAccel').click(function () {
|
$('a.calibrateAccel').click(function () {
|
||||||
var self = $(this);
|
var self = $(this);
|
||||||
|
|
|
@ -323,5 +323,15 @@
|
||||||
</div>
|
</div>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
|
<dialog class="dialogError">
|
||||||
|
<h3 i18n="errorTitle"></h3>
|
||||||
|
<div class="content">
|
||||||
|
<div class="dialogError-content" style="margin-top: 10px"></div>
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<a href="#" class="dialogError-closebtn regular-button" i18n="close"></a>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -133,6 +133,23 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="gui_box grey require-msc-supported">
|
||||||
|
<div class="gui_box_titlebar" align="left">
|
||||||
|
<div class="spacer_box_title" i18n="onboardLoggingMsc">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="spacer_box">
|
||||||
|
<div class="require-msc-supported">
|
||||||
|
<p i18n="onboardLoggingMscNote"></p>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a class="require-msc-ready regular-button onboardLoggingRebootMsc" href="#" i18n="onboardLoggingRebootMscText"></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="require-msc-not-ready" i18n="onboardLoggingMscNotReady"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
<a class="restore" href="#" i18n="initialSetupButtonRestore"></a>
|
<a class="restore" href="#" i18n="initialSetupButtonRestore"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="default_btn initialSetupRebootBootloader">
|
||||||
|
<a class="rebootBootloader" href="#" i18n="initialSetupButtonRebootBootloader"></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="threefourth_right setupinfo">
|
<div class="threefourth_right setupinfo">
|
||||||
|
@ -61,6 +64,9 @@
|
||||||
<div class="cell_setup">
|
<div class="cell_setup">
|
||||||
<span i18n="initialSetupBackupRestoreText"></span>
|
<span i18n="initialSetupBackupRestoreText"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cell_setup initialSetupRebootBootloader">
|
||||||
|
<span i18n="initialSetupRebootBootloaderText"></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modelwrapper"></div>
|
<div class="modelwrapper"></div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue