From 473f7cfe7ddae79d6e0bce92d088df01677d164e Mon Sep 17 00:00:00 2001 From: Consti10 Date: Tue, 16 Apr 2024 15:33:53 +0200 Subject: [PATCH] update platform, camera --- app/telemetry/models/openhd_core/camera.hpp | 18 ++++- app/telemetry/models/openhd_core/platform.hpp | 81 ++++++++++++------- app/telemetry/models/wificard.h | 2 + .../openhd_settings/PopupTxPowerEditor.qml | 17 +++- 4 files changed, 85 insertions(+), 33 deletions(-) diff --git a/app/telemetry/models/openhd_core/camera.hpp b/app/telemetry/models/openhd_core/camera.hpp index 1a1387c0b..931b9e0f2 100644 --- a/app/telemetry/models/openhd_core/camera.hpp +++ b/app/telemetry/models/openhd_core/camera.hpp @@ -87,7 +87,9 @@ static constexpr int X_CAM_TYPE_ROCK_RK3566_PLACEHOLDER2 = 83; // OpenIPC specific starts here static constexpr int X_CAM_TYPE_OPENIPC_SOMETHING = 90; // - +// +// NVIDIA XAVIER specific starts here +static constexpr int X_CAM_TYPE_NVIDIA_XAVIER_IMX577 = 100; // ... rest is reserved for future use // no camera, only exists to have a default value for secondary camera (which is // disabled by default). NOTE: The primary camera cannot be disabled ! @@ -158,6 +160,8 @@ static std::string x_cam_type_to_string(int camera_type) { return "DISABLED"; case X_CAM_TYPE_OPENIPC_SOMETHING: return "OPENIPC_X"; + case X_CAM_TYPE_NVIDIA_XAVIER_IMX577: + return "XAVIER_IMX577"; default: break; } @@ -318,6 +322,11 @@ struct XCamera { ret.push_back(ResolutionFramerate{1280, 720, 60}); ret.push_back(ResolutionFramerate{1920, 1080, 60}); return ret; + } else if (camera_type == X_CAM_TYPE_NVIDIA_XAVIER_IMX577) { + std::vector ret; + ret.push_back(ResolutionFramerate{1280, 720, 60}); + ret.push_back(ResolutionFramerate{1920, 1080, 60}); + return ret; } // Not mapped yet // return something that might work or might not work @@ -525,6 +534,13 @@ static std::vector get_camera_choices_for_platform( } else if (platform_type == X_PLATFORM_TYPE_X86) { return std::vector{MANUFACTURER_USB, MANUFACTURER_DEBUG}; + } else if (platform_type == X_PLATFORM_TYPE_NVIDIA_XAVIER) { + std::vector nvidia_leopard_csi_cameras{ + CameraNameAndType{"IMX577", X_CAM_TYPE_NVIDIA_XAVIER_IMX577}, + }; + return std::vector{ + ManufacturerForPlatform{"LEOPARD", nvidia_leopard_csi_cameras}, + MANUFACTURER_USB, MANUFACTURER_DEBUG}; } return std::vector{MANUFACTURER_DEBUG}; } diff --git a/app/telemetry/models/openhd_core/platform.hpp b/app/telemetry/models/openhd_core/platform.hpp index cf6dbd635..8eb4c6021 100644 --- a/app/telemetry/models/openhd_core/platform.hpp +++ b/app/telemetry/models/openhd_core/platform.hpp @@ -3,54 +3,75 @@ #include +#include +// Some things conditionally depend on the platform we are running on - -// When this one shows up a bit more work has to be done to run openhd on the platform (probably) ;) -static constexpr int X_PLATFORM_TYPE_UNKNOWN=0; +// When this one shows up a bit more work has to be done to run openhd on the +// platform (probably) ;) +static constexpr int X_PLATFORM_TYPE_UNKNOWN = 0; // Generic X86 -static constexpr int X_PLATFORM_TYPE_X86=1; +static constexpr int X_PLATFORM_TYPE_X86 = 1; // Numbers 10..20 are reserved for rpi // Right now we are only interested if it is an RPI of the // generation RPI 4 / RPI CM4 or the generation before - -// NOTE: RPI 5 is currently not supported due to the complete lack of suitable HW acceleration -static constexpr int X_PLATFORM_TYPE_RPI_OLD=10; -static constexpr int X_PLATFORM_TYPE_RPI_4=11; -static constexpr int X_PLATFORM_TYPE_RPI_CM4=12; -static constexpr int X_PLATFORM_TYPE_RPI_5=12; +// NOTE: RPI 5 is currently not supported due to the complete lack of suitable +// HW acceleration +static constexpr int X_PLATFORM_TYPE_RPI_OLD = 10; +static constexpr int X_PLATFORM_TYPE_RPI_4 = 11; +static constexpr int X_PLATFORM_TYPE_RPI_CM4 = 12; +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_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 // Numbers 30..35 are reserved for allwinner -static constexpr int X_PLATFORM_TYPE_ALWINNER_X20=30; +static constexpr int X_PLATFORM_TYPE_ALWINNER_X20 = 30; + +// @Buldo is working on openipc / sigmastar, 36..39 +static constexpr int X_PLATFORM_TYPE_OPENIPC_SIGMASTAR_UNDEFINED = 36; -// @Buldo is working on openipc / sigmastar, 36..40 -static constexpr int X_PLATFORM_TYPE_SIGMASTAR_UNDEFINED=36; +// Numbers 40..50 are reserved for NVIDIA +static constexpr int X_PLATFORM_TYPE_NVIDIA_XAVIER = 40; static std::string x_platform_type_to_string(int platform_type) { - switch (platform_type) { - case X_PLATFORM_TYPE_UNKNOWN:return "UNKNOWN"; - case X_PLATFORM_TYPE_X86:return "X86"; - case X_PLATFORM_TYPE_RPI_OLD: return "RPI<=3"; - case X_PLATFORM_TYPE_RPI_4: return "RPI 4"; - case X_PLATFORM_TYPE_RPI_5: return "RPI 5"; + switch (platform_type) { + case X_PLATFORM_TYPE_UNKNOWN: + return "UNKNOWN"; + case X_PLATFORM_TYPE_X86: + return "X86"; + case X_PLATFORM_TYPE_RPI_OLD: + return "RPI<=3"; + case X_PLATFORM_TYPE_RPI_4: + return "RPI 4"; + case X_PLATFORM_TYPE_RPI_5: + return "RPI 5"; // 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_RV1126_UNDEFINED: return "RV1126 UNDEFINED"; + 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_RV1126_UNDEFINED: + return "RV1126 UNDEFINED"; // ROCK END - case X_PLATFORM_TYPE_ALWINNER_X20: return "X20"; - case X_PLATFORM_TYPE_SIGMASTAR_UNDEFINED: return "SIGMASTAR UNDEFINED"; + case X_PLATFORM_TYPE_ALWINNER_X20: + return "X20"; + case X_PLATFORM_TYPE_OPENIPC_SIGMASTAR_UNDEFINED: + return "OPENIPC SIGMASTAR"; + case X_PLATFORM_TYPE_NVIDIA_XAVIER: + return "NVIDIA_XAVIER"; default: - break; - } - return "ERR-UNDEFINED"; + break; + } + std::stringstream ss; + ss << "ERR-UNDEFINED{" << platform_type << "}"; + return ss.str(); } - #endif // PLATFORM_HPP diff --git a/app/telemetry/models/wificard.h b/app/telemetry/models/wificard.h index 5054edfbe..b69618947 100644 --- a/app/telemetry/models/wificard.h +++ b/app/telemetry/models/wificard.h @@ -32,6 +32,8 @@ class WiFiCard : public QObject L_RO_PROP(int,card_type,set_card_type,-1) // -1 = no info available yet, otherwise, openhd card type (0..?) L_RO_PROP(QString,card_type_as_string,set_card_type_as_string,"N/A") L_RO_PROP(int,card_type_supported,set_card_type_supported,false) + // exta + L_RO_PROP(int,card_sub_type,set_card_sub_type,-1) public: explicit WiFiCard(bool is_air,int card_idx,QObject *parent = nullptr); static constexpr int N_CARDS=4; diff --git a/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml b/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml index 4cb2e1839..69e66baf0 100644 --- a/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml +++ b/qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml @@ -32,6 +32,8 @@ PopupBigGeneric{ property int left_text_preferred_width: 100 property bool isSynced:false + property bool m_card_type_provided_by_openhd: false + function open(){ if(_fcMavlinkSystem.is_alive && _fcMavlinkSystem.armed){ _qopenhd.show_toast("WARNING: Changing TX power while armed is not recommended !"); @@ -45,7 +47,17 @@ PopupBigGeneric{ comboBoxCardSelectManufacturer.currentIndex=0; combo_box_txpower_disarmed.currentIndex=0; combo_box_txpower_armed.currentIndex=0; - m_user_selected_card_manufacturer=-1; + + const card_sub_type=m_is_air ? _wifi_card_air.card_sub_type : _wifi_card_gnd0.card_sub_type + if(card_sub_type==10){ + // rtl8812 x20 + m_user_selected_card_manufacturer=2; + m_card_type_provided_by_openhd=true; + }else{ + // User has to set the card type ... + m_user_selected_card_manufacturer=-1; + m_card_type_provided_by_openhd=false; + } visible=true; enabled=true; } @@ -258,9 +270,10 @@ PopupBigGeneric{ m_user_selected_card_manufacturer = manufacturer; } font.pixelSize: 14 + // If the card type is provided by openhd, no need to let the user select + enabled: !m_card_type_provided_by_openhd } } - RowLayout { Layout.fillWidth: true Button {