Merge pull request #1887 from mikeller/hide_factory_band

Hide the 'factory band' VTX table setting for VTX types that do not support it.
10.7.0-preview
Michael Keller 2020-02-23 10:48:57 +13:00 committed by GitHub
commit 3c3ce71d8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 4 deletions

View File

@ -5100,6 +5100,10 @@
"message": "<span class=\"message-negative\">Attention:</span> You need to configure and save FIRST the VTX Table at the bottom before you can make use of the $t(vtxSelectedMode.message) fields.",
"description": "Message to show when the VTX is not supported in the VTX tab"
},
"vtxMessageFactoryBandsNotSupported": {
"message": "<span class=\"message-negative\">Attention:</span> The selected VTX type does not support the 'factory' setting for bands, but some of your bands have this setting. Click '$t(vtxButtonSave.message)' to fix this.",
"description": "Message to show when the configured VTX type does not support factory bands, but one or more of the configured bands are of this type"
},
"vtxMessageVerifyTable": {
"message": "<span class=\"message-negative\">Attention:</span> The values of the VTX Table have been loaded, but not yet stored on the flight controller. You must verify and modify the values to be sure that they are valid and legal in your country and then press the $t(vtxButtonSave.message) button to store them on the flight controller.",
"description": "Message to show when the VTX Table has been loaded from a external source"

View File

@ -3,6 +3,7 @@
TABS.vtx = {
supported: false,
vtxTableSavePending: false,
vtxTableFactoryBandsSupported: false,
MAX_POWERLEVEL_VALUES: 8,
MAX_BAND_VALUES: 8,
MAX_BAND_CHANNELS_VALUES: 8,
@ -195,11 +196,14 @@ TABS.vtx.initialize = function (callback) {
const vtxTableNotConfigured = vtxSupported && VTX_CONFIG.vtx_table_available &&
(VTX_CONFIG.vtx_table_bands === 0 || VTX_CONFIG.vtx_table_channels === 0 || VTX_CONFIG.vtx_table_powerlevels === 0);
TABS.vtx.vtxTableFactoryBandsSupported = VTX_CONFIG.vtx_type === 3;
$(".vtx_supported").toggle(vtxSupported);
$(".vtx_not_supported").toggle(!vtxSupported);
$(".vtx_table_available").toggle(vtxSupported && VTX_CONFIG.vtx_table_available);
$(".vtx_table_not_configured").toggle(vtxTableNotConfigured);
$(".vtx_table_save_pending").toggle(TABS.vtx.vtxTableSavePending);
$(".factory_band").toggle(TABS.vtx.vtxTableFactoryBandsSupported);
// Buttons
$('.clipboard_available').toggle(Clipboard.available && Clipboard.readAvailable);
@ -274,15 +278,19 @@ TABS.vtx.initialize = function (callback) {
$("#vtx_table_channels").val(VTX_CONFIG.vtx_table_channels);
// Populate VTX Table
let hasFactoryBands = false;
for (let i = 1; i <= TABS.vtx.VTXTABLE_BAND_LIST.length; i++) {
$(`#vtx_table_band_name_${i}`).val(TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_name);
$(`#vtx_table_band_letter_${i}`).val(TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_letter);
$(`#vtx_table_band_factory_${i}`).prop("checked",TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_is_factory_band);
$(`#vtx_table_band_factory_${i}`).prop("checked", TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_is_factory_band);
hasFactoryBands = hasFactoryBands || TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_is_factory_band;
for (let j = 1; j <= TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_frequencies.length; j++) {
$(`#vtx_table_band_channel_${i}_${j}`).val(TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_frequencies[j - 1]);
}
}
$(".vtx_table_factory_bands_not_supported").toggle(!TABS.vtx.vtxTableFactoryBandsSupported && hasFactoryBands);
// Actions and other
function frequencyOrBandChannel() {
@ -896,7 +904,7 @@ TABS.vtx.initialize = function (callback) {
TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_number = i;
TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_name = $(`#vtx_table_band_name_${i}`).val();
TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_letter = $(`#vtx_table_band_letter_${i}`).val();
TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_is_factory_band = $(`#vtx_table_band_factory_${i}`).prop('checked');
TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_is_factory_band = TABS.vtx.vtxTableFactoryBandsSupported ? $(`#vtx_table_band_factory_${i}`).prop('checked') : false;
TABS.vtx.VTXTABLE_BAND_LIST[i - 1].vtxtable_band_frequencies = [];
for (let j = 1; j <= VTX_CONFIG.vtx_table_channels; j++) {

View File

@ -20,6 +20,10 @@
<div i18n="vtxMessageTableNotConfigured"/>
</div>
<div class="note vtx_table_factory_bands_not_supported">
<div i18n="vtxMessageFactoryBandsNotSupported"/>
</div>
<div class="columnsWrapper">
<div class="gui_box grey select_mode vtx_supported leftColumn">
@ -296,7 +300,7 @@
<tr class="vtx_table_band_values_title">
<td><span i18n="vtxTableBandTitleName"></span></td>
<td><span i18n="vtxTableBandTitleLetter"></span></td>
<td><span i18n="vtxTableBandTitleFactory"></span></td>
<td class="factory_band"><span i18n="vtxTableBandTitleFactory"></span></td>
</tr>
</table>
</div>
@ -306,7 +310,7 @@
<tr class="vtx_table_band_values">
<td><span class="textspacer field_band_name"><input class="uppercase" type="text" id="vtx_table_band_name" maxlength="8" size="8" /></span></td>
<td><span class="textspacer field_band_letter"><input class="uppercase" type="text" id="vtx_table_band_letter" maxlength="1" size="1" /></span></td>
<td><span class="checkboxspacer"><input id="vtx_table_band_factory" type="checkbox" class="togglesmall" /></span></td>
<td class="factory_band"><span class="checkboxspacer"><input id="vtx_table_band_factory" type="checkbox" class="togglesmall" /></span></td>
<!-- Channels generated here from the templates at the bottom -->
</tr>
</table>