Skip to content

Commit

Permalink
document
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Sep 25, 2023
1 parent e6b94b6 commit 339808a
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 26 deletions.
11 changes: 11 additions & 0 deletions app/telemetry/models/wificard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ static std::string wifi_card_type_to_string(const int card_type) {
return "UNKNOWN";
}
}
static QString tx_power_unit_for_card(const int card_type){
std::stringstream ss;
if(card_type==0){
// OpenHD RTL8812AU
return "TPI";
}else if(card_type==1){
return "mW";
}
return " ?mW";
}


WiFiCard::WiFiCard(bool is_air,int card_idx,QObject *parent)
Expand Down Expand Up @@ -96,6 +106,7 @@ void WiFiCard::process_mavlink(const mavlink_openhd_stats_monitor_mode_wifi_card
set_tx_power(msg.tx_power_current);
set_tx_power_armed(msg.tx_power_armed);
set_tx_power_disarmed(msg.tx_power_disarmed);
set_tx_power_unit(tx_power_unit_for_card(msg.card_type));
const bool disconnected=msg.curr_status==1;
if(disconnected){
const auto elapsed=std::chrono::steady_clock::now()-m_last_disconnected_warning;
Expand Down
2 changes: 2 additions & 0 deletions app/telemetry/models/wificard.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class WiFiCard : public QObject
L_RO_PROP(int,packet_loss_perc,set_packet_loss_perc,-1)
L_RO_PROP(bool,is_active_tx,set_is_active_tx,false)
L_RO_PROP(int,tx_power,set_tx_power,-1)
L_RO_PROP(QString,tx_power_unit,set_tx_power_unit,"N/A");
L_RO_PROP(QString,tx_power_current_str,set_tx_power_current_str,"N/A");
L_RO_PROP(int,tx_power_armed,set_tx_power_armed,-1)
L_RO_PROP(int,tx_power_disarmed,set_tx_power_disarmed,-1)
L_RO_PROP(int,n_received_packets_rolling,set_n_received_packets_rolling,0)
Expand Down
15 changes: 10 additions & 5 deletions app/telemetry/settings/documentedparam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,9 @@ static std::vector<std::shared_ptr<XParam>> get_parameters_list(){
"Enable passive mode if you want to use your GCS as a passive listener to an existing openhd air-ground link. E.g. if you want to tune into"
"someone elses openhd link (if encryption is enabled, you need his encryption key) but not interfere with any RC/MAVLINK control."
);
append_int(ret,openhd::WB_VIDEO_ENCRYPTION_ENABLE,
append_int(ret,openhd::WB_DEV_AIR_SET_HIGH_RETRANSMIT_COUNT,
ImprovedIntSetting::createEnumEnableDisable(),
"Enable video encryption - by default, video is not encrypted (only validated) to save CPU performance (Telemetry is always encrypted though)."
"It is recommended to leave video encryption off unless you are using at least RPI 4 on air and are TOTALLY worried about someone listening to your video"
" - even with encryption disabled, it is not easy for an attacker to listen in on your openhd video "
"(and impossible to attack your video due to always on secure packet validation)."
"DEV ONLY - DO NOT TOUCH (LEAVE DISABLED). Sets a wifi param that needs to be investigated."
);
{
// Measurements of @Marcel Essers:
Expand Down Expand Up @@ -488,6 +485,13 @@ static std::vector<std::shared_ptr<XParam>> get_parameters_list(){
}),
"Libcamera exposure value, [-10,10]");
}
append_int(ret,"HIGH_ENCRYPTION",
ImprovedIntSetting::createEnumEnableDisable(),
"Enable ultra secure - but expensive - video encryption - by default, video is not encrypted (only validated) to save CPU performance (Telemetry is always encrypted though)."
"It is recommended to leave video encryption off unless you are using at least RPI 4 on air and are TOTALLY worried about someone listening to your video"
" - even with encryption disabled, it is not easy for an attacker to listen in on your openhd video "
"(and impossible to attack your video due to always on secure packet validation)."
);
append_documented_read_only(ret,"V_CAM_TYPE","Detected camera type");
append_documented_read_only(ret,"V_CAM_SENSOR","Detected camera sensor (might not work)");
append_documented_read_only(ret,"V_CAM_NAME","Detected camera name (might not work)");
Expand Down Expand Up @@ -703,6 +707,7 @@ static std::map<std::string, void *> get_whitelisted_params()
ret[openhd::WB_MCS_INDEX]=nullptr;
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;
//ret[""]=nullptr;
return ret;
}
Expand Down
3 changes: 2 additions & 1 deletion app/telemetry/settings/param_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ static constexpr auto WB_VIDEO_RATE_FOR_MCS_ADJUSTMENT_PERC="WB_V_RATE_PERC"; //
static constexpr auto WB_MAX_FEC_BLOCK_SIZE_FOR_PLATFORM="WB_MAX_D_BZ";
static constexpr auto WB_TX_POWER_MILLI_WATT="TX_POWER_MW";
static constexpr auto WB_TX_POWER_MILLI_WATT_ARMED="TX_POWER_MW_ARM";
static constexpr auto WB_VIDEO_ENCRYPTION_ENABLE="WB_VIDEO_ENCRYPT";
// annoying 16 char settings limit
static constexpr auto WB_RTL8812AU_TX_PWR_IDX_OVERRIDE="TX_POWER_I";
static constexpr auto WB_RTL8812AU_TX_PWR_IDX_ARMED="TX_POWER_I_ARMED";
Expand All @@ -29,6 +28,8 @@ static constexpr auto WB_ENABLE_LDPC="WB_E_LDPC";
static constexpr auto WB_ENABLE_SHORT_GUARD="WB_E_SHORT_GUARD";
static constexpr auto WB_MCS_INDEX_VIA_RC_CHANNEL="MCS_VIA_RC";
static constexpr auto WB_PASSIVE_MODE ="WB_PASSIVE_MODE";
static constexpr auto WB_DEV_AIR_SET_HIGH_RETRANSMIT_COUNT="DEV_HIGH_RETR";


}

