From 64c9b7b29c4a6bb016f392acb37c932cc97c37c6 Mon Sep 17 00:00:00 2001 From: Consti10 Date: Fri, 26 Apr 2024 09:47:49 +0200 Subject: [PATCH] add external device count, new simplified ethernet param --- app/telemetry/models/aohdsystem.cpp | 1 + app/telemetry/models/aohdsystem.h | 1 + app/telemetry/models/openhd_core/camera.hpp | 15 ++++++++----- app/telemetry/models/openhd_core/platform.hpp | 12 +++++----- app/telemetry/settings/documentedparam.cpp | 5 +++++ qml/qml.qrc | 1 + qml/ui/configpopup/status/PanelStatus.qml | 4 ++-- .../status/StatusCardBodyOpenHD.qml | 13 +++++++++++ qml/ui/sidebar/ActionElement.qml | 22 +++++++++++++++++++ 9 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 qml/ui/sidebar/ActionElement.qml diff --git a/app/telemetry/models/aohdsystem.cpp b/app/telemetry/models/aohdsystem.cpp index f72471b25..39b1e3fbb 100644 --- a/app/telemetry/models/aohdsystem.cpp +++ b/app/telemetry/models/aohdsystem.cpp @@ -472,6 +472,7 @@ void AOHDSystem::process_sys_status1(const mavlink_openhd_sys_status1_t &msg) { set_wifi_hotspot_state(msg.wifi_hotspot_state); set_wifi_hotspot_frequency(msg.wifi_hotspot_frequency); + set_external_devices_count(msg.external_devices_count); } void AOHDSystem::process_op_mode(const mavlink_openhd_wifbroadcast_gnd_operating_mode_t &msg) diff --git a/app/telemetry/models/aohdsystem.h b/app/telemetry/models/aohdsystem.h index f479c98fa..b29b7dee1 100644 --- a/app/telemetry/models/aohdsystem.h +++ b/app/telemetry/models/aohdsystem.h @@ -119,6 +119,7 @@ class AOHDSystem : public QObject // ---------- WIFI HOTSPOT ---------------------- L_RO_PROP(int,wifi_hotspot_state,set_wifi_hotspot_state,-1) // 0 - not available, 1 - off, 2 - on L_RO_PROP(int,wifi_hotspot_frequency,set_wifi_hotspot_frequency,-1) + L_RO_PROP(int,external_devices_count,set_external_devices_count,-1) // L_RO_PROP(int,wb_gnd_operating_mode,set_wb_gnd_operating_mode,-1) // diff --git a/app/telemetry/models/openhd_core/camera.hpp b/app/telemetry/models/openhd_core/camera.hpp index 931b9e0f2..dbc7b1158 100644 --- a/app/telemetry/models/openhd_core/camera.hpp +++ b/app/telemetry/models/openhd_core/camera.hpp @@ -74,7 +74,7 @@ static constexpr int X_CAM_TYPE_RPI_V4L2_VEYE_MVCAM = 63; // X20 Specific starts here // // Right now we only have one camera, but more (might) follow. -static constexpr int X_CAM_TYPE_X20_RUNCAM_NANO = 70; +static constexpr int X_CAM_TYPE_X20_RUNCAM_GENERIC = 70; // ... 9 reserved for future use // // ROCK Specific starts here @@ -145,8 +145,8 @@ static std::string x_cam_type_to_string(int camera_type) { case X_CAM_TYPE_RPI_V4L2_VEYE_MVCAM: return "VEYE_MVCAM"; // All the x20 begin - case X_CAM_TYPE_X20_RUNCAM_NANO: - return "X20_RUNCAM_NANO"; + case X_CAM_TYPE_X20_RUNCAM_GENERIC: + return "X20_RUNCAM_GENERIC"; // All the rock begin case X_CAM_TYPE_ROCK_HDMI_IN: return "ROCK_HDMI_IN"; @@ -511,10 +511,10 @@ static std::vector get_camera_choices_for_platform( MANUFACTURER_DEBUG}; } else if (platform_type == X_PLATFORM_TYPE_ALWINNER_X20) { std::vector runcam_cameras{ - CameraNameAndType{"RUNCAM NANO", X_CAM_TYPE_X20_RUNCAM_NANO}, + CameraNameAndType{"GENERIC", X_CAM_TYPE_X20_RUNCAM_GENERIC}, }; return std::vector{ - ManufacturerForPlatform{"RUNCAM", runcam_cameras}}; + ManufacturerForPlatform{"HDZERO", runcam_cameras}}; } else if (platform_type == X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_ZERO3W) { std::vector arducam_cameras{ CameraNameAndType{"IMX219", X_CAM_TYPE_ROCK_RK3566_IMX219}, @@ -524,7 +524,10 @@ static std::vector get_camera_choices_for_platform( return std::vector{ ManufacturerForPlatform{"ARDUCAM", arducam_cameras}, MANUFACTURER_USB, MANUFACTURER_DEBUG}; - } else if (platform_type == X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5) { + } else if (platform_type == X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5_A) { + return std::vector{MANUFACTURER_USB, + MANUFACTURER_DEBUG}; + } else if (platform_type == X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5_B) { std::vector hdmi_cameras{ CameraNameAndType{"HDMI IN", X_CAM_TYPE_ROCK_HDMI_IN}, }; diff --git a/app/telemetry/models/openhd_core/platform.hpp b/app/telemetry/models/openhd_core/platform.hpp index 8eb4c6021..1a44f251f 100644 --- a/app/telemetry/models/openhd_core/platform.hpp +++ b/app/telemetry/models/openhd_core/platform.hpp @@ -25,9 +25,9 @@ static constexpr int X_PLATFORM_TYPE_RPI_5 = 12; // Numbers 20..30 are reserved for rockchip static constexpr int X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_ZERO3W = 20; // Zero 3 W -static constexpr int X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5 = - 21; // ROCK 5 -static constexpr int X_PLATFORM_TYPE_ROCKCHIP_RV1126_UNDEFINED = 22; // FUTRE +static constexpr int X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5_A = 21; +static constexpr int X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5_B = 22; +static constexpr int X_PLATFORM_TYPE_ROCKCHIP_RV1126_UNDEFINED = 23; // FUTURE // Numbers 30..35 are reserved for allwinner static constexpr int X_PLATFORM_TYPE_ALWINNER_X20 = 30; @@ -53,8 +53,10 @@ static std::string x_platform_type_to_string(int platform_type) { // RPI END case X_PLATFORM_TYPE_ROCKCHIP_RK3566_RADXA_ZERO3W: return "RADXA ZERO3W"; - case X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5: - return "RADXA ROCK5"; + case X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5_A: + return "RADXA ROCK5 A"; + case X_PLATFORM_TYPE_ROCKCHIP_RK3588_RADXA_ROCK5_B: + return "RADXA ROCK5 B"; case X_PLATFORM_TYPE_ROCKCHIP_RV1126_UNDEFINED: return "RV1126 UNDEFINED"; // ROCK END diff --git a/app/telemetry/settings/documentedparam.cpp b/app/telemetry/settings/documentedparam.cpp index 2807c8f46..234b57176 100644 --- a/app/telemetry/settings/documentedparam.cpp +++ b/app/telemetry/settings/documentedparam.cpp @@ -514,6 +514,11 @@ static std::vector> get_parameters_list(){ append_int(ret,"ETH_PASSIVE_F",ImprovedIntSetting::createEnumEnableDisable(), "Enable automatic video & telemetry forwarding via ethernet if EITH_HOTSPOT_E is false (Recommended)." "Cannot be used simultaneously with ETH_HOTSPOT_E. Doesn't require reboot.",false); + { + auto values=std::vector{"UNMANAGED","HOTSPOT","FORWARD+INTERNET"}; + append_int(ret,"ETHERNET",ImprovedIntSetting::createEnum(values), + "Specify the intended usage of the ground station ethernet port (for connecting external devices)."); + } { auto values=std::vector{"untouched","high","low"}; append_int(ret,"GPIO_2",ImprovedIntSetting::createEnum(values), diff --git a/qml/qml.qrc b/qml/qml.qrc index 2528562a9..abf4b0377 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -312,5 +312,6 @@ ui/sidebar/MavlinkChoiceElement2.qml ui/sidebar/MappedMavlinkChoices.qml ui/widgets/X20OverheatWidget.qml + ui/sidebar/ActionElement.qml diff --git a/qml/ui/configpopup/status/PanelStatus.qml b/qml/ui/configpopup/status/PanelStatus.qml index 57cad0cde..18faf87ae 100644 --- a/qml/ui/configpopup/status/PanelStatus.qml +++ b/qml/ui/configpopup/status/PanelStatus.qml @@ -52,14 +52,14 @@ Rectangle { Item{ id: mainItem width: mainRect.width - height: 400+80 + height: 440+80 // The 3 status cards (OpenHD AIR & GND, FC) // next to each other StatusCardsColumn{ id: statuscardscolumn width: parent.width - height: 400 + height: 440 anchors.leftMargin: 4 anchors.topMargin: 4 anchors.rightMargin: 4 diff --git a/qml/ui/configpopup/status/StatusCardBodyOpenHD.qml b/qml/ui/configpopup/status/StatusCardBodyOpenHD.qml index 3c1cc51e0..6c2720c07 100644 --- a/qml/ui/configpopup/status/StatusCardBodyOpenHD.qml +++ b/qml/ui/configpopup/status/StatusCardBodyOpenHD.qml @@ -220,6 +220,19 @@ Column { return m_right_text=="UNAVAILABLE"; } } + StatusCardRow{ + visible: m_is_ground; + m_left_text: "EXTERNAL DEVICES:" + m_right_text: { + if(_ohdSystemGround.external_devices_count<0){ + return "N/A"; + } + if(_ohdSystemGround.external_devices_count==0){ + return "NONE"; + } + return _ohdSystemGround.external_devices_count+"x"; + } + } // Padding Item{ diff --git a/qml/ui/sidebar/ActionElement.qml b/qml/ui/sidebar/ActionElement.qml new file mode 100644 index 000000000..0ea15a788 --- /dev/null +++ b/qml/ui/sidebar/ActionElement.qml @@ -0,0 +1,22 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.12 +import QtQuick.Controls.Material 2.12 + +import Qt.labs.settings 1.0 + +import OpenHD 1.0 + +import "../../ui" as Ui +import "../elements" + + +// +// Perform a action if needed +// joystick navigatable +// +// +BaseJoyEditElement2{ + id: actionElement + +}