Skip to content

Commit

Permalink
tx power - whitelist for less confusion, add 720p60 16:9 to drop down…
Browse files Browse the repository at this point in the history
… selector @ivan
  • Loading branch information
Consti10 committed Nov 10, 2023
1 parent 98824a2 commit e884881
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 152 deletions.
10 changes: 10 additions & 0 deletions app/telemetry/settings/documentedparam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,16 @@ static std::map<std::string, void *> 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;
}
Expand Down
282 changes: 137 additions & 145 deletions qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -256,179 +256,171 @@ 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);
if(txpower_armed==0)return false;
return txpower_armed<txpower_disarmed;
}
color: "red"
font.pixelSize: 14
}
Text{
Layout.row: 5
Layout.column: 0
Layout.columnSpan: 3
text: "WARNING: Selecting the wrong manufacturer and applying a tx power can destroy your card !\n";
color: "black"
wrapMode: Text.WordWrap
verticalAlignment: Qt.AlignBottom
font.pixelSize: 14
font.pixelSize: 18
verticalAlignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignHCenter
style: Text.Outline
styleColor: "black"
}
Item{ // Filler
Layout.row: 6
Layout.column: 0
Layout.columnSpan: 3
Layout.fillWidth: true
Layout.fillHeight: true
}
Expand Down
16 changes: 9 additions & 7 deletions qml/ui/widgets/VideoBitrateWidgetGeneric.qml
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ BaseWidget {

ListModel{
id: resolutions_model
ListElement {title: "480p60(16:9)"; value: "848x480@60"}
ListElement {title: "480p60(4:3)"; value: "640x480@60"}
ListElement {title: "720p49(16:9)"; value: "1280x720@49"}
ListElement {title: "720p60(4:3)"; value: "960x720@60"}
ListElement {title: "1080p30(16:9)"; value: "1920x1080@30"}
ListElement {title: "1080p30(4:3)"; value: "1440x1080@30"}
ListElement {title: "1080p49(4:3)"; value: "1440x1080@49"}
ListElement {title: "480p@60fps (4:3)"; value: "640x480@60"}
ListElement {title: "480p@60fps (16:9)"; value: "848x480@60"}
ListElement {title: "720p@49fps (16:9)"; value: "1280x720@49"}
ListElement {title: "720p@60fps (4:3)"; value: "960x720@60"}
ListElement {title: "720p@60fps (16:9)"; value: "1280x720@60"}
ListElement {title: "1080p@30fps (16:9)"; value: "1920x1080@30"}
ListElement {title: "1080p@30fps (4:3)"; value: "1440x1080@30"}
ListElement {title: "1080p@49fps (4:3)"; value: "1440x1080@49"}
}


Expand Down Expand Up @@ -206,6 +207,7 @@ BaseWidget {
const resolution=model.get(currentIndex).value
console.log("Selected resolution: "+resolution);
set_camera_resolution(resolution);
_qopenhd.toast_text("NOTE: OpenHD cannot check if your HW actually supports a given resolution at full frame rate");
}
enabled: _ohdSystemAir.is_alive;
}
Expand Down

0 comments on commit e884881

Please sign in to comment.