Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions app/telemetry/settings/documentedparam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,12 @@ static std::vector<std::shared_ptr<XParam>> get_parameters_list(){
}

{
std::pair<std::string,int> val1{"10Mhz",10};
std::pair<std::string,int> val2{"20Mhz",20};
std::pair<std::string,int> val3{"40Mhz",40};
std::pair<std::string,int> val1{"5Mhz",5};
std::pair<std::string,int> val2{"10Mhz",10};
std::pair<std::string,int> val3{"20Mhz",20};
std::pair<std::string,int> val4{"40Mhz",40};
append_int(ret,openhd::WB_CHANNEL_WIDTH,
ImprovedIntSetting::createEnumSimple({val1,val2,val3}),
ImprovedIntSetting::createEnumSimple({val1,val2,val3,val4}),
"!!!Editing this param manually without care will result in a broken link!!!"
);
}
Expand Down
7 changes: 0 additions & 7 deletions qml/ui/configpopup/openhd_settings/MavlinkParamEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ Rectangle{
for (var i = 0; i < keys.length; i++) {
var key=keys[i];
var value=values[i];
if(parameterId==="WB_CHANNEL_W" && !settings.dev_allow_40mhz && value===40){
continue;
}
//console.log(key,value);
intEnumDynamicListModel.append({title: key, value: value})
list_index=intEnumDynamicListModel.count-1
Expand Down Expand Up @@ -440,10 +437,6 @@ Rectangle{
}else{
value_int=spinBoxInputParamtypeInt.value
}
if(parameterId==="WB_CHANNEL_W" && value_int===40 && !settings.dev_allow_40mhz){
_qopenhd.show_toast(qsTr("40 MHz is disabled (enable in Advanced Settings)"),true);
return;
}
//var value_int_as_string=spinBoxInputParamtypeInt.text
//var value_int = parseInt(value_int_as_string)
//console.log("UI set int:{"+value_int_as_string+"}={"+value_int+"}")
Expand Down
4 changes: 1 addition & 3 deletions qml/ui/configpopup/openhd_settings/PopupAnalyzeChannels.qml
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ PopupBigGeneric{
frequencies_to_analyze=_frequencyHelper.get_frequencies(1);
}else{
frequencies_to_analyze=_frequencyHelper.get_frequencies(2);
if(settings.dev_allow_40mhz){
frequencies_to_analyze=_frequencyHelper.filter_frequencies_40mhz_ht40plus_only(frequencies_to_analyze);
}
frequencies_to_analyze=_frequencyHelper.filter_frequencies_40mhz_ht40plus_only(frequencies_to_analyze);
}
var categories = _pollutionHelper.pollution_frequencies_int_to_qstringlist(frequencies_to_analyze);
var values = _pollutionHelper.pollution_frequencies_int_get_pollution(frequencies_to_analyze,m_normalize_data);
Expand Down
5 changes: 2 additions & 3 deletions qml/ui/configpopup/openhd_settings/PopupScanChannels.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ PopupBigGeneric{

function rebuild_bandwidth_model(){
model_bandwidth_to_scan.clear();
model_bandwidth_to_scan.append({title: qsTr("5 MHz"), value: 5});
model_bandwidth_to_scan.append({title: qsTr("10 MHz"), value: 10});
model_bandwidth_to_scan.append({title: qsTr("20 MHz"), value: 20});
if(settings.dev_allow_40mhz){
model_bandwidth_to_scan.append({title: qsTr("40 MHz"), value: 40});
}
model_bandwidth_to_scan.append({title: qsTr("40 MHz"), value: 40});
}

function sync_bandwidth_selection(){
Expand Down
13 changes: 0 additions & 13 deletions qml/ui/configpopup/qopenhd_settings/AppDevSettingsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,6 @@ ScrollView {
onCheckedChanged: settings.dev_show_5180mhz_lowband = checked
}
}
SettingBaseElement{
m_short_description: qsTr("Allow 40 MHz channel width")
Switch {
width: 32
height: elementHeight
anchors.rightMargin: Qt.inputMethod.visible ? 96 : 36

anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
checked: settings.dev_allow_40mhz
onCheckedChanged: settings.dev_allow_40mhz = checked
}
}
SettingBaseElement{
m_short_description: qsTr("Disable auto fetch")
Switch {
Expand Down
1 change: 0 additions & 1 deletion qml/ui/elements/AppSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ Settings {
property bool dev_show_advanced_button: false
property bool dev_allow_freq_change_when_armed: false
property bool dev_show_5180mhz_lowband: false
property bool dev_allow_40mhz: false
property bool dev_disable_autofetch: false
// Channel scan bandwidth (used by "Find Air Unit")
property int scan_channel_width_mhz: 20
Expand Down
32 changes: 27 additions & 5 deletions qml/ui/sidebar/EditChannelWidthElement.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,36 @@ BaseJoyEditElement{

property int m_model_index: -1;

property var m_valid_widths: [5, 10, 20, 40]

function get_current_width_index() {
var w = _ohdSystemAir.curr_channel_width_mhz;
for (var i = 0; i < m_valid_widths.length; i++) {
if (m_valid_widths[i] === w) {
return i;
}
}
return -1;
}

m_button_left_activated: {
if(!_ohdSystemAir.is_alive)return false;
return _ohdSystemAir.curr_channel_width_mhz==40;
return get_current_width_index() > 0;
}

m_button_right_activated: {
if(!_ohdSystemAir.is_alive)return false;
return _ohdSystemAir.curr_channel_width_mhz==20;
return get_current_width_index() < (m_valid_widths.length - 1) && get_current_width_index() !== -1;
}

m_displayed_value: {
if(!_ohdSystemAir.is_alive)return "N/A";
var channel_width=_ohdSystemAir.curr_channel_width_mhz
if(channel_width==20){
if(channel_width==5){
return "5Mhz"
}else if(channel_width==10){
return "10Mhz"
}else if(channel_width==20){
return "20Mhz"
}else if(channel_width==40){
return "40Mhz\n(HIGH BW)"
Expand All @@ -47,11 +63,17 @@ BaseJoyEditElement{
}

onChoice_left: {
set_channel_width_async(20);
var idx = get_current_width_index();
if (idx > 0) {
set_channel_width_async(m_valid_widths[idx - 1]);
}
}

onChoice_right: {
set_channel_width_async(40);
var idx = get_current_width_index();
if (idx < (m_valid_widths.length - 1) && idx !== -1) {
set_channel_width_async(m_valid_widths[idx + 1]);
}
}


Expand Down
9 changes: 1 addition & 8 deletions qml/ui/sidebar/MappedMavlinkChoices.qml
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,7 @@ Item {
}
ListModel{
id: elements_model_channel_width
ListElement {value: 10; verbose:"10Mhz"}
ListElement {value: 20; verbose:"20Mhz"}
}
ListModel{
id: elements_model_channel_width_with_40
ListElement {value: 5; verbose:"5Mhz"}
ListElement {value: 10; verbose:"10Mhz"}
ListElement {value: 20; verbose:"20Mhz"}
ListElement {value: 40; verbose:"40Mhz\n(HIGH BW)"}
Expand Down Expand Up @@ -225,9 +221,6 @@ Item {
}
return frequencies_model;
}else if(param_id=="CHANNEL_WIDTH"){
if(settings.dev_allow_40mhz){
return elements_model_channel_width_with_40;
}
return elements_model_channel_width;
}else if(param_id=="RATE"){
return elements_model_rate;
Expand Down
5 changes: 2 additions & 3 deletions qml/ui/sidebar/Panel8FindAirUnit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ SideBarBasePanel{

function rebuildBandwidthModel(){
scanBandwidthModel.clear();
scanBandwidthModel.append({value: 5, verbose: "5 MHz"});
scanBandwidthModel.append({value: 10, verbose: "10 MHz"});
scanBandwidthModel.append({value: 20, verbose: "20 MHz"});
if(settings.dev_allow_40mhz){
scanBandwidthModel.append({value: 40, verbose: "40 MHz"});
}
scanBandwidthModel.append({value: 40, verbose: "40 MHz"});
}

function syncBandwidthIndex(){
Expand Down
20 changes: 20 additions & 0 deletions qml/ui/widgets/WBLinkRateControlWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ BaseWidget {
ret+= " " + qsTr("40 MHz");
}else if(_ohdSystemGround.curr_channel_width_mhz==20){
ret+= " " + qsTr("20 MHz");
}else if(_ohdSystemGround.curr_channel_width_mhz==10){
ret+= " " + qsTr("10 MHz");
}else if(_ohdSystemGround.curr_channel_width_mhz==5){
ret+= " " + qsTr("5 MHz");
}else{
ret += " " + qsTr("N/A");
}
Expand Down Expand Up @@ -318,6 +322,22 @@ BaseWidget {
width: parent.width
height: m_row_height
spacing: 20
Button{
text: qsTr("5 MHz")
onClicked: {
set_channel_width_async(5)
}
highlighted: m_curr_channel_width==5
//enabled: _ohdSystemAir.is_alive;
}
Button{
text: qsTr("10 MHz")
onClicked: {
set_channel_width_async(10)
}
highlighted: m_curr_channel_width==10
//enabled: _ohdSystemAir.is_alive;
}
Button{
text: qsTr("20 MHz")
onClicked: {
Expand Down
Loading