Skip to content

Commit

Permalink
hide new channels when not explicitly enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle committed Nov 23, 2024
1 parent 8c9cb40 commit 3c9c541
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
7 changes: 6 additions & 1 deletion app/telemetry/settings/frequencyhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ QList<int> 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){
Expand All @@ -29,7 +34,7 @@ QList<int> 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);
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/telemetry/settings/wifi_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ static std::vector<WifiChannel> get_openhd_channels_1_to_7() {
std::vector<uint32_t> frequencies = {5700, 5745, 5785, 5825, 5865, 5260, 5280};
return frequencies_to_channels(frequencies);
}
static std::vector<WifiChannel> get_openhd_channels_licensed() {
std::vector<uint32_t> frequencies = {5080,5100,5120,5140,5160,5905,5925,5945,5965,5985,6005,6025,6045,6065,6085};
return frequencies_to_channels(frequencies);
}

static std::vector<WifiChannel> filter_ht40plus_only(
const std::vector<uint32_t>& frequencies) {
Expand Down
32 changes: 13 additions & 19 deletions qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3c9c541

Please sign in to comment.