From e884881cc0f672b1d12edad8631d9b2bcd67e0cb Mon Sep 17 00:00:00 2001 From: consti10 Date: Fri, 10 Nov 2023 15:32:26 +0100 Subject: [PATCH] tx power - whitelist for less confusion, add 720p60 16:9 to drop down selector @Ivan --- app/telemetry/settings/documentedparam.cpp | 10 + .../openhd_settings/PopupTxPowerEditor.qml | 282 +++++++++--------- qml/ui/widgets/VideoBitrateWidgetGeneric.qml | 16 +- 3 files changed, 156 insertions(+), 152 deletions(-) diff --git a/app/telemetry/settings/documentedparam.cpp b/app/telemetry/settings/documentedparam.cpp index 59b0a48ca..f4fb3fda1 100644 --- a/app/telemetry/settings/documentedparam.cpp +++ b/app/telemetry/settings/documentedparam.cpp @@ -707,6 +707,16 @@ static std::map get_whitelisted_params() ret["CONFIG_BOOT_AIR"]=nullptr; ret[openhd::WB_MAX_FEC_BLOCK_SIZE_FOR_PLATFORM]=nullptr; ret[openhd::WB_DEV_AIR_SET_HIGH_RETRANSMIT_COUNT]=nullptr; + // TX POWER Whitelisted, since they should be changed from the quick wizzard + ret[openhd::WB_TX_POWER_MILLI_WATT]=nullptr; + ret[openhd::WB_TX_POWER_MILLI_WATT_ARMED]=nullptr; + ret[openhd::WB_RTL8812AU_TX_PWR_IDX_OVERRIDE]=nullptr; + ret[openhd::WB_RTL8812AU_TX_PWR_IDX_ARMED]=nullptr; + // STBC / LDPC - Whitelisted, since they should be changed from the quick wizzard + ret[openhd::WB_ENABLE_LDPC]=nullptr; + ret[openhd::WB_ENABLE_STBC]=nullptr; + // Whitelisted since normally it should not be changed / has no effect anyways + ret[openhd::WB_ENABLE_SHORT_GUARD]=nullptr; //ret[""]=nullptr; return ret; } diff --git a/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml b/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml index 8434f0eb7..4a23d3ac3 100644 --- a/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml +++ b/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml @@ -72,7 +72,7 @@ Rectangle{ // Should never show up ! ListModel{ id: model_error - ListElement {title: "ERROR"; value: -1} + ListElement {title: "PLEASE SELECT MANUFACTURER"; value: -1} } ListModel{ @@ -221,7 +221,7 @@ Rectangle{ return _wifi_card_gnd0.tx_power_unit; } - GridLayout{ + ColumnLayout{ id: main_row_layout anchors.fill: parent anchors.leftMargin: m_margin @@ -256,156 +256,157 @@ Rectangle{ } } } - // - Text{ - Layout.row: 1 - Layout.column: 0 - text: "RF CHIP:\n" +get_card_chipset_str() - horizontalAlignment: Qt.AlignHCenter - font.pixelSize: 14 - } - ComboBox { - Layout.row: 1 - Layout.column: 1 - id: comboBoxCardSelectManufacturer - Layout.minimumWidth: 100 - Layout.preferredWidth: 350 - model: get_model_manufacturer_for_chip_type() - textRole: "title" - onCurrentIndexChanged: { - var manufacturer=comboBoxCardSelectManufacturer.model.get(comboBoxCardSelectManufacturer.currentIndex).value; - m_user_selected_card_manufacturer=manufacturer; - } - font.pixelSize: 14 - } - // FILLER - Item{ - Layout.row: 1 - Layout.column: 3 + RowLayout{ Layout.fillWidth: true + Text{ + Layout.minimumWidth: 100 + Layout.preferredWidth: 250 + text: "RF CHIP:\n" +get_card_chipset_str() + horizontalAlignment: Qt.AlignHCenter + font.pixelSize: 14 + } + ComboBox { + id: comboBoxCardSelectManufacturer + Layout.minimumWidth: 100 + Layout.preferredWidth: 350 + model: get_model_manufacturer_for_chip_type() + textRole: "title" + onCurrentIndexChanged: { + var manufacturer=comboBoxCardSelectManufacturer.model.get(comboBoxCardSelectManufacturer.currentIndex).value; + m_user_selected_card_manufacturer=manufacturer; + } + font.pixelSize: 14 + } + // FILLER + Item{ + Layout.row: 1 + Layout.column: 3 + Layout.fillWidth: true + } } - // ---------------- - Text{ - Layout.row: 2 - Layout.column: 0 - text: "DISARMED:\n"+get_current_tx_power_int(1)+" "+get_tx_power_unit(); - Layout.fillWidth: true - horizontalAlignment: Qt.AlignHCenter - font.pixelSize: 14 - } - ComboBox { - Layout.row: 2 - Layout.column: 1 + RowLayout{ Layout.fillWidth: true - Layout.minimumWidth: 100 - Layout.preferredWidth: 350 - id: combo_box_txpower_disarmed - model: get_model_txpower_for_chip_type_manufacturer(false) - textRole: "title" - enabled: m_user_selected_card_manufacturer>=0; - font.pixelSize: 14 - } - Button{ - Layout.row: 2 - Layout.column: 2 - text: "SAVE" - enabled: m_user_selected_card_manufacturer>=0; - onClicked: { - var tx_power_index_or_mw = combo_box_txpower_disarmed.model.get(combo_box_txpower_disarmed.currentIndex).value; - if(tx_power_index_or_mw<0){ - _qopenhd.show_toast("Please select a valid tx power",false); - return; + Text{ + Layout.minimumWidth: 100 + Layout.preferredWidth: 250 + text: "DISARMED:\n"+get_current_tx_power_int(1)+" "+get_tx_power_unit(); + horizontalAlignment: Qt.AlignHCenter + font.pixelSize: 14 + } + ComboBox { + Layout.minimumWidth: 100 + Layout.preferredWidth: 350 + id: combo_box_txpower_disarmed + model: get_model_txpower_for_chip_type_manufacturer(false) + textRole: "title" + enabled: m_user_selected_card_manufacturer>=0; + font.pixelSize: 14 + onActivated: { + console.log("onActivated: index:"+currentIndex+ " level:"+currentValue); } - var is_tx_power_index_unit = get_chipset_type()==0; - var success = _wbLinkSettingsHelper.set_param_tx_power(!m_is_air,is_tx_power_index_unit,false,tx_power_index_or_mw) - if(success==true){ - _qopenhd.show_toast("SUCCESS"); - }else{ - _qopenhd.show_toast("Cannot change TX power, please try again",true); + } + Button{ + text: "SAVE" + enabled: m_user_selected_card_manufacturer>=0; + onClicked: { + var tx_power_index_or_mw = combo_box_txpower_disarmed.model.get(combo_box_txpower_disarmed.currentIndex).value; + if(tx_power_index_or_mw<0){ + _qopenhd.show_toast("Please select a valid tx power",false); + return; + } + var is_tx_power_index_unit = get_chipset_type()==0; + var success = _wbLinkSettingsHelper.set_param_tx_power(!m_is_air,is_tx_power_index_unit,false,tx_power_index_or_mw) + if(success==true){ + _qopenhd.show_toast("SUCCESS"); + }else{ + _qopenhd.show_toast("Cannot change TX power, please try again",true); + } } + font.pixelSize: 14 } - font.pixelSize: 14 - } - ButtonIconInfo{ - Layout.row: 2 - Layout.column: 3 - onClicked: { - _messageBoxInstance.set_text_and_show("TX Power applied when FC is disarmed"); + ButtonIconInfo{ + onClicked: { + _messageBoxInstance.set_text_and_show("TX Power applied when FC is disarmed"); + } } - } - // FILLER - Item{ - Layout.row: 2 - Layout.column: 4 - Layout.fillWidth: true - } - // ---------------- - Text{ - Layout.row: 3 - Layout.column: 0 - text: { - var power_int=get_current_tx_power_int(2); - if(power_int==0) return "ARMED:\nDISABLED"; - return "ARMED:\n"+get_current_tx_power_int(2)+" "+get_tx_power_unit(); + // FILLER + Item{ + Layout.row: 2 + Layout.column: 4 + Layout.fillWidth: true } - Layout.fillWidth: true - horizontalAlignment: Qt.AlignHCenter - font.pixelSize: 14 } - ComboBox { - Layout.row: 3 - Layout.column: 1 + + RowLayout{ Layout.fillWidth: true - Layout.minimumWidth: 100 - Layout.preferredWidth: 350 - id: combo_box_txpower_armed - model: get_model_txpower_for_chip_type_manufacturer(true) - textRole: "title" - enabled: m_user_selected_card_manufacturer>=0; - font.pixelSize: 14 - } - Button{ - Layout.row: 3 - Layout.column: 2 - text: "SAVE" - enabled: m_user_selected_card_manufacturer>=0; - onClicked: { - var tx_power_index_or_mw = combo_box_txpower_armed.model.get(combo_box_txpower_armed.currentIndex).value; - if(tx_power_index_or_mw<0){ - _qopenhd.show_toast("Please select a valid tx power",false); - return; + Text{ + Layout.minimumWidth: 100 + Layout.preferredWidth: 250 + text: { + var power_int=get_current_tx_power_int(2); + if(power_int==0) return "ARMED:\nDISABLED"; + return "ARMED:\n"+get_current_tx_power_int(2)+" "+get_tx_power_unit(); } - var is_tx_power_index_unit = get_chipset_type()==0; - var success = _wbLinkSettingsHelper.set_param_tx_power(!m_is_air,is_tx_power_index_unit,true,tx_power_index_or_mw) - if(success==true){ - _qopenhd.show_toast("SUCCESS"); - }else{ - _qopenhd.show_toast("Cannot change TX power, please try again",true); + horizontalAlignment: Qt.AlignHCenter + font.pixelSize: 14 + } + ComboBox { + Layout.minimumWidth: 100 + Layout.preferredWidth: 350 + id: combo_box_txpower_armed + model: get_model_txpower_for_chip_type_manufacturer(true) + textRole: "title" + enabled: m_user_selected_card_manufacturer>=0; + font.pixelSize: 14 + } + Button{ + Layout.row: 3 + Layout.column: 2 + text: "SAVE" + enabled: m_user_selected_card_manufacturer>=0; + onClicked: { + var tx_power_index_or_mw = combo_box_txpower_armed.model.get(combo_box_txpower_armed.currentIndex).value; + if(tx_power_index_or_mw<0){ + _qopenhd.show_toast("Please select a valid tx power",false); + return; + } + var is_tx_power_index_unit = get_chipset_type()==0; + var success = _wbLinkSettingsHelper.set_param_tx_power(!m_is_air,is_tx_power_index_unit,true,tx_power_index_or_mw) + if(success==true){ + _qopenhd.show_toast("SUCCESS"); + }else{ + _qopenhd.show_toast("Cannot change TX power, please try again",true); + } } + font.pixelSize: 14 } - font.pixelSize: 14 - } - ButtonIconInfo{ - Layout.row: 3 - Layout.column: 3 - onClicked: { - _messageBoxInstance.set_text_and_show("TX Power applied when FC is armed. By default, set to 0 (DISABLE) which means the same tx power (tx power disarmed) is applied regardless"+ - "if armed or not."); + ButtonIconInfo{ + Layout.row: 3 + Layout.column: 3 + onClicked: { + _messageBoxInstance.set_text_and_show("TX Power applied when FC is armed. By default, set to 0 (DISABLE) which means the same tx power (tx power disarmed) is applied regardless"+ + "if armed or not."); + } } } + Text{ - Layout.row: 4 - Layout.column: 0 - text: "CURRENT:\n"+get_current_tx_power_int(0)+" "+get_tx_power_unit(); + Layout.fillWidth: true + Layout.minimumHeight: 50 + text: "WARNING: Selecting the wrong manufacturer and applying a tx power\n can destroy your card !\n"; + color: "red" + //style: Text.Outline + //styleColor: "black" + wrapMode: Text.WordWrap + font.pixelSize: 18 + verticalAlignment: Qt.AlignVCenter horizontalAlignment: Qt.AlignHCenter - font.pixelSize: 14 } Text{ - Layout.row: 4 - Layout.column: 1 - Layout.columnSpan: 2 + Layout.fillWidth: true text: "WARNING: ARMING WILL REDUCE YOUR TX POWER" + //visible: true visible: { var txpower_disarmed=get_current_tx_power_int(1); var txpower_armed=get_current_tx_power_int(2); @@ -413,22 +414,13 @@ Rectangle{ return txpower_armed