VTOL don't poll parameter_update

This commit is contained in:
Daniel Agar 2017-07-09 12:24:10 -04:00 committed by Lorenz Meier
parent 66f0912b9d
commit 1867573b02
1 changed files with 7 additions and 5 deletions

View File

@ -668,14 +668,12 @@ void VtolAttitudeControl::task_main()
_vtol_type->set_idle_mc(); _vtol_type->set_idle_mc();
/* wakeup source*/ /* wakeup source*/
px4_pollfd_struct_t fds[3] = {}; /*input_mc, input_fw, parameters*/ px4_pollfd_struct_t fds[2] = {}; /*input_mc, input_fw, parameters*/
fds[0].fd = _actuator_inputs_mc; fds[0].fd = _actuator_inputs_mc;
fds[0].events = POLLIN; fds[0].events = POLLIN;
fds[1].fd = _actuator_inputs_fw; fds[1].fd = _actuator_inputs_fw;
fds[1].events = POLLIN; fds[1].events = POLLIN;
fds[2].fd = _params_sub;
fds[2].events = POLLIN;
while (!_task_should_exit) { while (!_task_should_exit) {
/*Advertise/Publish vtol vehicle status*/ /*Advertise/Publish vtol vehicle status*/
@ -712,9 +710,13 @@ void VtolAttitudeControl::task_main()
orb_copy(ORB_ID(actuator_controls_virtual_fw), _actuator_inputs_fw, &_actuators_fw_in); orb_copy(ORB_ID(actuator_controls_virtual_fw), _actuator_inputs_fw, &_actuators_fw_in);
} }
if (fds[2].revents & POLLIN) { //parameters were updated, read them now /* only update parameters if they changed */
bool params_updated = false;
orb_check(_params_sub, &params_updated);
if (params_updated) {
/* read from param to clear updated flag */ /* read from param to clear updated flag */
struct parameter_update_s update; parameter_update_s update;
orb_copy(ORB_ID(parameter_update), _params_sub, &update); orb_copy(ORB_ID(parameter_update), _params_sub, &update);
/* update parameters from storage */ /* update parameters from storage */