Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev release #625

Merged
merged 8 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_package_x86_lunar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- name: clone QOpenHD
run: |
git clone https://github.com/OpenHD/QOpenHD --recursive
git clone -b ${{ github.ref_name }} https://github.com/OpenHD/QOpenHD --recursive

- name: Install Dependencies
run: |
Expand Down
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
19 changes: 15 additions & 4 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ rm -rf /tmp/qopenhd/*
mkdir -p /tmp/qopenhd/usr/local/bin || exit 1
mkdir -p /tmp/qopenhd/etc/systemd/system || exit 1

ls -a
ls /opt

VER2=$(git rev-parse --short HEAD)


Expand Down Expand Up @@ -56,6 +53,8 @@ PLATFORM_PACKAGES="-d openhd-userland -d libavcodec-dev -d libavformat-dev -d op
else
PLATFORM_PACKAGES="-d qml-module-qtcharts -d gstreamer1.0-gl -d qtgstreamer-plugins-qt5 -d gstreamer1.0-qt5 -d libqt5texttospeech5-dev -d qml-module-qt-labs-platform -d git -d libgstreamer-plugins-base1.0-dev -d gstreamer1.0-plugins-good -d libavcodec-dev -d libavformat-dev -d qml-module-qtquick-controls2 -d libqt5concurrent5 -d libqt5core5a -d libqt5dbus5 -d libqt5gui5 -d libqt5help5 -d libqt5location5 -d libqt5location5-plugins -d libqt5multimedia5 -d libqt5multimedia5-plugins -d libqt5multimediagsttools5 -d libqt5multimediawidgets5 -d libqt5network5 -d libqt5opengl5 -d libqt5opengl5-dev -d libqt5positioning5 -d libqt5positioning5-plugins -d libqt5positioningquick5 -d libqt5printsupport5 -d libqt5qml5 -d libqt5quick5 -d libqt5quickparticles5 -d libqt5quickshapes5 -d libqt5quicktest5 -d libqt5quickwidgets5 -d libqt5sensors5 -d libqt5sql5 -d libqt5sql5-sqlite -d libqt5svg5 -d libqt5test5 -d libqt5webchannel5 -d libqt5webkit5 -d libqt5widgets5 -d libqt5x11extras5 -d libqt5xml5 -d openshot-qt -d python3-pyqt5 -d python3-pyqt5.qtopengl -d python3-pyqt5.qtsvg -d python3-pyqt5.qtwebkit -d python3-pyqtgraph -d qml-module-qt-labs-settings -d qml-module-qtgraphicaleffects -d qml-module-qtlocation -d qml-module-qtpositioning -d qml-module-qtquick-controls -d qml-module-qtquick-dialogs -d qml-module-qtquick-extras -d qml-module-qtquick-layouts -d qml-module-qtquick-privatewidgets -d qml-module-qtquick-shapes -d qml-module-qtquick-window2 -d qml-module-qtquick2 -d qt5-gtk-platformtheme -d qt5-qmake -d qt5-qmake-bin -d qt5-qmltooling-plugins -d qtbase5-dev -d qtbase5-dev-tools -d qtchooser -d qtdeclarative5-dev -d qtdeclarative5-dev-tools -d qtpositioning5-dev -d qttranslations5-l10n"
fi
ls -a release/
echo "here we should have built the file correctly"

cp release/QOpenHD /tmp/qopenhd/usr/local/bin/ || exit 1

Expand Down Expand Up @@ -84,15 +83,20 @@ elif [[ "${PACKAGE_ARCH}" = "arm64" ]]; then
cp rock_qt_eglfs_kms_config.json /tmp/qopenhd/usr/local/share/qopenhd/ || exit 1
fi

VERSION="2.5.3-$(date '+%Y%m%d%H%M')-${VER2}"
VERSION="2.5.2-beta-$(date '+%Y%m%d%H%M')-${VER2}"

ls -a ${TMPDIR}/usr/local/bin
echo "going into packaging stage"

rm ${PACKAGE_NAME}_${VERSION}_${PACKAGE_ARCH}.deb > /dev/null 2>&1
if [[ "${PACKAGE_ARCH}" = "armhf" ]]; then
echo "raspberry pi"
fpm -a ${PACKAGE_ARCH} -s dir -t deb -n ${PACKAGE_NAME} -v ${VERSION} -C ${TMPDIR} \
-p qopenhd_VERSION_ARCH.deb \
--after-install after-install.sh \
${PLATFORM_PACKAGES} || exit 1
elif [[ "${PACKAGE_ARCH}" = "arm64" ]]; then
echo "rockchip"
fpm -a ${PACKAGE_ARCH} -s dir -t deb -n qopenhd_rk3566 -v ${VERSION} -C ${TMPDIR} \
-p qopenhd_rk3566_VERSION_ARCH.deb \
--after-install after-install.sh \
Expand All @@ -111,4 +115,11 @@ elif [[ "${PACKAGE_ARCH}" = "arm64" ]]; then
-p qopenhd_rk3588_VERSION_ARCH.deb \
--after-install after-install.sh \
${PLATFORM_PACKAGES} || exit 1
else
echo "everything else"

fpm -a ${PACKAGE_ARCH} -s dir -t deb -n ${PACKAGE_NAME} -v ${VERSION} -C ${TMPDIR} \
-p qopenhd_VERSION_ARCH.deb \
--after-install after-install.sh \
${PLATFORM_PACKAGES} || exit 1
fi
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
Loading