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:
parent
aaef07a01b
commit
878c9b5548
4 changed files with 73 additions and 46 deletions
|
@ -2,7 +2,9 @@
|
||||||
"translation_version": {
|
"translation_version": {
|
||||||
"message": "0"
|
"message": "0"
|
||||||
},
|
},
|
||||||
|
"warningTitle": {
|
||||||
|
"message": "Warning"
|
||||||
|
},
|
||||||
"options_title": {
|
"options_title": {
|
||||||
"message": "Application Options"
|
"message": "Application Options"
|
||||||
},
|
},
|
||||||
|
@ -157,7 +159,10 @@
|
||||||
"message": "No configuration received within <span style=\"color: red\">10 seconds</span>, communication <span style=\"color: red\">failed</span>"
|
"message": "No configuration received within <span style=\"color: red\">10 seconds</span>, communication <span style=\"color: red\">failed</span>"
|
||||||
},
|
},
|
||||||
"firmwareVersionNotSupported": {
|
"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."
|
"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": {
|
"tabSwitchConnectionRequired": {
|
||||||
|
@ -168,7 +173,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"tabSwitchUpgradeRequired": {
|
"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": {
|
"firmwareVersion": {
|
||||||
"message": "Firmware Version: <strong>$1</strong>"
|
"message": "Firmware Version: <strong>$1</strong>"
|
||||||
|
@ -1473,9 +1478,6 @@
|
||||||
"firmwareFlasherMessage": {
|
"firmwareFlasherMessage": {
|
||||||
"message": "Message:"
|
"message": "Message:"
|
||||||
},
|
},
|
||||||
"firmwareFlasherWarningHead": {
|
|
||||||
"message": "Warning"
|
|
||||||
},
|
|
||||||
"firmwareFlasherWarningText": {
|
"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"
|
"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"
|
||||||
},
|
},
|
||||||
|
|
11
js/gui.js
11
js/gui.js
|
@ -310,5 +310,16 @@ GUI_control.prototype.content_ready = function (callback) {
|
||||||
if (callback) 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
|
// initialize object into GUI variable
|
||||||
var GUI = new GUI_control();
|
var GUI = new GUI_control();
|
||||||
|
|
|
@ -73,7 +73,7 @@ $(document).ready(function () {
|
||||||
// Reset various UI elements
|
// Reset various UI elements
|
||||||
$('span.i2c-error').text(0);
|
$('span.i2c-error').text(0);
|
||||||
$('span.cycle-time').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('');
|
$('span.cpu-load').text('');
|
||||||
|
|
||||||
// unlock port select & baud
|
// unlock port select & baud
|
||||||
|
@ -189,45 +189,50 @@ function onOpen(openInfo) {
|
||||||
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.apiVersionAccepted)) {
|
if (semver.gte(CONFIG.apiVersion, CONFIGURATOR.apiVersionAccepted)) {
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_FC_VARIANT, false, false, function () {
|
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 () {
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_FC_VERSION, false, false, function () {
|
GUI.log(chrome.i18n.getMessage('fcInfoReceived', [CONFIG.flightControllerIdentifier, CONFIG.flightControllerVersion]));
|
||||||
|
|
||||||
GUI.log(chrome.i18n.getMessage('fcInfoReceived', [CONFIG.flightControllerIdentifier, CONFIG.flightControllerVersion]));
|
MSP.send_message(MSP_codes.MSP_BUILD_INFO, false, false, function () {
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_BUILD_INFO, false, false, function () {
|
GUI.log(chrome.i18n.getMessage('buildInfoReceived', [CONFIG.buildInfo]));
|
||||||
|
|
||||||
GUI.log(chrome.i18n.getMessage('buildInfoReceived', [CONFIG.buildInfo]));
|
MSP.send_message(MSP_codes.MSP_BOARD_INFO, false, false, function () {
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_BOARD_INFO, false, false, function () {
|
GUI.log(chrome.i18n.getMessage('boardInfoReceived', [CONFIG.boardIdentifier, CONFIG.boardVersion]));
|
||||||
|
|
||||||
GUI.log(chrome.i18n.getMessage('boardInfoReceived', [CONFIG.boardIdentifier, CONFIG.boardVersion]));
|
MSP.send_message(MSP_codes.MSP_UID, false, false, function () {
|
||||||
|
GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_UID, false, false, function () {
|
// continue as usually
|
||||||
GUI.log(chrome.i18n.getMessage('uniqueDeviceIdReceived', [CONFIG.uid[0].toString(16) + CONFIG.uid[1].toString(16) + CONFIG.uid[2].toString(16)]));
|
CONFIGURATOR.connectionValid = true;
|
||||||
|
GUI.allowedTabs = GUI.defaultAllowedTabsWhenConnected.slice();
|
||||||
|
if (semver.lt(CONFIG.apiVersion, "1.4.0")) {
|
||||||
|
GUI.allowedTabs.splice(GUI.allowedTabs.indexOf('led_strip'), 1);
|
||||||
|
}
|
||||||
|
|
||||||
// continue as usually
|
GUI.canChangePidController = semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion);
|
||||||
CONFIGURATOR.connectionValid = true;
|
|
||||||
GUI.allowedTabs = GUI.defaultAllowedTabsWhenConnected.slice();
|
|
||||||
if (semver.lt(CONFIG.apiVersion, "1.4.0")) {
|
|
||||||
GUI.allowedTabs.splice(GUI.allowedTabs.indexOf('led_strip'), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUI.canChangePidController = semver.gte(CONFIG.apiVersion, CONFIGURATOR.pidControllerChangeMinApiVersion);
|
onConnect();
|
||||||
|
|
||||||
onConnect();
|
$('#tabs ul.mode-connected .tab_setup a').click();
|
||||||
|
});
|
||||||
$('#tabs ul.mode-connected .tab_setup a').click();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
|
GUI.show_modal(chrome.i18n.getMessage('warningTitle'),
|
||||||
|
chrome.i18n.getMessage('firmwareTypeNotSupported'));
|
||||||
|
|
||||||
|
connectCli();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
GUI.log(chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.apiVersionAccepted]));
|
GUI.show_modal(chrome.i18n.getMessage('warningTitle'),
|
||||||
CONFIGURATOR.connectionValid = true; // making it possible to open the CLI tab
|
chrome.i18n.getMessage('firmwareVersionNotSupported', [CONFIGURATOR.apiVersionAccepted]));
|
||||||
GUI.allowedTabs = ['cli'];
|
|
||||||
onConnect();
|
connectCli();
|
||||||
$('#tabs .tab_cli a').click();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} 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() {
|
function onConnect() {
|
||||||
GUI.timeout_remove('connecting'); // kill connecting timer
|
GUI.timeout_remove('connecting'); // kill connecting timer
|
||||||
$('div#connectbutton a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active');
|
$('div#connectbutton a.connect_state').text(chrome.i18n.getMessage('disconnect')).addClass('active');
|
||||||
|
@ -252,20 +264,24 @@ function onConnect() {
|
||||||
$('#tabs ul.mode-disconnected').hide();
|
$('#tabs ul.mode-disconnected').hide();
|
||||||
$('#tabs ul.mode-connected').show();
|
$('#tabs ul.mode-connected').show();
|
||||||
|
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
if (CONFIG.flightControllerVersion !== '') {
|
||||||
MSP.send_message(MSP_codes.MSP_STATUS_EX, false, false);
|
if (semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
} else {
|
MSP.send_message(MSP_codes.MSP_STATUS_EX, false, false);
|
||||||
MSP.send_message(MSP_codes.MSP_STATUS, false, false);
|
|
||||||
|
|
||||||
if (semver.gte(CONFIG.flightControllerVersion, "2.4.0")) {
|
|
||||||
CONFIG.numProfiles = 2;
|
|
||||||
$('select[name="profilechange"] .profile3').hide();
|
|
||||||
} else {
|
} else {
|
||||||
CONFIG.numProfiles = 3;
|
MSP.send_message(MSP_codes.MSP_STATUS, false, false);
|
||||||
|
|
||||||
|
if (semver.gte(CONFIG.flightControllerVersion, "2.4.0")) {
|
||||||
|
CONFIG.numProfiles = 2;
|
||||||
|
$('select[name="profilechange"] .profile3').hide();
|
||||||
|
} else {
|
||||||
|
CONFIG.numProfiles = 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false);
|
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false);
|
||||||
|
|
||||||
|
startLiveDataRefreshTimer();
|
||||||
|
}
|
||||||
|
|
||||||
var sensor_state = $('#sensor-status');
|
var sensor_state = $('#sensor-status');
|
||||||
sensor_state.show();
|
sensor_state.show();
|
||||||
|
@ -275,8 +291,6 @@ function onConnect() {
|
||||||
|
|
||||||
var dataflash = $('#dataflash_wrapper_global');
|
var dataflash = $('#dataflash_wrapper_global');
|
||||||
dataflash.show();
|
dataflash.show();
|
||||||
|
|
||||||
startLiveDataRefreshTimer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClosed(result) {
|
function onClosed(result) {
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
<div class="gui_box gui_warning">
|
<div class="gui_box gui_warning">
|
||||||
<div class="gui_box_titlebar">
|
<div class="gui_box_titlebar">
|
||||||
<div class="spacer_box_title" style="text-align: center; color: white;"
|
<div class="spacer_box_title" style="text-align: center; color: white;"
|
||||||
i18n="firmwareFlasherWarningHead">
|
i18n="warningTitle">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="spacer" style="margin-bottom: 10px;">
|
<div class="spacer" style="margin-bottom: 10px;">
|
||||||
|
@ -124,4 +124,4 @@
|
||||||
<a class="flash_firmware disabled" href="#progressbar" i18n="firmwareFlasherFlashFirmware"></a>
|
<a class="flash_firmware disabled" href="#progressbar" i18n="firmwareFlasherFlashFirmware"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue