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

Merge pull request #1615 from IvoFPV/vtx-warning

Add warning if Smartaudio port assigned and VTX table not set up
This commit is contained in:
Michael Keller 2019-09-07 12:30:03 +12:00 committed by GitHub
commit 2ba51a8019
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 1 deletions

View file

@ -1373,6 +1373,9 @@
"portsHelp": {
"message": "<strong>Note:</strong> not all combinations are valid. When the flight controller firmware detects this the serial port configuration will be reset."
},
"portsVtxTableNotSet": {
"message": "<span class=\"message-negative\">WARNING:</span> The VTX table has not been set up correctly and without it VTX control will not be possible. Please set up the VTX table in $t(tabVtx.message) tab."
},
"portsMSPHelp": {
"message": "<strong>Note:</strong> Do <span class=\"message-negative\">NOT</span> disable MSP on the first serial port unless you know what you are doing. You may have to reflash and erase your configuration if you do."
},

View file

@ -111,7 +111,13 @@ TABS.ports.initialize = function (callback, scrollPosition) {
load_configuration_from_fc();
function load_configuration_from_fc() {
MSP.send_message(MSPCodes.MSP_CF_SERIAL_CONFIG, false, false, on_configuration_loaded_handler);
if(semver.gte(CONFIG.apiVersion, "1.42.0")) {
MSP.promise(MSPCodes.MSP_VTX_CONFIG).then(function() {
return MSP.send_message(MSPCodes.MSP_CF_SERIAL_CONFIG, false, false, on_configuration_loaded_handler);
});
} else {
MSP.send_message(MSPCodes.MSP_CF_SERIAL_CONFIG, false, false, on_configuration_loaded_handler);
}
function on_configuration_loaded_handler() {
$('#content').load("./tabs/ports.html", on_tab_loaded_handler);
@ -273,6 +279,30 @@ TABS.ports.initialize = function (callback, scrollPosition) {
ports_e.find('tbody').append(port_configuration_e);
}
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
var vtxTableNotConfigured = VTX_CONFIG.vtx_table_available &&
(VTX_CONFIG.vtx_table_bands == 0 ||
VTX_CONFIG.vtx_table_channels == 0 ||
VTX_CONFIG.vtx_table_powerlevels == 0);
const pheripheralsSelectElement = $('select[name="function-peripherals"]');
pheripheralsSelectElement.change(function() {
let vtxControlSelected = false;
pheripheralsSelectElement.each(function() {
const el = $(this);
if (el.val() == "TBS_SMARTAUDIO" || el.val() == "IRC_TRAMP") {
vtxControlSelected = true;
}
});
if (vtxControlSelected && vtxTableNotConfigured) {
$('.vtxTableNotSet').show();
} else {
$('.vtxTableNotSet').hide();
}
});
pheripheralsSelectElement.change();
} else {
$('.vtxTableNotSet').hide();
}
}
function on_tab_loaded_handler() {

View file

@ -11,6 +11,11 @@
<p i18n="portsMSPHelp"></p>
</div>
</div>
<div class="note vtxTableNotSet spacebottom">
<div class="note_spacer">
<p i18n="portsVtxTableNotSet"></p>
</div>
</div>
<table class="ports spacebottom">
<thead>
<tr>