mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 07:53:35 +08:00
control_allocator: param update avoid temporary
- this is a harmless workaround for a GCC warning (-Wdangling-pointer) false positive
This commit is contained in:
+1
-5
@@ -69,15 +69,11 @@ void ActuatorEffectivenessControlSurfaces::updateParams()
|
|||||||
{
|
{
|
||||||
ModuleParams::updateParams();
|
ModuleParams::updateParams();
|
||||||
|
|
||||||
int32_t count = 0;
|
if (param_get(_count_handle, &_count) != PX4_OK) {
|
||||||
|
|
||||||
if (param_get(_count_handle, &count) != 0) {
|
|
||||||
PX4_ERR("param_get failed");
|
PX4_ERR("param_get failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_count = count;
|
|
||||||
|
|
||||||
for (int i = 0; i < _count; i++) {
|
for (int i = 0; i < _count; i++) {
|
||||||
param_get(_param_handles[i].type, (int32_t *)&_params[i].type);
|
param_get(_param_handles[i].type, (int32_t *)&_params[i].type);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ private:
|
|||||||
param_t _count_handle;
|
param_t _count_handle;
|
||||||
|
|
||||||
Params _params[MAX_COUNT] {};
|
Params _params[MAX_COUNT] {};
|
||||||
int _count{0};
|
int32_t _count{0};
|
||||||
|
|
||||||
SlewRate<float> _flaps_setpoint_with_slewrate;
|
SlewRate<float> _flaps_setpoint_with_slewrate;
|
||||||
SlewRate<float> _spoilers_setpoint_with_slewrate;
|
SlewRate<float> _spoilers_setpoint_with_slewrate;
|
||||||
|
|||||||
+3
-4
@@ -73,14 +73,13 @@ void ActuatorEffectivenessHelicopter::updateParams()
|
|||||||
{
|
{
|
||||||
ModuleParams::updateParams();
|
ModuleParams::updateParams();
|
||||||
|
|
||||||
int32_t count = 0;
|
if (param_get(_param_handles.num_swash_plate_servos, &_geometry.num_swash_plate_servos) != PX4_OK) {
|
||||||
|
|
||||||
if (param_get(_param_handles.num_swash_plate_servos, &count) != 0) {
|
|
||||||
PX4_ERR("param_get failed");
|
PX4_ERR("param_get failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_geometry.num_swash_plate_servos = math::constrain((int)count, 3, NUM_SWASH_PLATE_SERVOS_MAX);
|
_geometry.num_swash_plate_servos = math::constrain(_geometry.num_swash_plate_servos,
|
||||||
|
(int32_t)3, (int32_t)NUM_SWASH_PLATE_SERVOS_MAX);
|
||||||
|
|
||||||
for (int i = 0; i < _geometry.num_swash_plate_servos; ++i) {
|
for (int i = 0; i < _geometry.num_swash_plate_servos; ++i) {
|
||||||
float angle_deg{};
|
float angle_deg{};
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
struct Geometry {
|
struct Geometry {
|
||||||
SwashPlateGeometry swash_plate_servos[NUM_SWASH_PLATE_SERVOS_MAX];
|
SwashPlateGeometry swash_plate_servos[NUM_SWASH_PLATE_SERVOS_MAX];
|
||||||
int num_swash_plate_servos{0};
|
int32_t num_swash_plate_servos{0};
|
||||||
float throttle_curve[NUM_CURVE_POINTS];
|
float throttle_curve[NUM_CURVE_POINTS];
|
||||||
float pitch_curve[NUM_CURVE_POINTS];
|
float pitch_curve[NUM_CURVE_POINTS];
|
||||||
float yaw_collective_pitch_scale;
|
float yaw_collective_pitch_scale;
|
||||||
|
|||||||
+3
-4
@@ -60,14 +60,13 @@ void ActuatorEffectivenessHelicopterCoaxial::updateParams()
|
|||||||
{
|
{
|
||||||
ModuleParams::updateParams();
|
ModuleParams::updateParams();
|
||||||
|
|
||||||
int32_t count = 0;
|
if (param_get(_param_handles.num_swash_plate_servos, &_geometry.num_swash_plate_servos) != PX4_OK) {
|
||||||
|
|
||||||
if (param_get(_param_handles.num_swash_plate_servos, &count) != 0) {
|
|
||||||
PX4_ERR("param_get failed");
|
PX4_ERR("param_get failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_geometry.num_swash_plate_servos = math::constrain((int)count, 2, NUM_SWASH_PLATE_SERVOS_MAX);
|
_geometry.num_swash_plate_servos = math::constrain(_geometry.num_swash_plate_servos,
|
||||||
|
(int32_t)2, (int32_t)NUM_SWASH_PLATE_SERVOS_MAX);
|
||||||
|
|
||||||
for (int i = 0; i < _geometry.num_swash_plate_servos; ++i) {
|
for (int i = 0; i < _geometry.num_swash_plate_servos; ++i) {
|
||||||
float angle_deg{};
|
float angle_deg{};
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
struct Geometry {
|
struct Geometry {
|
||||||
SwashPlateGeometry swash_plate_servos[NUM_SWASH_PLATE_SERVOS_MAX];
|
SwashPlateGeometry swash_plate_servos[NUM_SWASH_PLATE_SERVOS_MAX];
|
||||||
int num_swash_plate_servos{0};
|
int32_t num_swash_plate_servos{0};
|
||||||
float spoolup_time;
|
float spoolup_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user