mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
ensure PWM_DISARMED value is sent to ESCs if snapdragon does not send anything else
This commit is contained in:
@@ -75,6 +75,7 @@ static int _uart_fd = -1;
|
||||
int _pwm_fd = -1;
|
||||
static bool _flow_control_enabled = false;
|
||||
int _rc_sub = -1;
|
||||
uint16_t _pwm_disarmed;
|
||||
|
||||
hrt_abstime _last_actuator_controls_received = 0;
|
||||
|
||||
@@ -128,6 +129,8 @@ void task_main(int argc, char *argv[])
|
||||
fds[0].fd = _uart_fd;
|
||||
fds[0].events = POLLIN;
|
||||
|
||||
param_get(param_find("PWM_DISARMED"), &_pwm_disarmed);
|
||||
|
||||
while (!_task_should_exit) {
|
||||
|
||||
// wait for up to 100ms for data
|
||||
@@ -204,9 +207,9 @@ void handle_message(mavlink_message_t *msg)
|
||||
void set_pwm_output(mavlink_actuator_control_target_t *actuator_controls)
|
||||
{
|
||||
if (actuator_controls == nullptr) {
|
||||
// Without valid argument, set all channels to 0
|
||||
// Without valid argument, set all channels to PWM_DISARMED
|
||||
for (unsigned i = 0; i < PWM_OUTPUT_MAX_CHANNELS; i++) {
|
||||
int ret = ::ioctl(_pwm_fd, PWM_SERVO_SET(i), 0);
|
||||
int ret = ::ioctl(_pwm_fd, PWM_SERVO_SET(i), _pwm_disarmed);
|
||||
|
||||
if (ret != OK) {
|
||||
PX4_ERR("PWM_SERVO_SET(%d)", i);
|
||||
|
||||
Reference in New Issue
Block a user