From 3c9c541e31839748d2caac919ace263317992c81 Mon Sep 17 00:00:00 2001 From: Raphael <68374617+raphaelscholle@users.noreply.github.com> Date: Sat, 23 Nov 2024 23:04:55 +0100 Subject: [PATCH] hide new channels when not explicitly enabled --- app/telemetry/settings/frequencyhelper.cpp | 7 +++- app/telemetry/settings/wifi_channel.h | 4 +++ .../openhd_settings/LinkQuickPanel.qml | 32 ++++++++----------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/app/telemetry/settings/frequencyhelper.cpp b/app/telemetry/settings/frequencyhelper.cpp index 327d78e80..90ae7ca97 100644 --- a/app/telemetry/settings/frequencyhelper.cpp +++ b/app/telemetry/settings/frequencyhelper.cpp @@ -20,6 +20,11 @@ QList FrequencyHelper::get_frequencies(int filter) for(auto& channel:tmp){ ret.push_back(channel.frequency); } + }else if(filter==3){ + auto tmp=openhd::get_openhd_channels_licensed(); + for(auto& channel:tmp){ + ret.push_back(channel.frequency); + } }else{ const auto frequency_items=openhd::get_all_channels_2G_5G(); for(auto& item:frequency_items){ @@ -29,7 +34,7 @@ QList FrequencyHelper::get_frequencies(int filter) ret.push_back(item.frequency); } }else{ - if(item.frequency>3000){ + if(item.frequency>=5180 && item.frequency<=5865){ ret.push_back(item.frequency); } } diff --git a/app/telemetry/settings/wifi_channel.h b/app/telemetry/settings/wifi_channel.h index 73bd1c8b8..2acb6c3d4 100644 --- a/app/telemetry/settings/wifi_channel.h +++ b/app/telemetry/settings/wifi_channel.h @@ -282,6 +282,10 @@ static std::vector get_openhd_channels_1_to_7() { std::vector frequencies = {5700, 5745, 5785, 5825, 5865, 5260, 5280}; return frequencies_to_channels(frequencies); } +static std::vector get_openhd_channels_licensed() { + std::vector frequencies = {5080,5100,5120,5140,5160,5905,5925,5945,5965,5985,6005,6025,6045,6065,6085}; + return frequencies_to_channels(frequencies); +} static std::vector filter_ht40plus_only( const std::vector& frequencies) { diff --git a/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml b/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml index e654c5967..e9a68a937 100644 --- a/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml +++ b/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml @@ -5,7 +5,7 @@ import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import QtQuick.Controls.Material 2.12 - + import Qt.labs.settings 1.0 @@ -205,50 +205,44 @@ Rectangle{ // Change the freuquency dialoqueFreqChangeAirGnd.initialize_and_show_frequency(frequency_mhz); } - enabled: _ohdSystemGround.is_alive && _ohdSystemGround.wb_gnd_operating_mode==0; + // enabled: _ohdSystemGround.is_alive && _ohdSystemGround.wb_gnd_operating_mode==0; } - TabBar{ + TabBar { id: filter_tab_bar - width: 350 + width: 350 currentIndex: settings.qopenhd_frequency_filter_selection onCurrentIndexChanged: { - if(currentIndex != settings.qopenhd_frequency_filter_selection){ + if (currentIndex != settings.qopenhd_frequency_filter_selection) { settings.qopenhd_frequency_filter_selection = currentIndex; + console.log("Tab changed to index:", currentIndex); function_rebuild_ui(); - if(currentIndex == 1){ - _qopenhd.show_toast("2.4G is almost always polluted by WiFi. Not recommended."); - } else if(currentIndex == 2){ - _qopenhd.show_toast("Please watch out for wifi pollution. Using DEF is highly recommended!"); - } } } - TabButton{ + TabButton { text: "OpenHD" font.capitalization: Font.MixedCase } - TabButton{ + TabButton { text: "2.4G" enabled: { - if(_ohdSystemAir.is_alive && _ohdSystemAir.ohd_platform_type == 30){ + if (_ohdSystemAir.is_alive && _ohdSystemAir.ohd_platform_type == 30) { // X20 does not support 2.4G return false; } return true; } } - TabButton{ + TabButton { text: "5.8G" } enabled: comboBoxFreq.enabled - TabButton{ + TabButton { text: "Custom" font.capitalization: Font.MixedCase - onClicked: { - settings.qopenhd_frequency_filter_selection = 0; - function_rebuild_ui(); - } + visible: settings.dev_show_5180mhz_lowband } } + /*ButtonIconInfo2{ Layout.alignment: Qt.AlignRight visible:false