forked from Archive/PX4-Autopilot
ActuatorEffectivenessRotors: Use modern parameter interface for rotor count
This lead to a compiler warning with arm-none-eabi-gcc 12+ about the variable count potentially being a dangling pointer.
This commit is contained in:
parent
b71c6fb6ea
commit
14c4257a59
|
@ -79,8 +79,6 @@ ActuatorEffectivenessRotors::ActuatorEffectivenessRotors(ModuleParams *parent, A
|
|||
}
|
||||
}
|
||||
|
||||
_count_handle = param_find("CA_ROTOR_COUNT");
|
||||
|
||||
updateParams();
|
||||
}
|
||||
|
||||
|
@ -88,14 +86,7 @@ void ActuatorEffectivenessRotors::updateParams()
|
|||
{
|
||||
ModuleParams::updateParams();
|
||||
|
||||
int32_t count = 0;
|
||||
|
||||
if (param_get(_count_handle, &count) != 0) {
|
||||
PX4_ERR("param_get failed");
|
||||
return;
|
||||
}
|
||||
|
||||
_geometry.num_rotors = math::min(NUM_ROTORS_MAX, (int)count);
|
||||
_geometry.num_rotors = math::min(NUM_ROTORS_MAX, static_cast<int>(_param_ca_rotor_count.get()));
|
||||
|
||||
for (int i = 0; i < _geometry.num_rotors; ++i) {
|
||||
Vector3f &position = _geometry.rotors[i].position;
|
||||
|
|
|
@ -147,7 +147,10 @@ private:
|
|||
param_t tilt_index;
|
||||
};
|
||||
ParamHandles _param_handles[NUM_ROTORS_MAX];
|
||||
param_t _count_handle;
|
||||
|
||||
Geometry _geometry{};
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamInt<px4::params::CA_ROTOR_COUNT>) _param_ca_rotor_count
|
||||
)
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue