land detector: move arming state into base class & set param when disarming

Before that, different modules (ekf2, commander & land detector) changed
params upon different events:
- ekf2 & commander set params after disarm
- land detector set params on land detected
If the 2 events were several 100ms appart, it led to 2 param saves, and
the latter param set could have been blocked by an ongoing save. And if
the land detector was blocked, it could lead to mag timeouts.

This patch makes all modules use the same event, thus only a single param
save will happen.

If we want to have guarantees to never block, we should introduce a
param_try_set() API method.
This commit is contained in:
Beat Küng
2017-12-07 11:55:51 +00:00
committed by Lorenz Meier
parent 1dbeec6a19
commit a0afc370d0
6 changed files with 24 additions and 24 deletions
@@ -49,7 +49,6 @@
#include <uORB/topics/vehicle_local_position_setpoint.h>
#include <uORB/topics/vehicle_attitude.h>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/actuator_armed.h>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/battery_status.h>
#include <uORB/topics/parameter_update.h>
@@ -130,7 +129,6 @@ private:
int _vehicleLocalPositionSub;
int _vehicleLocalPositionSetpointSub;
int _actuatorsSub;
int _armingSub;
int _attitudeSub;
int _sensor_bias_sub;
int _vehicle_control_mode_sub;
@@ -139,7 +137,6 @@ private:
struct vehicle_local_position_s _vehicleLocalPosition;
struct vehicle_local_position_setpoint_s _vehicleLocalPositionSetpoint;
struct actuator_controls_s _actuators;
struct actuator_armed_s _arming;
struct vehicle_attitude_s _vehicleAttitude;
struct sensor_bias_s _sensors;
struct vehicle_control_mode_s _control_mode;