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

Finally merge #725 #731

Merged
merged 7 commits into from
Dec 29, 2024
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
11 changes: 0 additions & 11 deletions QOpenHD.pro
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,6 @@ JetsonBuild {
WindowsBuild {
# This aparently makes qt use absolute paths, otherwise we get compile issues ?
QMAKE_PROJECT_DEPTH = 0
#include(app/videostreaming/gstreamer/gst_video.pri)
#include(app/videostreaming/avcodec/avcodec_video.pri)
# Path to FFmpeg headers
# INCLUDEPATH += C:/ffmpeg
#INCLUDEPATH += C:/ffmpeg/libavutil/

# Path to FFmpeg libraries
#LIBS += -LC:/ffmpeg/lib

# Link against the required FFmpeg libraries
#LIBS += -lavcodec -lavformat -lavutil -lswscale -lswresample
}

AndroidBuild {
Expand Down
1 change: 1 addition & 0 deletions app/telemetry/models/aohdsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ void AOHDSystem::process_onboard_computer_status(const mavlink_onboard_computer_
{
set_curr_cpuload_perc(msg.cpu_cores[0]);
set_curr_soc_temp_degree(msg.temperature_core[0]);
set_curr_txc_temp_degree(msg.temperature_core[1]);
// temporary, we repurpose this value
set_curr_cpu_freq_mhz(msg.storage_type[0]);
set_curr_isp_freq_mhz(msg.storage_type[1]);
Expand Down
1 change: 1 addition & 0 deletions app/telemetry/models/aohdsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class AOHDSystem : public QObject
// based on RPI SOC
L_RO_PROP(int,curr_cpuload_perc,set_curr_cpuload_perc,0)
L_RO_PROP(int,curr_soc_temp_degree,set_curr_soc_temp_degree,0)
L_RO_PROP(int,curr_txc_temp_degree,set_curr_txc_temp_degree,0)
L_RO_PROP(int,curr_cpu_freq_mhz,set_curr_cpu_freq_mhz,0)
L_RO_PROP(int,curr_isp_freq_mhz,set_curr_isp_freq_mhz,0)
L_RO_PROP(int,curr_h264_freq_mhz,set_curr_h264_freq_mhz,0)
Expand Down
8 changes: 6 additions & 2 deletions app/telemetry/settings/documentedparam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,18 @@ static std::vector<std::shared_ptr<XParam>> get_parameters_list(){
{"DISABLE",""},
{"DEFAULT","DEFAULT"},
{"/dev/serial0","/dev/serial0"},
{"/dev/ttyAMA1","/dev/ttyAMA1"},
{"/dev/ttyAMA2","/dev/ttyAMA2"},
{"/dev/ttyAMA3","/dev/ttyAMA3"},
{"/dev/ttyAMA4","//dev/ttyAMA4"},
{"/dev/serial1","/dev/serial1"},
{"/dev/ttyS1","/dev/ttyS1"},
{"/dev/ttyS2","/dev/ttyS2"},
{"/dev/ttyUSB0","/dev/ttyUSB0"},
{"/dev/ttyUSB1","/dev/ttyUSB1"},
{"/dev/ttyACM0","/dev/ttyACM0"},
{"/dev/ttyACM1","/dev/ttyACM1"},
{"/dev/ttyS7","/dev/ttyS7"},
{"/dev/ttyAMA4","//dev/ttyAMA4"}
{"/dev/ttyS7","/dev/ttyS7"}
};
append_string(ret,"FC_UART_CONN",ImprovedStringSetting{fc_uart_conn_values},
"Telemetry FC<->Air unit. Make sure FC_UART_BAUD matches your FC. DEFAULT - primary telemetry serial of this platform (see wiki)."
Expand Down
147 changes: 42 additions & 105 deletions app/videostreaming/gstreamer/gst_video.pri
Original file line number Diff line number Diff line change
@@ -1,120 +1,57 @@
# Enable GStreamer QMLGLSink for video rendering
DEFINES += QOPENHD_ENABLE_GSTREAMER_QMLGLSINK
INCLUDEPATH += $$PWD
INCLUDEPATH += C:/ffmpeg/include

# Uncomment for primary video, keep secondary for now
# DEFINES += QOPENHD_GSTREAMER_PRIMARY_VIDEO
DEFINES += QOPENHD_GSTREAMER_SECONDARY_VIDEO
LIBS += -LC:/ffmpeg/lib -lavcodec -lavutil -lavformat
# TODO dirty
LIBS += -lGLESv2 -lEGL

# Sources and headers specific to GStreamer
SOURCES += \
$$PWD/gstqmlglsinkstream.cpp \
$$PWD/gstrtpaudioplayer.cpp \
$$PWD/gstrtpreceiver.cpp

HEADERS += \
$$PWD/gst_helper.hpp \
$$PWD/gstqmlglsinkstream.h \
$$PWD/gstrtpaudioplayer.h \
$$PWD/gstrtpreceiver.h

# Platform-specific configurations
win32 {
INCLUDEPATH += $$PWD/../../../build-libs-windows/ffmpeg/include
LIBS += -L$$PWD/../../../build-libs-windows/ffmpeg/lib -lavcodec -lavutil -lavformat

# Android-specific configuration
android {
message("Configuring GStreamer for Android")
INCLUDEPATH += $$PWD/../../../build-libs-windows/angle-x64/include
LIBS += -L$$PWD/../../../build-libs-windows/angle-x64/bin -lGLESv2 -lEGL

# Define the base directory for the GStreamer prebuilt binaries
DOWNLOADED_GST_FOLDER = $$PWD/../../../lib/gstreamer_prebuilts/gstreamer-1.0-android-universal
DEFINES += EGL_EGLEXT_PROTOTYPES
DEFINES += GL_GLEXT_PROTOTYPES
# LIBS += -lOpengl32
}

# Determine the GStreamer architecture folder based on the target architecture
GSTREAMER_ARCH_FOLDER = armv7
contains(ANDROID_TARGET_ARCH, armeabi-v7a) {
GSTREAMER_ARCH_FOLDER = armv7
} else:contains(ANDROID_TARGET_ARCH, arm64-v8a) {
GSTREAMER_ARCH_FOLDER = arm64
} else:contains(ANDROID_TARGET_ARCH, x86_64) {
GSTREAMER_ARCH_FOLDER = x86_64
} else {
message("Unknown ANDROID_TARGET_ARCH: $$ANDROID_TARGET_ARCH")
GSTREAMER_ARCH_FOLDER = armv7
}
# just using the something something webrtc from stephen was the easiest solution.
#include(../../lib/h264/h264.pri)

# Define the root path for GStreamer
GSTREAMER_ROOT_ANDROID = $$DOWNLOADED_GST_FOLDER/$$GSTREAMER_ARCH_FOLDER
message("GStreamer root for Android: $$GSTREAMER_ROOT_ANDROID")
SOURCES += \
$$PWD/QSGVideoTextureItem.cpp \
$$PWD/gl/gl_shaders.cpp \
$$PWD/gl/gl_videorenderer.cpp \
$$PWD/texturerenderer.cpp \
$$PWD/avcodec_decoder.cpp \

GST_ROOT = $$GSTREAMER_ROOT_ANDROID
HEADERS += \
$$PWD/QSGVideoTextureItem.h \
$$PWD/gl/gl_shaders.h \
$$PWD/gl/gl_videorenderer.h \
$$PWD/texturerenderer.h \
$$PWD/avcodec_decoder.h \

# Check if the GStreamer root directory exists
exists($$GST_ROOT) {
message("Setting up GStreamer for Android build")
QMAKE_CXXFLAGS += -pthread
CONFIG += VideoEnabled

# Link GStreamer libraries
LIBS += -L$$GST_ROOT/lib/gstreamer-1.0 \
-lgstvideo-1.0 -lgstcoreelements -lgstplayback -lgstudp \
-lgstrtp -lgstrtsp -lgstx264 -lgstlibav -lgstsdpelem \
-lgstvideoparsersbad -lgstrtpmanager -lgstisomp4 \
-lgstmatroska -lgstmpegtsdemux -lgstandroidmedia \
-lgstopengl -lgsttcp -lgstapp -lgstalaw -lgstautodetect

LIBS += -L$$GST_ROOT/lib \
-lgraphene-1.0 -ljpeg -lpng16 -lgstfft-1.0 -lm \
-lgstnet-1.0 -lgio-2.0 -lgstphotography-1.0 -lgstgl-1.0 -lEGL \
-lgstaudio-1.0 -lgstcodecparsers-1.0 -lgstbase-1.0 -lgstreamer-1.0 \
-lgstrtp-1.0 -lgstpbutils-1.0 -lgstrtsp-1.0 -lgsttag-1.0 \
-lgstvideo-1.0 -lavformat -lavcodec -lavutil -lx264 -lavfilter \
-lswresample -lgstriff-1.0 -lgstcontroller-1.0 -lgstapp-1.0 \
-lgstsdp-1.0 -lbz2 -lgobject-2.0 -lgstmpegts-1.0 \
-Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lorc-0.4 -liconv -lffi -lintl
# experimental
#INCLUDEPATH += /usr/local/include/uvgrtp
#LIBS += -L/usr/local/lib -luvgrtp

# Include paths for GStreamer
INCLUDEPATH += \
$$GST_ROOT/include/gstreamer-1.0 \
$$GST_ROOT/lib/gstreamer-1.0/include \
$$GST_ROOT/include/glib-2.0 \
$$GST_ROOT/lib/glib-2.0/include
} else {
message("GStreamer prebuilt directory does not exist")
}
# dirty way to check if we are on rpi and therefore should use the external decode service
CONFIG += link_pkgconfig
packagesExist(mmal) {
DEFINES += IS_PLATFORM_RPI
}

# Windows-specific configuration
win32 {
GST_ROOT = c:/gstreamer/1.0/x86_64

exists($$GST_ROOT) {
CONFIG += VideoEnabled

# Link GStreamer libraries for Windows
LIBS += -L$$GST_ROOT/lib -lopengl32

LIBS += -lgstfft-1.0 \
-lgstnet-1.0 -lgio-2.0 \
-lgstaudio-1.0 -lgstcodecparsers-1.0 -lgstbase-1.0 \
-lgstreamer-1.0 -lgstrtp-1.0 -lgstpbutils-1.0 -lgstrtsp-1.0 -lgsttag-1.0 \
-lgstvideo-1.0 \
-lgstriff-1.0 -lgstcontroller-1.0 -lgstapp-1.0 \
-lgstsdp-1.0 -lbz2 -lgobject-2.0 \
-lgstgl-1.0 -lgraphene-1.0 -lpng16 -ljpeg -lgstphotography-1.0 \
-lgmodule-2.0 -lglib-2.0 -lorc-0.4 -lffi -lintl

# Include paths for GStreamer on Windows
INCLUDEPATH += \
$$GST_ROOT/include/gstreamer-1.0 \
$$GST_ROOT/include/glib-2.0 \
$$GST_ROOT/lib/gstreamer-1.0/include \
$$GST_ROOT/lib/glib-2.0/include
} else {
message("GStreamer root directory for Windows does not exist")
}
exists(/usr/local/share/openhd/platform/rock/) {
message(This is a Rock)
DEFINES += IS_PLATFORM_ROCK
} else {
message(This is not a Rock)
}

# Linux-specific configuration
unix:!android {
message("Configuring GStreamer for Linux")

CONFIG += link_pkgconfig
PKGCONFIG += gstreamer-1.0 gstreamer-video-1.0 gstreamer-gl-1.0 gstreamer-app-1.0
}
# can be used in c++, also set to be exposed in qml
DEFINES += QOPENHD_ENABLE_VIDEO_VIA_AVCODEC
2 changes: 1 addition & 1 deletion qml/ui/elements/AppSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Settings {
property double esc_temp_warn: 75
property double esc_temp_caution: 60

property bool show_battery_temp: true
property bool show_battery_temp: false
property bool battery_temp_declutter: false
//samsung 35e has -10 to 60 temp range
property double battery_temp_warn: 60
Expand Down
38 changes: 20 additions & 18 deletions qml/ui/sidebar/MavlinkChoiceElement.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,23 @@ BaseJoyEditElement{
ListElement {value: 200; verbose:"200%"}
}
ListModel{
id: elements_model_exposure
ListElement {value: -3; verbose:"-3"}
ListElement {value: -2; verbose:"-2"}
ListElement {value: -1; verbose:"-1"}
ListElement {value: 0; verbose:"0"}
ListElement {value: 1; verbose:"+1%"}
ListElement {value: 2; verbose:"+2"}
ListElement {value: 3; verbose:"+3"}
id: elements_model_saturation
ListElement {value: 50; verbose:"50%"}
ListElement {value: 75; verbose:"75%"}
ListElement {value: 90; verbose:"90%"}
ListElement {value: 100; verbose:"100%\n(Default)"}
ListElement {value: 110; verbose:"110%"}
ListElement {value: 125; verbose:"125%"}
ListElement {value: 150; verbose:"150%"}
}
ListModel{
id: elements_model_metering
ListElement {value: "centre"; verbose:"center"}
ListElement {value: "spot"; verbose:"spot"}
ListElement {value: "matrix"; verbose:"matrix"}

id: elements_model_contrast
ListElement {value: 50; verbose:"50%"}
ListElement {value: 75; verbose:"75%"}
ListElement {value: 90; verbose:"90%"}
ListElement {value: 100; verbose:"100%\n(Default)"}
ListElement {value: 125; verbose:"125%"}
ListElement {value: 150; verbose:"150%"}
}
ListModel{
id: elements_model_sharpness
Expand Down Expand Up @@ -89,7 +91,7 @@ BaseJoyEditElement{
id: elements_model_air_recording
ListElement {value: 0; verbose:"ALWAYS\nOFF"}
ListElement {value: 1; verbose:"ALWAYS\nON"}
ListElement {value: 2; verbose:"AUTO\n(WHEN ARMED)"}
ListElement {value: 2; verbose:"AUTO\n(WHEN ARMED)"}
}
ListModel{
id: elements_model_hotspot
Expand Down Expand Up @@ -150,10 +152,10 @@ BaseJoyEditElement{
function get_model(){
if(m_param_id=="BRIGHTNESS"){
return elements_model_brightness;
}else if(m_param_id=="EXPOSURE"){
return elements_model_exposure;
}else if(m_param_id=="METERING"){
return elements_model_metering;
}else if(m_param_id=="SATURATION"){
return elements_model_saturation;
}else if(m_param_id=="CONTRAST"){
return elements_model_contrast;
}else if(m_param_id=="SHARPNESS"){
return elements_model_sharpness;
}else if(m_param_id=="ROTATION"){
Expand Down
8 changes: 4 additions & 4 deletions qml/ui/sidebar/MavlinkChoiceElement2.qml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ BaseJoyEditElement2{
}

function open_choices_menu(clickable){
// if(!m_param_exists){
// _qopenhd.show_toast("N/A");
// return;
// }
if(!m_param_exists){
_qopenhd.show_toast("N/A");
return;
}
if(m_settings_model.ui_is_busy){
_qopenhd.show_toast("Busy, please try again later");
return;
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/SOCStatusWidgetAir.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import OpenHD 1.0

SOCStatusWidgetGeneric {
id: airStatusWidget
width: 112
width: 150
height: 24

visible: settings.show_air_status && settings.show_widgets
Expand Down
29 changes: 27 additions & 2 deletions qml/ui/widgets/SOCStatusWidgetGeneric.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import OpenHD 1.0

BaseWidget {
id: airStatusWidget
width: 112
height: 24

visible: settings.show_air_status && settings.show_widgets
Expand All @@ -27,6 +26,8 @@ BaseWidget {
property int m_soc_temperature_deg_warn: m_is_air ? settings.air_status_temp_warn : settings.ground_status_temp_warn
property int m_soc_temperature_deg_caution: m_is_air ? settings.air_status_temp_caution : settings.ground_status_temp_caution

property int m_txc_temperature_deg: m_is_air ? _ohdSystemAir.curr_txc_temp_degree : _ohdSystemGround.curr_txc_temp_degree

// These do not need warning level(s) and are hidden in the action popup
property int m_curr_cpu_freq_mhz: m_is_air ?_ohdSystemAir.curr_cpu_freq_mhz : _ohdSystemGround.curr_cpu_freq_mhz
property int m_curr_isp_freq_mhz: m_is_air ?_ohdSystemAir.curr_isp_freq_mhz : _ohdSystemGround.curr_isp_freq_mhz
Expand Down Expand Up @@ -499,7 +500,7 @@ BaseWidget {
text: Number(m_soc_temperature_deg).toLocaleString(Qt.locale(),
'f', 0) + "°"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.right: temp_transceiver.left
anchors.rightMargin: 0
verticalAlignment: Text.AlignVCenter
font.pixelSize: 14
Expand All @@ -509,5 +510,29 @@ BaseWidget {
style: Text.Outline
styleColor: settings.color_glow
}

Text {
id: temp_transceiver
x: 0
y: 0
width: 36
height: 30
visible: m_txc_temperature_deg > 0
color: m_txc_temperature_deg <= 80 ? "white" : "red"
opacity: bw_current_opacity
text: Number(m_txc_temperature_deg).toLocaleString(Qt.locale(),
'f', 0) + "°"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 2
verticalAlignment: Text.AlignVCenter
font.pixelSize: 14
font.family: settings.font_text
horizontalAlignment: Text.AlignRight
elide: Text.ElideRight
style: Text.Outline
styleColor: settings.color_glow
}

}
}
2 changes: 1 addition & 1 deletion qml/ui/widgets/SOCStatusWidgetGround.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import OpenHD 1.0

SOCStatusWidgetGeneric {
id: groundStatusWidget
width: 112
width: 150
height: 24

visible: settings.show_ground_status && settings.show_widgets
Expand Down
Loading