diff --git a/app/telemetry/models/wificard.cpp b/app/telemetry/models/wificard.cpp index 5ebb11c5e..1f3ba7669 100644 --- a/app/telemetry/models/wificard.cpp +++ b/app/telemetry/models/wificard.cpp @@ -139,6 +139,7 @@ void WiFiCard::process_mavlink(const mavlink_openhd_stats_monitor_mode_wifi_card bool supported = false; if(card_type==0 || card_type==1)supported=true; set_card_type_supported(supported); + set_card_sub_type(msg.dummy2); } int WiFiCard::helper_get_gnd_curr_best_rssi() diff --git a/app/telemetry/models/wificard.h b/app/telemetry/models/wificard.h index b69618947..24c73f1cc 100644 --- a/app/telemetry/models/wificard.h +++ b/app/telemetry/models/wificard.h @@ -34,6 +34,9 @@ class WiFiCard : public QObject L_RO_PROP(int,card_type_supported,set_card_type_supported,false) // exta L_RO_PROP(int,card_sub_type,set_card_sub_type,-1) +public: + L_RO_PROP(int,mWIFI_CARD_SUB_TYPE_RTL8812AU_ASUS,unused_WIFI_CARD_SUB_TYPE_RTL8812AU_ASUS,1) + L_RO_PROP(int,mWIFI_CARD_SUB_TYPE_RTL8812AU_X20,unused_WIFI_CARD_SUB_TYPE_RTL8812AU_X20,2) public: explicit WiFiCard(bool is_air,int card_idx,QObject *parent = nullptr); static constexpr int N_CARDS=4; diff --git a/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml b/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml index 69e66baf0..d4ed27fb8 100644 --- a/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml +++ b/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml @@ -43,21 +43,31 @@ PopupBigGeneric{ _messageBoxInstance.set_text_and_show("Changing tx power is only possible on openhd supported cards."); return; } - // The user has to enter the card type every time - otherwise, we have issues with air and ground - comboBoxCardSelectManufacturer.currentIndex=0; - combo_box_txpower_disarmed.currentIndex=0; - combo_box_txpower_armed.currentIndex=0; + comboBoxCardSelectManufacturer.model= get_model_manufacturer_for_chip_type() const card_sub_type=m_is_air ? _wifi_card_air.card_sub_type : _wifi_card_gnd0.card_sub_type - if(card_sub_type==10){ - // rtl8812 x20 + if(card_sub_type==_wifi_card_air.mWIFI_CARD_SUB_TYPE_RTL8812AU_ASUS){ + // rtl8812 ASUS m_user_selected_card_manufacturer=2; m_card_type_provided_by_openhd=true; + }else if(card_sub_type==_wifi_card_air.mWIFI_CARD_SUB_TYPE_RTL8812AU_X20){ + // rtl8812 x20 + m_user_selected_card_manufacturer=3; + m_card_type_provided_by_openhd=true; }else{ - // User has to set the card type ... + // we don't know the card type .. user has to set it m_user_selected_card_manufacturer=-1; m_card_type_provided_by_openhd=false; } + // The user has to enter the card type every time - otherwise, we have issues with air and ground + if(m_user_selected_card_manufacturer>=0){ + comboBoxCardSelectManufacturer.currentIndex=m_user_selected_card_manufacturer; + }else{ + comboBoxCardSelectManufacturer.currentIndex=0; + } + combo_box_txpower_disarmed.currentIndex=0; + combo_box_txpower_armed.currentIndex=0; + visible=true; enabled=true; } @@ -74,19 +84,10 @@ PopupBigGeneric{ return _wifi_card_gnd0.card_type; } - function get_card_chipset_str(){ - var chipset=get_chipset_type(); - if(chipset==0){ - return "RTL88XXAU"; - }else if(chipset==1){ - return "RTL88XXBU"; - } - return "ERROR"; - } // Should never show up ! ListModel{ - id: model_error - ListElement {title: "Not Enabled"; value: -1} + id: model_manufacturer_unknown_chipset + ListElement {title: "Unknown chipset"; value: -1} } ListModel{ @@ -111,7 +112,7 @@ PopupBigGeneric{ }else if(chip_type==1){ return model_rtl8812bu_manufacturers; } - return model_error; + return model_manufacturer_unknown_chipset; } // TX power choices for each chipset / manufacturer @@ -184,7 +185,7 @@ PopupBigGeneric{ var chip_type=get_chipset_type(); var manufacturer=m_user_selected_card_manufacturer; if(manufacturer<0){ - return model_error; + return model_manufacturer_unknown_chipset; } var ret; if(chip_type==0){ @@ -263,7 +264,7 @@ PopupBigGeneric{ id: comboBoxCardSelectManufacturer Layout.minimumWidth: 180 Layout.preferredWidth: 480 - model: get_model_manufacturer_for_chip_type() + model: model_manufacturer_unknown_chipset textRole: "title" onCurrentIndexChanged: { var manufacturer = comboBoxCardSelectManufacturer.model.get(comboBoxCardSelectManufacturer.currentIndex).value;