From d54b9315544fc8db09a8e113e27029f5ef1363ce Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 23 May 2015 15:18:25 +0200 Subject: [PATCH] IO driver: auto update param --- src/drivers/px4io/px4io.cpp | 7 ++++++- src/drivers/px4io/px4io_params.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 1cdd183a97..bb2f85d61e 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -281,6 +281,7 @@ private: int _t_actuator_armed; ///< system armed control topic int _t_vehicle_control_mode;///< vehicle control mode topic int _t_param; ///< parameter update topic + bool _param_update_force; ///< force a parameter update int _t_vehicle_command; ///< vehicle command topic /* advertised topics */ @@ -514,6 +515,7 @@ PX4IO::PX4IO(device::Device *interface) : _t_actuator_armed(-1), _t_vehicle_control_mode(-1), _t_param(-1), + _param_update_force(false), _t_vehicle_command(-1), _to_input_rc(0), _to_outputs(0), @@ -917,6 +919,8 @@ PX4IO::task_main() fds[0].fd = _t_actuator_controls_0; fds[0].events = POLLIN; + _param_update_force = true; + /* lock against the ioctl handler */ lock(); @@ -1017,7 +1021,8 @@ PX4IO::task_main() */ orb_check(_t_param, &updated); - if (updated) { + if (updated || _param_update_force) { + _param_update_force = false; parameter_update_s pupdate; orb_copy(ORB_ID(parameter_update), _t_param, &pupdate); diff --git a/src/drivers/px4io/px4io_params.c b/src/drivers/px4io/px4io_params.c index 2dc92632a8..67e9d3cb3b 100644 --- a/src/drivers/px4io/px4io_params.c +++ b/src/drivers/px4io/px4io_params.c @@ -51,7 +51,7 @@ * @max 1 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_REV1, 1); +PARAM_DEFINE_INT32(PWM_MAIN_REV1, 0); /** * Pre-scaler / Inverter for main output channel 2 @@ -62,7 +62,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV1, 1); * @max 1 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_REV2, 1); +PARAM_DEFINE_INT32(PWM_MAIN_REV2, 0); /** * Pre-scaler / Inverter for main output channel 3 @@ -73,7 +73,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV2, 1); * @max 1 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_REV3, 1); +PARAM_DEFINE_INT32(PWM_MAIN_REV3, 0); /** * Pre-scaler / Inverter for main output channel 4 @@ -84,7 +84,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV3, 1); * @max 1 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_REV4, 1); +PARAM_DEFINE_INT32(PWM_MAIN_REV4, 0); /** * Pre-scaler / Inverter for main output channel 5 @@ -95,7 +95,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV4, 1); * @max 1 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_REV5, 1); +PARAM_DEFINE_INT32(PWM_MAIN_REV5, 0); /** * Pre-scaler / Inverter for main output channel 6 @@ -106,7 +106,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV5, 1); * @max 1 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_REV6, 1); +PARAM_DEFINE_INT32(PWM_MAIN_REV6, 0); /** * Pre-scaler / Inverter for main output channel 7 @@ -117,7 +117,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV6, 1); * @max 1 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_REV7, 1); +PARAM_DEFINE_INT32(PWM_MAIN_REV7, 0); /** * Pre-scaler / Inverter for main output channel 8 @@ -128,4 +128,4 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV7, 1); * @max 1 * @group PWM Outputs */ -PARAM_DEFINE_INT32(PWM_MAIN_REV8, 1); +PARAM_DEFINE_INT32(PWM_MAIN_REV8, 0);