mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
FMU: Tighter compile checks and correct use of unsubscribe
This commit is contained in:
parent
4b99a8f28c
commit
97ce9edcac
@ -35,9 +35,9 @@ px4_add_module(
|
||||
MAIN fmu
|
||||
STACK_MAIN 1200
|
||||
COMPILE_FLAGS
|
||||
-Weffc++
|
||||
SRCS
|
||||
fmu.cpp
|
||||
px4fmu_params.c
|
||||
DEPENDS
|
||||
platforms__common
|
||||
)
|
||||
|
||||
@ -316,6 +316,7 @@ PX4FMU::PX4FMU() :
|
||||
_pwm_alt_rate_channels(0),
|
||||
_current_update_rate(0),
|
||||
_work{},
|
||||
_vehicle_cmd_sub(-1),
|
||||
_armed_sub(-1),
|
||||
_param_sub(-1),
|
||||
_adc_sub(-1),
|
||||
@ -730,13 +731,13 @@ PX4FMU::subscribe()
|
||||
|
||||
for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) {
|
||||
if (sub_groups & (1 << i)) {
|
||||
PX4_DEBUG("subscribe to actuator_controls_%d", i);
|
||||
DEVICE_DEBUG("subscribe to actuator_controls_%d", i);
|
||||
_control_subs[i] = orb_subscribe(_control_topics[i]);
|
||||
}
|
||||
|
||||
if (unsub_groups & (1 << i)) {
|
||||
PX4_DEBUG("unsubscribe from actuator_controls_%d", i);
|
||||
::close(_control_subs[i]);
|
||||
DEVICE_DEBUG("unsubscribe from actuator_controls_%d", i);
|
||||
orb_unsubscribe(_control_subs[i]);
|
||||
_control_subs[i] = -1;
|
||||
}
|
||||
|
||||
@ -1616,13 +1617,13 @@ void PX4FMU::work_stop()
|
||||
|
||||
for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) {
|
||||
if (_control_subs[i] > 0) {
|
||||
::close(_control_subs[i]);
|
||||
orb_unsubscribe(_control_subs[i]);
|
||||
_control_subs[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
::close(_armed_sub);
|
||||
::close(_param_sub);
|
||||
orb_unsubscribe(_armed_sub);
|
||||
orb_unsubscribe(_param_sub);
|
||||
|
||||
/* make sure servos are off */
|
||||
up_pwm_servo_deinit();
|
||||
|
||||
@ -31,17 +31,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file px4fmu_params.c
|
||||
*
|
||||
* Parameters defined by the PX4FMU driver
|
||||
*
|
||||
* @author Lorenz Meier <lorenz@px4.io>
|
||||
*/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <systemlib/param/param.h>
|
||||
|
||||
/**
|
||||
* Invert direction of aux output channel 1
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user