From 482ce55d579a56984abb633a3e9d1edf7eddd665 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 21 Apr 2016 13:32:38 +0200 Subject: [PATCH] px4io: allow 0 as a PWM signal --- src/drivers/px4io/px4io.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index ecaf156d7e..383a6d4d0f 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -2656,7 +2656,12 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg) /* TODO: we could go lower for e.g. TurboPWM */ unsigned channel = cmd - PWM_SERVO_SET(0); - if ((channel >= _max_actuators) || (arg < PWM_LOWEST_MIN) || (arg > PWM_HIGHEST_MAX)) { + PX4_INFO("pwm is %d (%d, %d)", arg, PWM_LOWEST_MIN, PWM_HIGHEST_MAX); + + /* PWM needs to be either 0 or in the valid range. */ + if ((arg != 0) && ((channel >= _max_actuators) || + (arg < PWM_LOWEST_MIN) || + (arg > PWM_HIGHEST_MAX))) { ret = -EINVAL; } else {