Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.5-evo' into consti-dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/telemetry/MavlinkTelemetry.cpp
  • Loading branch information
Consti10 committed Feb 6, 2024
2 parents 303a507 + 67b8fd0 commit bd0a7ae
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
modules: 'qtcharts'

# - name: Install create-dmg
# run: brew install create-dmg
Expand All @@ -31,6 +33,7 @@ jobs:
# Build your program with the given configuration
run: |
qmake CONFIG+=release QOpenHD.pro
make -j2
- name: Upload to Github
Expand Down
1 change: 1 addition & 0 deletions QOpenHD.pro
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ iOSBuild {
}

MacBuild {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15
QMAKE_INFO_PLIST = mac/Info.plist
ICON = $${BASEDIR}/icons/macos.icns
DISTFILES += mac/Info.plist
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ We have a CI setup that checks compilation on Ubuntu. You can review the steps i
1. Install Qt using the [Qt online installer](https://www.qt.io/download-qt-installer).
2. Have it download Qt 5.15.0+ for Linux.
3. Install GStreamer development packages from the package manager (e.g., on Ubuntu, run `apt install gstreamer1.0-gl libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev gstreamer1.0-plugins-good libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-qt`).
3. Install GStreamer development packages from the package manager (e.g., on Ubuntu, run `apt install gstreamer1.0-gl libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev gstreamer1.0-plugins-good libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-qt libxcb-cursor0`).
4. Clone the source code as mentioned earlier.
### Manual via qmake
Expand Down
2 changes: 1 addition & 1 deletion android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="com.openhd.openhd" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="v14" android:versionCode="14" android:installLocation="auto">
<manifest package="com.openhd.openhd" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="v15" android:versionCode="15" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33"/>

<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Expand Down
14 changes: 7 additions & 7 deletions app/common/openhd-util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <sstream>
#include <memory>

#ifdef __linux__
#if defined(__linux__) || defined(__macos__)
#include <arpa/inet.h>
#include <netinet/in.h>
#endif // __linux__
#endif // __linux__ || __macos__


namespace OHDUtil {
Expand All @@ -27,7 +27,7 @@ namespace OHDUtil {
* NOTE: Used to use boost, there were issues with that, I changed it to use c standard library.
*/
static bool run_command(const std::string &command, const std::vector<std::string> &args,bool print_debug=true) {
#ifdef __linux__
#if defined(__linux__) || defined(__macos__)
std::stringstream ss;
ss << command;
for (const auto &arg: args) {
Expand All @@ -51,7 +51,7 @@ static bool run_command(const std::string &command, const std::vector<std::strin
}
return ret;
#else
std::cerr<<"run_command only supported on linux\n";
std::cerr<<"run_command only supported on linux and macos\n";
return false;
#endif
}
Expand All @@ -67,7 +67,7 @@ static bool run_command(const std::string &command, const std::vector<std::strin
*/

static std::optional<std::string> run_command_out(const char* command){
#ifdef __linux__
#if defined(__linux__) || defined(__macos__)
std::string raw_value;
std::array<char, 512> buffer{};
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(command, "r"), pclose);
Expand All @@ -83,7 +83,7 @@ static std::optional<std::string> run_command_out(const char* command){
}
return raw_value;
#else
std::cerr<<"run_command only supported on linux\n";
std::cerr<<"run_command only supported on linux and macos\n";
return std::nullopt;
#endif
}
Expand All @@ -93,7 +93,7 @@ static std::string yes_or_no(bool yes){
}

static bool is_valid_ip(const std::string& ip) {
#ifdef __linux__
#if defined(__linux__) || defined(__macos__)
unsigned char buf[sizeof(struct in6_addr)];
auto result = inet_pton(AF_INET, ip.c_str(), buf);
return result == 1;
Expand Down
4 changes: 2 additions & 2 deletions app/telemetry/models/aohdsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ void AOHDSystem::update_alive()
// come through, not only a heartbeat
// AIR: Quite lossy, and r.n we send about 2 to 3 telemetry packets per second
// GROUND: OpenHD (can) send a lot of data to QOpenHD, since there are no bw constraints
const int tmp=m_last_message_ms;
if(tmp<=-1){
const int64_t tmp=m_last_message_ms;
if(tmp<=-1) {
update_alive_status_with_hud_message(false);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions app/telemetry/models/aohdsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ class AOHDSystem : public QObject
void process_sys_status1(const mavlink_openhd_sys_status1_t& msg);
void process_op_mode(const mavlink_openhd_wifbroadcast_gnd_operating_mode_t& msg);
private:
std::atomic<int32_t> m_last_heartbeat_ms = -1;
std::atomic<int32_t> m_last_message_ms= -1;
std::atomic<int64_t> m_last_heartbeat_ms = -1;
std::atomic<int64_t> m_last_message_ms= -1;
//
QString m_curr_incoming_bitrate="Bitrate NA";
QString m_curr_incoming_tele_bitrate="Bitrate NA";
Expand Down
4 changes: 2 additions & 2 deletions app/telemetry/models/fcmavlinksystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ class FCMavlinkSystem : public QObject
std::unique_ptr<QTimer> m_flight_time_timer = nullptr;
//
std::unique_ptr<QTimer> m_alive_timer = nullptr;
std::atomic<int32_t> m_last_heartbeat_ms = -1;
std::atomic<int32_t> m_last_message_ms= -1;
std::atomic<int64_t> m_last_heartbeat_ms = -1;
std::atomic<int64_t> m_last_message_ms= -1;
void update_alive();
std::chrono::steady_clock::time_point m_last_update_update_rate_mavlink_message_attitude=std::chrono::steady_clock::now();
int m_n_messages_update_rate_mavlink_message_attitude=0;
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/models/rcchannelsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public slots:
QList<int> m_data{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
private:
// We need thread saftey on the alive
std::atomic<int32_t> m_last_update_ms = -1;
std::atomic<int64_t> m_last_update_ms = -1;
std::unique_ptr<QTimer> m_alive_timer;
void update_alive();
};
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/models/wificard.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class WiFiCard : public QObject
int64_t m_last_packets_in_X_second_value=-1;
// Card alive - ONLY USED FOR GROUND CARD(s)
std::unique_ptr<QTimer> m_alive_timer = nullptr;
std::atomic<int> m_last_mavlink_message=0;
std::atomic<int64_t> m_last_mavlink_message=0;
void update_alive();
};

Expand Down
14 changes: 13 additions & 1 deletion app/util/qopenhd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include<fstream>
#include<string>

#ifdef __linux__
#if defined(__linux__) || defined(__macos__)
#include "common/openhd-util.hpp"
#endif

Expand Down Expand Up @@ -227,6 +227,9 @@ QString QOpenHD::show_local_ip()
#ifdef __linux__
auto res=OHDUtil::run_command_out("hostname -I");
return QString(res->c_str());
#elif defined(__macos__)
auto res=OHDUtil::run_command_out("ifconfig -l | xargs -n1 ipconfig getifaddr");
return QString(res->c_str());
#else
return QString("Only works on linux");
#endif
Expand All @@ -246,6 +249,15 @@ bool QOpenHD::is_linux()
return false;
}

bool QOpenHD::is_mac()
{
#if defined(__macos__)
return true;
#else
return false;
#endif
}

bool QOpenHD::is_android()
{
#if defined(__android__)
Expand Down
1 change: 1 addition & 0 deletions app/util/qopenhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class QOpenHD : public QObject
// some settings an stuff depend on that, called from .qml
// NOTE: android is not linux in this definition !
Q_INVOKABLE bool is_linux();
Q_INVOKABLE bool is_mac();
Q_INVOKABLE bool is_android();
Q_INVOKABLE void android_open_tethering_settings();
// runs systemctl start/stop/enable/disable openhd
Expand Down
5 changes: 5 additions & 0 deletions app/videostreaming/vscommon/rtp/RTP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
#include <sstream>

// This code is written for little endian (aka ARM,x86) byte order
#if defined(__macos__)
static_assert(__BYTE_ORDER__==LITTLE_ENDIAN);
#else
static_assert(__BYTE_ORDER__==__LITTLE_ENDIAN);
#endif

// RTP uses big endian (network) byte order. Therefore, most of the structs here
// are actually declared in 'reverse order' such that the compiler can do the work
// of 'interpreting bits the right way' for us
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/configpopup/connect/PaneConnectionMode.qml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Rectangle{
text: "SAVE"
onClicked: {
if(!_mavlinkTelemetry.change_manual_tcp_ip(textFieldip.text)){
_qopenhd.toast_text("Please enter a valid ip");
_qopenhd.show_toast("Please enter a valid ip");
}else{
settings.qopenhd_mavlink_connection_manual_tcp_ip=textFieldip.text
}
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/configpopup/credits/Credits.qml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Rectangle {
Repeater {
model: ["pilotnbr1", "limitlessgreen", "michell", "roman", "jweijs", "user1321",
"flavio", "hdfpv", "htcohio", "raymond", "yes21", "mjc506", "cq112358",
"steveatinfincia", "norbert", "macdaddyfpv"]
"steveatinfincia", "norbert", "macdaddyfpv", "ivan"]

Text {
text: modelData
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/configpopup/status/FooterRebootShutdownWarning.qml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Item {
Layout.alignment: {if (m_supports_shutdown_actions == false)
return Qt.AlignCenter
else
return Qt.AlignRight
return Qt.AlignLeft
}
Layout.leftMargin: 10
text: qsTr("REBOOT")
Expand Down
6 changes: 4 additions & 2 deletions qml/ui/configpopup/status/StatusCardRow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Item {
}*/
// Actual item,centered
Item{
width: parent.width > 260 ? 260 : parent.width
width: parent.width > 400 ? 400 : parent.width
height: main_item.height
anchors.centerIn: parent

Expand All @@ -80,6 +80,7 @@ Item {
font.pixelSize: 18
clip: true
elide: Text.ElideRight
padding: 4
}

Text{
Expand All @@ -90,12 +91,13 @@ Item {
anchors.top: left_part.top
text: m_right_text
verticalAlignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignHCenter
horizontalAlignment: Qt.AlignLeft
color: m_has_error ? m_right_text_color_error : m_right_text_color
visible: !right_part_button.visible
font.pixelSize: 18
clip: true
elide: Text.ElideRight
padding: 4
}
MouseArea {
enabled: m_has_error && !m_look_shit_on_error
Expand Down
12 changes: 6 additions & 6 deletions qml/ui/widgets/GroundPowerWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ BaseWidget {
switch (batteryComboBox.currentIndex) {
case 0:
settings.ground_battery_type = 0;
settings.ground_battery_low = 35;
settings.ground_battery_mid = 39;
settings.ground_battery_low = 33;
settings.ground_battery_mid = 37;
settings.ground_battery_full = 42;
break;
case 1:
settings.ground_battery_type = 1;
settings.ground_battery_low = 31;
settings.ground_battery_mid = 36;
settings.ground_battery_low = 27;
settings.ground_battery_mid = 34;
settings.ground_battery_full = 42;
break;
case 2:
settings.ground_battery_type = 2;
settings.ground_battery_low = 30;
settings.ground_battery_low = 31;
settings.ground_battery_mid = 35;
settings.ground_battery_full = 40;
settings.ground_battery_full = 37;
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion qml/ui/widgets/VideoBitrateWidgetGeneric.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ BaseWidget {
console.log("try_set_recording_mode "+camera_idx+" "+mode)
var camModel=_airCameraSettingsModel;
var camString="CAM1"
if(camera_idx===2){
if(camera_idx===1){
camModel=_airCameraSettingsModel2;
camString="CAM2"
}
Expand Down

0 comments on commit bd0a7ae

Please sign in to comment.