Expand Down
10 changes: 5 additions & 5 deletions qml/ui/configpopup/openhd_settings/DialoqueChangeTxPower.qml
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ the card driver and/or the linux kernel doesn't support changing it.");
ListModel{
id: model_rtl8812bu_manufacturer_generic
ListElement {title: "Please select"; value: -1}
ListElement {title: "25mW"; value: 25}
ListElement {title: "100mW"; value: 100}
ListElement {title: "<=300mW"; value: 300}
ListElement {title: "<=1000mW"; value: 1000}
ListElement {title: "<=20000mW"; value: 2000}
ListElement {title: "25mW (maybe)"; value: 25}
ListElement {title: "100mW (maybe)"; value: 100}
ListElement {title: "<=300mW (maybe)"; value: 300}
ListElement {title: "<=1000mW (maybe)"; value: 1000}
ListElement {title: "<=20000mW (maybe)"; value: 2000}
}

function get_model_select_tx_power_index_for_card_chip_type_and_manufacturer(){
Expand Down
26 changes: 13 additions & 13 deletions qml/ui/configpopup/openhd_settings/MavlinkExtraWBParamPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,15 @@ Rectangle{
return "P:"+pollution;
}
function get_text_current_disarmed_armed(pwr_current,pwr_disarmed,pwr_armed){
return "Curr:"+pwr_current+" Arm:"+pwr_armed+" Disarm:"+pwr_disarmed;
var ret= "Curr:"+pwr_current;
if(pwr_armed==0){ // Same power regardless if armed or not
ret += " Armed/Disarmed:"+pwr_disarmed;
}else{
ret +=" Disarm:"+pwr_disarmed;
ret+=" Arm:"+pwr_armed;

}
return ret;
}

function get_text_tx_power(ground){
Expand All @@ -206,16 +214,8 @@ Rectangle{
ret+="No info";
return ret;
}
if(card_type==1){
ret+=get_text_current_disarmed_armed(card.tx_power,card.tx_power_disarmed,card.tx_power_armed);
ret+=" (unitless)"
return ret;
}
ret+=get_text_current_disarmed_armed(card.tx_power,card.tx_power_disarmed,card.tx_power_armed);
ret+=" MW";
if(card_type<=0){
ret+=" (maybe,unreliable)";
}
ret+=" "+card.tx_power_unit
return ret;
}

Expand Down Expand Up @@ -252,7 +252,7 @@ Only enable if you want to quickly change your ground unit's channel width to th
"interference from other stations sending on either of those channels is increased. It also slightly decreases sensitivity. In general, we recommend 40Mhz unless you are flying ultra long range "+
"or in a highly polluted (urban) environment."

property string m_info_text_change_tx_power: "Change GND / AIR TX power. Higher Air TX power results in more range on the downlink (video,telemetry).
property string m_info_text_change_tx_power: "Change GND / AIR TX power. Higher AIR TX power results in more range on the downlink (video,telemetry).
Higher GND TX power results in more range on the uplink (mavlink up). You can set different tx power for armed / disarmed state (requres FC),
but it is not possible to change the TX power during flight (due to the risk of misconfiguration / power outage)."+
" ! OPENHD DOESN'T HAVE ANY RESTRICTIONS ON TX POWER - It is your responsibility to use a tx power allowed in your country. !"
Expand Down Expand Up @@ -542,10 +542,10 @@ the analyze channels feature or experience - [169] 5845Mhz is a good bet in Eur
ColumnLayout{
Layout.fillWidth: true
Text{
text: get_text_tx_power(true)
text: get_text_tx_power(false)
}
Text{
text: get_text_tx_power(false)
text: get_text_tx_power(true)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/LinkDownRSSIWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ BaseWidget {
}
Text {
//Layout.alignment: left
text: "TX PWR Air: "+_wifi_card_air.tx_power;
text: "TX PWR Air: "+_wifi_card_air.tx_power +" "+ _wifi_card_air.tx_power_unit;
color: "white"
font.bold: true
height: parent.height
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/LinkUpRSSIWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ BaseWidget {
}
Text {
//Layout.alignment: left
text: "TX PWR Gnd: "+_wifi_card_gnd0.tx_power;
text: "TX PWR Gnd: "+_wifi_card_gnd0.tx_power+" "+_wifi_card_gnd0.tx_power_unit
color: "white"
font.bold: true
height: parent.height
Expand Down

0 comments on commit 339808a

Please sign in to comment.