1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 08:45:28 +03:00

Added check to stop non - Betaflight firmware from connecting (except for CLI).

This commit is contained in:
mikeller 2016-07-20 00:27:49 +12:00
parent aaef07a01b
commit 878c9b5548
4 changed files with 73 additions and 46 deletions

View file

@ -2,7 +2,9 @@
"translation_version": {
"message": "0"
},
"warningTitle": {
"message": "Warning"
},
"options_title": {
"message": "Application Options"
},
@ -159,6 +161,9 @@
"firmwareVersionNotSupported": {
"message": "This firmware version is <span style=\"color: red\">not supported</span>. Please upgrade to firmware that supports api version <strong>$1</strong> or higher. Use CLI for backup before flashing. CLI backup/restore procedure is in the documention."
},
"firmwareTypeNotSupported": {
"message": "Non - Betaflight firmware is <span style=\"color: red\">not supported</span>. Please note that this tool is designed to support the advanced features of the Betaflight firmware, and does not support use with other types of firmware, except for in CLI mode."
},
"tabSwitchConnectionRequired": {
"message": "You need to <strong>connect</strong> before you can view any of the tabs."
@ -168,7 +173,7 @@
},
"tabSwitchUpgradeRequired": {
"message": "You need to <strong>upgrade</strong> your firmware before you can use the $1 tab."
"message": "You need to <strong>upgrade</strong> your firmware to the latest version of Betaflight before you can use the $1 tab."
},
"firmwareVersion": {
"message": "Firmware Version: <strong>$1</strong>"
@ -1473,9 +1478,6 @@
"firmwareFlasherMessage": {
"message": "Message:"
},
"firmwareFlasherWarningHead": {
"message": "Warning"
},
"firmwareFlasherWarningText": {
"message": "Please do <span style=\"color: red\">not</span> try to flash <strong>non-Betaflight</strong> hardware with this firmware flasher.<br />Do <span style=\"color: red\">not</span> <strong>disconnect</strong> the board or <strong>turn off</strong> your computer while flashing.<br /><br /><strong>Note: </strong>STM32 bootloader is stored in ROM, it cannot be bricked.<br /><strong>Note: </strong><span style=\"color: red\">Auto-Connect</span> is always disabled while you are inside firmware flasher.<br /><strong>Note: </strong>Make sure you have a backup; some upgrades/downgrades will wipe your configuration.<br /><strong>Note:</strong> If you have problems flashing try disconnecting all cables from your FC first, try rebooting, upgrade chrome, upgrade drivers.<br /><strong>Note:</strong> When flashing boards that have directly connected USB sockets (SPRacingF3Mini, Sparky, ColibriRace, etc) ensure you have read the USB Flashing section of the Betaflight manual and have the correct software and drivers installed"
},

View file

@ -310,5 +310,16 @@ GUI_control.prototype.content_ready = function (callback) {
if (callback) callback();
}
GUI_control.prototype.show_modal = function (title, message) {
var popup = new jBox('Modal', {
title: title,
content: message,
closeButton: 'title',
closeOnClick: 'box'
});
popup.open();
}
// initialize object into GUI variable
var GUI = new GUI_control();

View file

@ -73,7 +73,7 @@ $(document).ready(function () {
// Reset various UI elements
$('span.i2c-error').text(0);
$('span.cycle-time').text(0);
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0"))
if (CONFIG.flightControllerVersion !== '' && semver.gte(CONFIG.flightControllerVersion, "3.0.0"))
$('span.cpu-load').text('');
// unlock port select & baud
@ -189,7 +189,7 @@ function onOpen(openInfo) {
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.apiVersionAccepted)) {
MSP.send_message(MSP_codes.MSP_FC_VARIANT, false, false, function () {
if (CONFIG.flightControllerIdentifier === 'BTFL') {
MSP.send_message(MSP_codes.MSP_FC_VERSION, false, false, function () {
GUI.log(chrome.i18n.getMessage('fcInfoReceived', [CONFIG.flightControllerIdentifier, CONFIG.flightControllerVersion]));
@ -221,13 +221,18 @@ function onOpen(openInfo) {
});
});
});
} else {
GUI.show_modal(chrome.i18n.getMessage('warningTitle'),
chrome.i18n.getMessage('firmwareTypeNotSupported'));
connectCli();
}
});
} else {
GUI.log(chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.apiVersionAccepted]));
CONFIGURATOR.connectionValid = true; // making it possible to open the CLI tab
GUI.allowedTabs = ['cli'];
onConnect();
$('#tabs .tab_cli a').click();
GUI.show_modal(chrome.i18n.getMessage('warningTitle'),
chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.apiVersionAccepted]));
connectCli();
}
});
} else {
@ -245,6 +250,13 @@ function onOpen(openInfo) {
}
}
function connectCli() {
CONFIGURATOR.connectionValid = true; // making it possible to open the CLI tab
GUI.allowedTabs = ['cli'];
onConnect();
$('#tabs .tab_cli a').click();
}
function onConnect() {
GUI.timeout_remove('connecting'); // kill connecting timer
$('div#connectbutton a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active');
@ -252,6 +264,7 @@ function onConnect() {
$('#tabs ul.mode-disconnected').hide();
$('#tabs ul.mode-connected').show();
if (CONFIG.flightControllerVersion !== '') {
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
MSP.send_message(MSP_codes.MSP_STATUS_EX, false, false);
} else {
@ -267,6 +280,9 @@ function onConnect() {
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false);
startLiveDataRefreshTimer();
}
var sensor_state = $('#sensor-status');
sensor_state.show();
@ -275,8 +291,6 @@ function onConnect() {
var dataflash = $('#dataflash_wrapper_global');
dataflash.show();
startLiveDataRefreshTimer();
}
function onClosed(result) {

View file

@ -88,7 +88,7 @@
<div class="gui_box gui_warning">
<div class="gui_box_titlebar">
<div class="spacer_box_title" style="text-align: center; color: white;"
i18n="firmwareFlasherWarningHead">
i18n="warningTitle">
</div>
</div>
<div class="spacer" style="margin-bottom: 10px;">