mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 12:43:35 +08:00
IO driver: auto update param
This commit is contained in:
@@ -281,6 +281,7 @@ private:
|
|||||||
int _t_actuator_armed; ///< system armed control topic
|
int _t_actuator_armed; ///< system armed control topic
|
||||||
int _t_vehicle_control_mode;///< vehicle control mode topic
|
int _t_vehicle_control_mode;///< vehicle control mode topic
|
||||||
int _t_param; ///< parameter update topic
|
int _t_param; ///< parameter update topic
|
||||||
|
bool _param_update_force; ///< force a parameter update
|
||||||
int _t_vehicle_command; ///< vehicle command topic
|
int _t_vehicle_command; ///< vehicle command topic
|
||||||
|
|
||||||
/* advertised topics */
|
/* advertised topics */
|
||||||
@@ -514,6 +515,7 @@ PX4IO::PX4IO(device::Device *interface) :
|
|||||||
_t_actuator_armed(-1),
|
_t_actuator_armed(-1),
|
||||||
_t_vehicle_control_mode(-1),
|
_t_vehicle_control_mode(-1),
|
||||||
_t_param(-1),
|
_t_param(-1),
|
||||||
|
_param_update_force(false),
|
||||||
_t_vehicle_command(-1),
|
_t_vehicle_command(-1),
|
||||||
_to_input_rc(0),
|
_to_input_rc(0),
|
||||||
_to_outputs(0),
|
_to_outputs(0),
|
||||||
@@ -917,6 +919,8 @@ PX4IO::task_main()
|
|||||||
fds[0].fd = _t_actuator_controls_0;
|
fds[0].fd = _t_actuator_controls_0;
|
||||||
fds[0].events = POLLIN;
|
fds[0].events = POLLIN;
|
||||||
|
|
||||||
|
_param_update_force = true;
|
||||||
|
|
||||||
/* lock against the ioctl handler */
|
/* lock against the ioctl handler */
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
@@ -1017,7 +1021,8 @@ PX4IO::task_main()
|
|||||||
*/
|
*/
|
||||||
orb_check(_t_param, &updated);
|
orb_check(_t_param, &updated);
|
||||||
|
|
||||||
if (updated) {
|
if (updated || _param_update_force) {
|
||||||
|
_param_update_force = false;
|
||||||
parameter_update_s pupdate;
|
parameter_update_s pupdate;
|
||||||
orb_copy(ORB_ID(parameter_update), _t_param, &pupdate);
|
orb_copy(ORB_ID(parameter_update), _t_param, &pupdate);
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
* @max 1
|
* @max 1
|
||||||
* @group PWM Outputs
|
* @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
|
* Pre-scaler / Inverter for main output channel 2
|
||||||
@@ -62,7 +62,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV1, 1);
|
|||||||
* @max 1
|
* @max 1
|
||||||
* @group PWM Outputs
|
* @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
|
* Pre-scaler / Inverter for main output channel 3
|
||||||
@@ -73,7 +73,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV2, 1);
|
|||||||
* @max 1
|
* @max 1
|
||||||
* @group PWM Outputs
|
* @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
|
* Pre-scaler / Inverter for main output channel 4
|
||||||
@@ -84,7 +84,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV3, 1);
|
|||||||
* @max 1
|
* @max 1
|
||||||
* @group PWM Outputs
|
* @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
|
* Pre-scaler / Inverter for main output channel 5
|
||||||
@@ -95,7 +95,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV4, 1);
|
|||||||
* @max 1
|
* @max 1
|
||||||
* @group PWM Outputs
|
* @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
|
* Pre-scaler / Inverter for main output channel 6
|
||||||
@@ -106,7 +106,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV5, 1);
|
|||||||
* @max 1
|
* @max 1
|
||||||
* @group PWM Outputs
|
* @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
|
* Pre-scaler / Inverter for main output channel 7
|
||||||
@@ -117,7 +117,7 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV6, 1);
|
|||||||
* @max 1
|
* @max 1
|
||||||
* @group PWM Outputs
|
* @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
|
* Pre-scaler / Inverter for main output channel 8
|
||||||
@@ -128,4 +128,4 @@ PARAM_DEFINE_INT32(PWM_MAIN_REV7, 1);
|
|||||||
* @max 1
|
* @max 1
|
||||||
* @group PWM Outputs
|
* @group PWM Outputs
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_INT32(PWM_MAIN_REV8, 1);
|
PARAM_DEFINE_INT32(PWM_MAIN_REV8, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user