Skip to content

Commit

Permalink
update platform, camera
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Apr 16, 2024
1 parent c657dc2 commit 473f7cf
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 33 deletions.
18 changes: 17 additions & 1 deletion app/telemetry/models/openhd_core/camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 !
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<ResolutionFramerate> 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
Expand Down Expand Up @@ -525,6 +534,13 @@ static std::vector<ManufacturerForPlatform> get_camera_choices_for_platform(
} else if (platform_type == X_PLATFORM_TYPE_X86) {
return std::vector<ManufacturerForPlatform>{MANUFACTURER_USB,
MANUFACTURER_DEBUG};
} else if (platform_type == X_PLATFORM_TYPE_NVIDIA_XAVIER) {
std::vector<CameraNameAndType> nvidia_leopard_csi_cameras{
CameraNameAndType{"IMX577", X_CAM_TYPE_NVIDIA_XAVIER_IMX577},
};
return std::vector<ManufacturerForPlatform>{
ManufacturerForPlatform{"LEOPARD", nvidia_leopard_csi_cameras},
MANUFACTURER_USB, MANUFACTURER_DEBUG};
}
return std::vector<ManufacturerForPlatform>{MANUFACTURER_DEBUG};
}
Expand Down
81 changes: 51 additions & 30 deletions app/telemetry/models/openhd_core/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,75 @@


#include <string>
#include <sstream>

// 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
2 changes: 2 additions & 0 deletions app/telemetry/models/wificard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 15 additions & 2 deletions qml/ui/configpopup/openhd_settings/PopupTxPowerEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 !");
Expand All @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 473f7cf

Please sign in to comment.