mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 05:43:34 +08:00
parameter_update use uORB::Subscription consistently
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
#include <px4_getopt.h>
|
||||
#include <px4_posix.h>
|
||||
|
||||
#include <uORB/uORB.h>
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/topics/actuator_outputs.h>
|
||||
#include <uORB/topics/actuator_armed.h>
|
||||
@@ -260,7 +260,7 @@ void task_main(int argc, char *argv[])
|
||||
|
||||
Mixer::Airmode airmode = Mixer::Airmode::disabled;
|
||||
update_params(airmode);
|
||||
int params_sub = orb_subscribe(ORB_ID(parameter_update));
|
||||
uORB::Subscription parameter_update_sub{ORB_ID(parameter_update)};
|
||||
|
||||
int rc_channels_sub = -1;
|
||||
|
||||
@@ -418,16 +418,15 @@ void task_main(int argc, char *argv[])
|
||||
_task_should_exit = true;
|
||||
}
|
||||
|
||||
/* check for parameter updates */
|
||||
bool param_updated = false;
|
||||
orb_check(params_sub, ¶m_updated);
|
||||
// check for parameter updates
|
||||
if (parameter_update_sub.updated()) {
|
||||
// clear update
|
||||
parameter_update_s pupdate;
|
||||
parameter_update_sub.copy(&pupdate);
|
||||
|
||||
if (param_updated) {
|
||||
struct parameter_update_s update;
|
||||
orb_copy(ORB_ID(parameter_update), params_sub, &update);
|
||||
// update parameters from storage
|
||||
update_params(airmode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
delete pwm_out;
|
||||
@@ -447,10 +446,6 @@ void task_main(int argc, char *argv[])
|
||||
orb_unsubscribe(rc_channels_sub);
|
||||
}
|
||||
|
||||
if (params_sub != -1) {
|
||||
orb_unsubscribe(params_sub);
|
||||
}
|
||||
|
||||
perf_free(_perf_control_latency);
|
||||
|
||||
_is_running = false;
|
||||
|
||||
Reference in New Issue
Block a user