Added buttons for reboot into boot loader and MSC modes.
parent
25b49fb79f
commit
b9358083d9
|
@ -9,12 +9,21 @@
|
|||
"error": {
|
||||
"message": "Error: {{errorMessage}}"
|
||||
},
|
||||
"errorTitle": {
|
||||
"message": "Error"
|
||||
},
|
||||
"warningTitle": {
|
||||
"message": "Warning"
|
||||
},
|
||||
"noticeTitle": {
|
||||
"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": {
|
||||
"message": "Application Options"
|
||||
},
|
||||
|
@ -598,8 +607,20 @@
|
|||
"initialSetupButtonRestore": {
|
||||
"message": "Restore"
|
||||
},
|
||||
"initialSetupButtonRebootBootloader": {
|
||||
"message": "Activate Boot Loader / DFU"
|
||||
},
|
||||
"initialSetupButtonRebootMsc": {
|
||||
"message": "Activate Mass Storage Device Mode"
|
||||
},
|
||||
"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."
|
||||
},
|
||||
"initialSetupRebootMscText": {
|
||||
"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."
|
||||
},
|
||||
"initialSetupBackupSuccess": {
|
||||
"message": "Backup saved <span class=\"message-positive\">successfully</span>"
|
||||
|
|
|
@ -643,3 +643,15 @@ function openNewWindowsInExternalBrowser() {
|
|||
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
|
||||
'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.
|
||||
*/
|
||||
|
|
|
@ -59,9 +59,31 @@ TABS.setup.initialize = function (callback) {
|
|||
|
||||
self.initializeInstruments();
|
||||
|
||||
|
||||
$('#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);
|
||||
});
|
||||
|
||||
$('a.rebootMsc').click(function () {
|
||||
var buffer = [];
|
||||
buffer.push(2);
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, buffer, false);
|
||||
});
|
||||
} else {
|
||||
$('.initialSetupRebootBootloader').hide();
|
||||
$('.initialSetupRebootMsc').hide();
|
||||
}
|
||||
|
||||
// UI Hooks
|
||||
$('a.calibrateAccel').click(function () {
|
||||
var self = $(this);
|
||||
|
|
|
@ -323,5 +323,15 @@
|
|||
</div>
|
||||
</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>
|
||||
</html>
|
||||
|
|
|
@ -46,6 +46,12 @@
|
|||
<a class="restore" href="#" i18n="initialSetupButtonRestore"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="default_btn initialSetupRebootBootloader">
|
||||
<a class="rebootBootloader" href="#" i18n="initialSetupButtonRebootBootloader"></a>
|
||||
</div>
|
||||
<div class="default_btn intialSetupRebootMsc">
|
||||
<a class="rebootMsc" href="#" i18n="initialSetupButtonRebootMsc"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="threefourth_right setupinfo">
|
||||
|
@ -61,6 +67,12 @@
|
|||
<div class="cell_setup">
|
||||
<span i18n="initialSetupBackupRestoreText"></span>
|
||||
</div>
|
||||
<div class="cell_setup initialSetupRebootBootloader">
|
||||
<span i18n="initialSetupRebootBootloaderText"></span>
|
||||
</div>
|
||||
<div class="cell_setup intialSetupRebootMsc">
|
||||
<span i18n="initialSetupRebootMscText"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modelwrapper"></div>
|
||||
|
|
Loading…
Reference in New Issue