mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +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:
parent
024dd701fb
commit
e12c3c00a4
@ -69,15 +69,11 @@ void ActuatorEffectivenessControlSurfaces::updateParams()
|
||||
{
|
||||
ModuleParams::updateParams();
|
||||
|
||||
int32_t count = 0;
|
||||
|
||||
if (param_get(_count_handle, &count) != 0) {
|
||||
if (param_get(_count_handle, &_count) != PX4_OK) {
|
||||
PX4_ERR("param_get failed");
|
||||
return;
|
||||
}
|
||||
|
||||
_count = count;
|
||||
|
||||
for (int i = 0; i < _count; i++) {
|
||||
param_get(_param_handles[i].type, (int32_t *)&_params[i].type);
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ private:
|
||||
param_t _count_handle;
|
||||
|
||||
Params _params[MAX_COUNT] {};
|
||||
int _count{0};
|
||||
int32_t _count{0};
|
||||
|
||||
SlewRate<float> _flaps_setpoint_with_slewrate;
|
||||
SlewRate<float> _spoilers_setpoint_with_slewrate;
|
||||
|
||||
@ -73,14 +73,13 @@ void ActuatorEffectivenessHelicopter::updateParams()
|
||||
{
|
||||
ModuleParams::updateParams();
|
||||
|
||||
int32_t count = 0;
|
||||
|
||||
if (param_get(_param_handles.num_swash_plate_servos, &count) != 0) {
|
||||
if (param_get(_param_handles.num_swash_plate_servos, &_geometry.num_swash_plate_servos) != PX4_OK) {
|
||||
PX4_ERR("param_get failed");
|
||||
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) {
|
||||
float angle_deg{};
|
||||
|
||||
@ -58,7 +58,7 @@ public:
|
||||
|
||||
struct Geometry {
|
||||
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 pitch_curve[NUM_CURVE_POINTS];
|
||||
float yaw_collective_pitch_scale;
|
||||
|
||||
@ -60,14 +60,13 @@ void ActuatorEffectivenessHelicopterCoaxial::updateParams()
|
||||
{
|
||||
ModuleParams::updateParams();
|
||||
|
||||
int32_t count = 0;
|
||||
|
||||
if (param_get(_param_handles.num_swash_plate_servos, &count) != 0) {
|
||||
if (param_get(_param_handles.num_swash_plate_servos, &_geometry.num_swash_plate_servos) != PX4_OK) {
|
||||
PX4_ERR("param_get failed");
|
||||
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) {
|
||||
float angle_deg{};
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
|
||||
struct Geometry {
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user