Skip to content

Commit

Permalink
merge fixes ?! (#623)
Browse files Browse the repository at this point in the history
* improve terminating a bit

* improve terminating a bit

* fix small ui bugs

* move start button to the left

* add big throttle warning to the OSD (can be disabled if wanted)

* Dev release (#618)

* create dev release

* fix x86 packaging

* Update package.sh

* Update package.sh

* Update package.sh

* Update build_package_x86_lunar.yml

* Update AppSettings.qml

* make mjpeg not visible to the user anymore

* more verbose log

* we dont need to include qt charts here

* and no idea how this include (unneccessary) got in here

* temporary comment out charts

* merge everything

* add charts back in, link it

* add charts back in, link it

* install it in the build test

* @thomas- set font pixel size in message box such that it is readable

---------

Co-authored-by: consti10 <[email protected]>
Co-authored-by: Raphael <[email protected]>
  • Loading branch information
3 people authored Nov 24, 2023
1 parent 1de26f7 commit 9baf32f
Show file tree
Hide file tree
Showing 20 changed files with 121 additions and 61 deletions.
1 change: 1 addition & 0 deletions QOpenHD.pro
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ LinuxBuild {
QT +=core quick qml gui \
widgets
QT += opengl
QT += charts

INCLUDEPATH += $$PWD/lib
INCLUDEPATH += $$PWD/app
Expand Down
9 changes: 4 additions & 5 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,16 +390,15 @@ int main(int argc, char *argv[]) {
QtAndroid::hideSplashScreen();
#endif

qDebug() << "Running QML";
qDebug() << "QML loaded";
// Now we start mavlink for the first time
MavlinkTelemetry::instance().start();

QRenderStats::instance().register_to_root_window(engine);

LogMessagesModel::instanceGround().addLogMessage("QOpenHD","running");
const int retval = app.exec();

// Terminating needs a bit of special care due to the singleton usage and threads
qDebug()<<"Terminating";
MavlinkTelemetry::instance().terminate();
return retval;


}
16 changes: 15 additions & 1 deletion app/telemetry/MavlinkTelemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,27 @@ void MavlinkTelemetry::start()
m_heartbeat_thread=std::make_unique<std::thread>(&MavlinkTelemetry::send_heartbeat_loop,this);
}

MavlinkTelemetry::~MavlinkTelemetry()
void MavlinkTelemetry::terminate()
{
// first stop any incoming telemetry
if(m_heartbeat_thread){
m_heartbeat_thread_run=false;
m_heartbeat_thread->join();
m_heartbeat_thread=nullptr;
}
m_udp_connection=nullptr;
m_tcp_connection=nullptr;
// Cleanup those 2 threads
CmdSender::instance().terminate();
XParam::instance().terminate();
qDebug()<<"MavlinkTelemetry::stopped";
}

MavlinkTelemetry::~MavlinkTelemetry()
{
qDebug()<<"MavlinkTelemetry::~() begin";
terminate();
qDebug()<<"MavlinkTelemetry::~() end";
}

MavlinkTelemetry &MavlinkTelemetry::instance()
Expand Down
3 changes: 3 additions & 0 deletions app/telemetry/MavlinkTelemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class MavlinkTelemetry : public QObject
MavlinkTelemetry(QObject *parent = nullptr);
~MavlinkTelemetry();
static MavlinkTelemetry& instance();
// start / terminate needs a bit of care due to singleton usage,
// not clean, but works
void start();
void terminate();
/**
* Send a message to the OHD ground unit. If no connection has been established (yet), this should return immediately.
* The message can be aimed at either the OHD ground unit, the OHD air unit (forwarded by OpenHD) or the FC connected to the
Expand Down
15 changes: 11 additions & 4 deletions app/telemetry/action/impl/cmdsender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ CmdSender::CmdSender()

CmdSender::~CmdSender()
{
m_timeout_thread_run=false;
m_timeout_thread->join();
m_timeout_thread=nullptr;
terminate();
}

void CmdSender::terminate()
{
if(m_timeout_thread){
m_timeout_thread_run=false;
m_timeout_thread->join();
m_timeout_thread=nullptr;
}
}

CmdSender &CmdSender::instance()
Expand Down Expand Up @@ -178,7 +185,7 @@ void CmdSender::send_mavlink_command_long(const mavlink_command_long_t &cmd)

void CmdSender::loop_timeout()
{
while(true){
while(m_timeout_thread_run){
std::this_thread::sleep_for(std::chrono::milliseconds(100));
handle_timeout();
}
Expand Down
1 change: 1 addition & 0 deletions app/telemetry/action/impl/cmdsender.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CmdSender
public:
CmdSender();
~CmdSender();
void terminate();
static CmdSender& instance();
/**
* returns true if this message has been consumed, false otherwise.
Expand Down
15 changes: 11 additions & 4 deletions app/telemetry/action/impl/xparam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ XParam::XParam()

XParam::~XParam()
{
m_timeout_thread_run=false;
m_timeout_thread->join();
m_timeout_thread=nullptr;
terminate();
}

void XParam::terminate()
{
if(m_timeout_thread){
m_timeout_thread_run=false;
m_timeout_thread->join();
m_timeout_thread=nullptr;
}
}

XParam &XParam::instance()
Expand Down Expand Up @@ -400,7 +407,7 @@ void XParam::update_progress_get_all(const RunningParamCmdGetAll &cmd)

void XParam::loop_timeout()
{
while(true){
while(m_timeout_thread_run){
std::this_thread::sleep_for(std::chrono::milliseconds(100));
check_timeout_param_get_all();
check_timeout_param_set();
Expand Down
1 change: 1 addition & 0 deletions app/telemetry/action/impl/xparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class XParam
public:
explicit XParam();
~XParam();
void terminate();
static XParam& instance();
/**
* returns true if this message has been consumed, false otherwise.
Expand Down
5 changes: 4 additions & 1 deletion app/telemetry/settings/documentedparam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ static std::vector<std::shared_ptr<XParam>> get_parameters_list(){
);
}
append_int(ret,"VIDEO_CODEC",
ImprovedIntSetting::createEnum( std::vector<std::string>{"h264","h265","mjpeg"}),
//NOTE: MJPEG has been removed intentionally, since we are going to eventually remove support for it in
//favour of h264
// ,"mjpeg"
ImprovedIntSetting::createEnum( std::vector<std::string>{"h264","h265"}),
"Video codec. If your camera/ground station does not support HW accelerated encoding/decoding of the selected codec,it'l default to SW encode/decode. "
"A reboot (air&ground) is recommended after changing this parameter."
);
Expand Down
4 changes: 3 additions & 1 deletion app/videostreaming/avcodec/avcodec_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void AVCodecDecoder::terminate()
// Wait for everything to cleanup and stop
decode_thread->join();
}
qDebug()<<"Decoding terminated";
}

void AVCodecDecoder::timer_check_settings_changed_callback()
Expand Down Expand Up @@ -158,7 +159,8 @@ void AVCodecDecoder::constant_decode()
}
}
qDebug()<<"Decode stopped,restarting";
std::this_thread::sleep_for(std::chrono::seconds(1));
// wait a bit before starting again, to save CPU
if(!m_should_terminate)std::this_thread::sleep_for(std::chrono::seconds(1));
}
}

Expand Down
2 changes: 1 addition & 1 deletion install_build_dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ PLATFORM_PACKAGES="qml-module-qt-labs-platform"
if [[ "${QTTYPE}" == "custom" ]]; then
apt install -y openhd-qt
else
apt -y install qml-module-qtquick-controls2 libqt5texttospeech5-dev libqt5concurrent5 libqt5core5a libqt5dbus5 libqt5designer5 libqt5gui5 libqt5help5 libqt5location5 libqt5location5-plugins libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediawidgets5 libqt5network5 libqt5opengl5 libqt5opengl5-dev libqt5positioning5 libqt5positioning5-plugins libqt5positioningquick5 libqt5printsupport5 libqt5qml5 libqt5quick5 libqt5quickparticles5 libqt5quickshapes5 libqt5quicktest5 libqt5quickwidgets5 libqt5sensors5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5 libqt5webchannel5 libqt5webkit5 libqt5widgets5 libqt5x11extras5 libqt5xml5 openshot-qt python3-pyqt5 python3-pyqt5.qtopengl python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtgraph qml-module-qt-labs-settings qml-module-qtgraphicaleffects qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick-controls qml-module-qtquick-dialogs qml-module-qtquick-extras qml-module-qtquick-layouts qml-module-qtquick-privatewidgets qml-module-qtquick-shapes qml-module-qtquick-window2 qml-module-qtquick2 qt5-gtk-platformtheme qt5-qmake qt5-qmake-bin qt5-qmltooling-plugins qtbase5-dev qtbase5-dev-tools qtchooser qtdeclarative5-dev qtdeclarative5-dev-tools qtpositioning5-dev qttranslations5-l10n
apt -y install qml-module-qtquick-controls2 libqt5texttospeech5-dev libqt5concurrent5 libqt5core5a libqt5dbus5 libqt5designer5 libqt5gui5 libqt5help5 libqt5location5 libqt5location5-plugins libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediawidgets5 libqt5network5 libqt5opengl5 libqt5opengl5-dev libqt5positioning5 libqt5positioning5-plugins libqt5positioningquick5 libqt5printsupport5 libqt5qml5 libqt5quick5 libqt5quickparticles5 libqt5quickshapes5 libqt5quicktest5 libqt5quickwidgets5 libqt5sensors5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5 libqt5webchannel5 libqt5webkit5 libqt5widgets5 libqt5x11extras5 libqt5xml5 openshot-qt python3-pyqt5 python3-pyqt5.qtopengl python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtgraph qml-module-qt-labs-settings qml-module-qtgraphicaleffects qml-module-qtlocation qml-module-qtpositioning qml-module-qtquick-controls qml-module-qtquick-dialogs qml-module-qtquick-extras qml-module-qtquick-layouts qml-module-qtquick-privatewidgets qml-module-qtquick-shapes qml-module-qtquick-window2 qml-module-qtquick2 qt5-gtk-platformtheme qt5-qmake qt5-qmake-bin qt5-qmltooling-plugins qtbase5-dev qtbase5-dev-tools qtchooser qtdeclarative5-dev qtdeclarative5-dev-tools qtpositioning5-dev qttranslations5-l10n libqt5charts5-dev
fi

# Install platform-specific packages
Expand Down
1 change: 0 additions & 1 deletion qml/ui/configpopup/ConfigPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ Rectangle {
// On localhost, QOpenHD "automatically" connects due to udp localhost method
ConfigPopupSidebarButton{
id: connect_button
visible: !_ohdSystemAir.is_alive && !_ohdSystemGround.is_alive
m_icon_text: "\uf6ff"
m_description_text: "Connect"
m_selection_index: 5
Expand Down
2 changes: 0 additions & 2 deletions qml/ui/configpopup/openhd_settings/LinkQuickPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import OpenHD 1.0
import "../../../ui" as Ui
import "../../elements"

import QtCharts 2.0

// This is an extra screen for changing the frequency / channel width -
// They both need to match !
Rectangle{
Expand Down
14 changes: 3 additions & 11 deletions qml/ui/configpopup/openhd_settings/PopupAnalyzeChannels.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import OpenHD 1.0
import "../../../ui" as Ui
import "../../elements"

import QtCharts 2.0
import QtCharts 2.15

Rectangle{
id: main_background
Expand Down Expand Up @@ -80,7 +80,7 @@ Rectangle{
color: closeButton.hovered ? "darkgrey" : "lightgrey"
}
onClicked: {
if (_ohdSystemGround.is_alive && _ohdSystemGround.wb_gnd_operating_mode == 1) {
if (_ohdSystemGround.is_alive && _ohdSystemGround.wb_gnd_operating_mode == 2) {
_qopenhd.show_toast("STILL ANALYZING, PLEASE WAIT ...");
return;
}
Expand All @@ -90,7 +90,7 @@ Rectangle{
}

RowLayout{
visible:false
visible:true
Layout.alignment: Qt.AlignTop | Qt.AlignRight
ButtonIconInfo{
Layout.alignment: Qt.AlignLeft
Expand Down Expand Up @@ -216,14 +216,6 @@ Rectangle{
}
}
}
/*Button{
anchors.top: pollution_chart.top
anchors.left: pollution_chart.left
text: "ENLARGE"
onClicked: {
m_chart_enlarged = !m_chart_enlarged;
}
}*/
}
// Filler
//Item{
Expand Down
27 changes: 14 additions & 13 deletions qml/ui/configpopup/openhd_settings/PopupScanChannels.qml
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@ Rectangle{
RowLayout{
id:channelSelectorRow
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
ComboBox {
Layout.preferredWidth: 400
Layout.minimumWidth: 100
id: comboBoxWhichFrequencyToScan
model: model_chann_to_scan
textRole: "title"
Material.background: {
(comboBoxWhichFrequencyToScan.currentIndex===0) ? "#2b9848" : "#ffae42"
}
onCurrentIndexChanged: {
}
enabled: _ohdSystemGround.is_alive && _ohdSystemGround.wb_gnd_operating_mode==0
}
Button{
text: "START"
enabled: _ohdSystemGround.is_alive && _ohdSystemGround.wb_gnd_operating_mode==0
Expand All @@ -107,6 +94,20 @@ Rectangle{
}
}
}

ComboBox {
Layout.preferredWidth: 400
Layout.minimumWidth: 100
id: comboBoxWhichFrequencyToScan
model: model_chann_to_scan
textRole: "title"
Material.background: {
(comboBoxWhichFrequencyToScan.currentIndex===0) ? "#2b9848" : "#ffae42"
}
onCurrentIndexChanged: {
}
enabled: _ohdSystemGround.is_alive && _ohdSystemGround.wb_gnd_operating_mode==0
}
ButtonIconInfo{
visible:false
onClicked: {
Expand Down
1 change: 0 additions & 1 deletion qml/ui/configpopup/qopenhd_settings/AppDevSettingsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import QtQuick.Dialogs 1.0
import QtQuick.Controls.Material 2.12
import Qt.labs.settings 1.0
import Qt.labs.folderlistmodel 2.0
import Qt.labs.platform 1.0

import OpenHD 1.0

Expand Down
1 change: 1 addition & 0 deletions qml/ui/elements/AppSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ Settings {
property bool wb_link_rate_control_widget_show_frequency: true
property bool wb_link_rate_control_widget_show_bitrate: true
property bool wb_link_rate_control_widget_show_fec_and_keyframe: true
property bool wb_link_rate_control_widget_show_throttle_warning: true

property bool wb_link_rate_control_widget_show_bitrate_detailed: true

Expand Down
1 change: 1 addition & 0 deletions qml/ui/elements/RestartQOpenHDMessageBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Card {
height:parent.height
leftPadding: 12
rightPadding: 12
font.pixelSize: 14
wrapMode: Text.WordWrap
}
}
Expand Down
1 change: 1 addition & 0 deletions qml/ui/elements/WorkaroundMessageBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Card {
text: _messageBoxInstance.text
leftPadding: 12
rightPadding: 12
font.pixelSize: 14
wrapMode: Text.WordWrap
}
}
Expand Down
Loading

0 comments on commit 9baf32f

Please sign in to comment.