1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 21:05:30 +03:00

Added buttons for reboot into boot loader and MSC modes.

This commit is contained in:
mikeller 2018-07-15 23:39:18 +12:00
parent 25b49fb79f
commit b9358083d9
6 changed files with 102 additions and 4 deletions

View file

@ -27,6 +27,12 @@ function MspHelper () {
'RUNCAM_DEVICE_CONTROL': 14, // support communitate with RunCam Device
'LIDAR_TF': 15
};
self.REBOOT_TYPES = {
FIRMWARE: 0,
BOOTLOADER: 1,
MSC: 2
};
}
MspHelper.prototype.reorderPwmProtocols = function (protocol) {
@ -617,6 +623,17 @@ MspHelper.prototype.process_data = function(dataHandler) {
break;
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');
break;
@ -1185,6 +1202,11 @@ MspHelper.prototype.process_data = function(dataHandler) {
console.log('Unknown code detected: ' + code);
} else {
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
@ -1207,7 +1229,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.
*/