diff --git a/app/adsb/adsbvehiclemanager.cpp b/app/adsb/adsbvehiclemanager.cpp index dd0ddb461..5ab17dd70 100644 --- a/app/adsb/adsbvehiclemanager.cpp +++ b/app/adsb/adsbvehiclemanager.cpp @@ -28,14 +28,12 @@ #include -static ADSBVehicleManager* _instance = nullptr; ADSBVehicleManager* ADSBVehicleManager::instance() { - if ( _instance == nullptr ) { - _instance = new ADSBVehicleManager(); - } - return _instance; + // This is the only required c++ code for a thread safe singleton + static ADSBVehicleManager instance{}; + return &instance; } ADSBVehicleManager::ADSBVehicleManager(QObject *parent) : QObject(parent) @@ -191,6 +189,7 @@ void ADSBapi::run(void) void ADSBapi::init(void) { QNetworkAccessManager * manager = new QNetworkAccessManager(this); + //qDebug()<<"isStrictTransportSecurityEnabled:"<<(manager->isStrictTransportSecurityEnabled() ? "Y" : "N"); m_manager = manager; @@ -222,6 +221,7 @@ void ADSBInternet::requestData(void) { _adsb_enable = _settings.value("adsb_enable").toBool(); _adsb_show_internet_data = _settings.value("adsb_show_internet_data").toBool(); max_distance = _settings.value("adsb_radius").toInt(); + QObject::connect(m_manager, SIGNAL(sslErrors(QNetworkReply*,QList)), this, SLOT(dirty_onSslError(QNetworkReply*, QList))); QString distance_string = QString::number(max_distance/1852); // convert meters to NM for api @@ -229,6 +229,7 @@ void ADSBInternet::requestData(void) { if (!_adsb_enable || !_adsb_show_internet_data) { return; } + // TODO - http instead of https ? adsb_url="https://api.airplanes.live/v2/point/"+ lat_string +"/"+ lon_string + "/" + distance_string; QNetworkRequest request; QUrl api_request = adsb_url; @@ -254,9 +255,15 @@ void ADSBInternet::processReply(QNetworkReply *reply) { reply->deleteLater(); return; } + if(!reply->isFinished()){ + qDebug()<<"We should only get finished replies"; + } + QJsonParseError errorPtr; QByteArray data = reply->readAll(); + //qDebug()<<"Len:"<bytesAvailable(); + //qDebug()<<"URL was:"<request().url(); QJsonDocument doc = QJsonDocument::fromJson(data, &errorPtr); if (doc.isNull()) { @@ -415,6 +422,13 @@ void ADSBInternet::processReply(QNetworkReply *reply) { reply->deleteLater(); } +void ADSBInternet::dirty_onSslError(QNetworkReply *reply, QList errors) +{ + // Consti10: Dang openssl - just ignore all SSL errors ! + //qDebug()<<"got some ssl errors"; + reply->ignoreSslErrors(); +} + ADSBSdr::ADSBSdr() : ADSBapi() { diff --git a/app/adsb/adsbvehiclemanager.h b/app/adsb/adsbvehiclemanager.h index f01a8165a..f186b9c13 100644 --- a/app/adsb/adsbvehiclemanager.h +++ b/app/adsb/adsbvehiclemanager.h @@ -81,8 +81,8 @@ class ADSBInternet: public ADSBapi { private slots: void processReply(QNetworkReply *reply) override; + void dirty_onSslError(QNetworkReply* reply, QList errors); void requestData() override; - private: bool _adsb_show_internet_data; }; diff --git a/app/telemetry/settings/documentedparam.cpp b/app/telemetry/settings/documentedparam.cpp index 2f7b9aa3d..188a3cf3a 100644 --- a/app/telemetry/settings/documentedparam.cpp +++ b/app/telemetry/settings/documentedparam.cpp @@ -189,12 +189,21 @@ static std::vector> get_parameters_list(){ }), "!!!Editing this param manually without care will result in a broken link!!!" ); - append_int(ret,openhd::WB_MCS_INDEX_VIA_RC_CHANNEL, - ImprovedIntSetting::createEnum({"Disable","Channel 1","CHannel 2","Channel 3","Channel 4","Channel 5", - "Channel 6","Channel 7","Channel 8","Channel 9","Channel 10"}), - "Dynamically change the MCS Index (Trade range <-> image quality (bitrate)) during flight using your RC and a specific channel " - "(similar to how flight modes work)." - ); + { + std::vector disable_or_channels{"Disable","Channel 1","CHannel 2","Channel 3","Channel 4","Channel 5", + "Channel 6","Channel 7","Channel 8","Channel 9","Channel 10"}; + append_int(ret,openhd::WB_MCS_INDEX_VIA_RC_CHANNEL, + ImprovedIntSetting::createEnum(disable_or_channels), + "Dynamically change the MCS Index (Trade range <-> image quality (bitrate)) during flight using your RC and a specific channel " + "(similar to how flight modes work)." + ); + append_int(ret,openhd::WB_BW_VIA_RC_CHANNEL, + ImprovedIntSetting::createEnum(disable_or_channels), + "Dynamically change the BW via RC. NOT ALWAYS SAFE TO USE !" + ); + + } + append_only_documented(ret,openhd::WB_FREQUENCY,"!!!Editing this param manually without care will result in a broken link!!!"); { auto default_values=std::vector{ diff --git a/app/telemetry/settings/param_names.h b/app/telemetry/settings/param_names.h index 9278fbd53..210081a49 100644 --- a/app/telemetry/settings/param_names.h +++ b/app/telemetry/settings/param_names.h @@ -27,6 +27,7 @@ static constexpr auto WB_ENABLE_STBC="WB_E_STBC"; 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_BW_VIA_RC_CHANNEL = "BW_VIA_RC"; static constexpr auto WB_PASSIVE_MODE ="WB_PASSIVE_MODE"; static constexpr auto WB_DEV_AIR_SET_HIGH_RETRANSMIT_COUNT="DEV_HIGH_RETR"; diff --git a/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml b/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml index 01fbf0fd6..197ecd781 100644 --- a/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml +++ b/qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml @@ -236,7 +236,7 @@ Rectangle{ Layout.alignment: Qt.AlignRight visible:false onClicked: { - var text="Please select a channel / frequency free of noise and interference. The current loss / pollution / throttle stats below can help,"+ + var text="Please select a channel / frequency free of noise and interference. The current loss / pollution stats below can help,"+ "as well as the analyze channels feature or a frequency analyzer on your phone. DEF: Show OpenHD standard channels [1-5] only - they "+ " often are free of wifi pollution and should be used." _messageBoxInstance.set_text_and_show(text) @@ -315,6 +315,18 @@ Rectangle{ font.pixelSize: settings.qopenhd_general_font_pixel_size } Text{ + width: m_small_width + height: m_small_height + text: { + return "TX ERRORS:\n"+_cameraStreamModelPrimary.total_n_tx_dropped_frames + } + color: _ohdSystemGround.wb_link_curr_foreign_pps > 20 ? "red" : "black" + verticalAlignment: Qt.AlignVCenter + horizontalAlignment: Qt.AlignHCenter + font.bold: false + font.pixelSize: settings.qopenhd_general_font_pixel_size + } + /*Text{ width: m_small_width height: m_small_height text: { @@ -333,24 +345,6 @@ Rectangle{ horizontalAlignment: Qt.AlignHCenter font.bold: false font.pixelSize: settings.qopenhd_general_font_pixel_size - } - /*Item{ // FILLER - Layout.fillWidth: true - }*/ - /*ButtonIconInfo{ - onClicked: { - var text="High Loss / Pollution / active throttle hint at a polluted channel." - _messageBoxInstance.set_text_and_show(text) - } - } - ButtonIconWarning{ - visible: (_ohdSystemGround.curr_rx_packet_loss_perc > 5 || _ohdSystemGround.wb_link_curr_foreign_pps > 20 || _ohdSystemAir.curr_n_rate_adjustments > 0) - onClicked: { - var text="On the bench, if you encounter issues like a high loss , high pollution or throttling, make sure:\n"+ - "1) You are using a channel free of noise and interference (OHD channel 1-5 are a good bet)\n"+ - "2) (RARELY,RTL8812AU only): Your TX card(s) aren't overamplifying the signal and have adequate cooling."; - _messageBoxInstance.set_text_and_show(text) - } }*/ } } diff --git a/qml/ui/widgets/WBLinkRateControlWidget.qml b/qml/ui/widgets/WBLinkRateControlWidget.qml index d43a140c0..5a3866f9a 100644 --- a/qml/ui/widgets/WBLinkRateControlWidget.qml +++ b/qml/ui/widgets/WBLinkRateControlWidget.qml @@ -40,7 +40,7 @@ BaseWidget { property int m_curr_mcs_index: _ohdSystemAir.curr_mcs_index property int m_curr_bitrate_kbits: _ohdSystemAir.curr_bitrate_kbits - property int m_curr_fine_adjustments: _ohdSystemAir.curr_n_rate_adjustments + //property int m_curr_fine_adjustments: _ohdSystemAir.curr_n_rate_adjustments property int m_curr_fec_perc: _cameraStreamModelPrimary.curr_fec_percentage property int m_curr_keyframe_i: _cameraStreamModelPrimary.curr_keyframe_interval @@ -111,8 +111,8 @@ BaseWidget { } var ret=bitrate_kbits_readable(m_curr_bitrate_kbits); //if(m_curr_fine_adjustments>0){ - var fine_readable="-"+m_curr_fine_adjustments; - ret+=fine_readable; + // var fine_readable="-"+m_curr_fine_adjustments; + // ret+=fine_readable; //} ret += (" ["+m_curr_mcs_index+"]"); return ret; @@ -276,7 +276,7 @@ Make the video more stable (less microfreezes) on the cost of less image quality onCheckedChanged: settings.wb_link_rate_control_widget_show_fec_and_keyframe = checked } } - Item { + /*Item { width: parent.width height: 32 Text { @@ -296,7 +296,7 @@ Make the video more stable (less microfreezes) on the cost of less image quality checked: settings.wb_link_rate_control_widget_show_throttle_warning onCheckedChanged: settings.wb_link_rate_control_widget_show_throttle_warning = checked } - } + }*/ Item { @@ -480,7 +480,7 @@ Make the video more stable (less microfreezes) on the cost of less image quality styleColor: settings.color_glow visible: settings.wb_link_rate_control_widget_show_fec_and_keyframe } - Text{ + /*Text{ width: parent.width height: 14 color: settings.color_warn @@ -497,7 +497,7 @@ Make the video more stable (less microfreezes) on the cost of less image quality } return ""; } - } + }*/ } } diff --git a/qml/ui/widgets/map/MapWidgetForm.ui.qml b/qml/ui/widgets/map/MapWidgetForm.ui.qml index 2021bd20c..8f893904c 100644 --- a/qml/ui/widgets/map/MapWidgetForm.ui.qml +++ b/qml/ui/widgets/map/MapWidgetForm.ui.qml @@ -311,11 +311,12 @@ BaseWidget { anchors.left: parent.left verticalAlignment: Text.AlignVCenter } + // Consti10: I think this is in metres NewSlider { orientation: Qt.Horizontal - from: 5000 + from: (5*1000) value: settings.adsb_radius - to: 50000 + to: (100*1000) stepSize: 1000 height: parent.height anchors.rightMargin: 0