diff options
Diffstat (limited to 'src/systemcmds/tests/test_ppm_loopback.c')
-rw-r--r-- | src/systemcmds/tests/test_ppm_loopback.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/systemcmds/tests/test_ppm_loopback.c b/src/systemcmds/tests/test_ppm_loopback.c index 6866531d7..c802cdf0c 100644 --- a/src/systemcmds/tests/test_ppm_loopback.c +++ b/src/systemcmds/tests/test_ppm_loopback.c @@ -77,6 +77,7 @@ int test_ppm_loopback(int argc, char *argv[]) unsigned servo_count; result = ioctl(servo_fd, PWM_SERVO_GET_COUNT, (unsigned long)&servo_count); + if (result != OK) { warnx("PWM_SERVO_GET_COUNT"); return ERROR; @@ -97,7 +98,7 @@ int test_ppm_loopback(int argc, char *argv[]) // result = ioctl(servo_fd, PWM_SERVO_SET_ARM_OK, 0); // if (result != OK) // warnx("FAIL: PWM_SERVO_SET_ARM_OK"); - // tell output device that the system is armed (it will output values if safety is off) + // tell output device that the system is armed (it will output values if safety is off) // result = ioctl(servo_fd, PWM_SERVO_ARM, 0); // if (result != OK) // warnx("FAIL: PWM_SERVO_ARM"); @@ -105,15 +106,17 @@ int test_ppm_loopback(int argc, char *argv[]) int pwm_values[] = {1200, 1300, 1900, 1700, 1500, 1250, 1800, 1400}; - for (unsigned i = 0; (i < servo_count) && (i < sizeof(pwm_values) / sizeof(pwm_values[0])); i++) { - result = ioctl(servo_fd, PWM_SERVO_SET(i), pwm_values[i]); - if (result) { - (void)close(servo_fd); - return ERROR; - } else { - warnx("channel %d set to %d", i, pwm_values[i]); - } - } + for (unsigned i = 0; (i < servo_count) && (i < sizeof(pwm_values) / sizeof(pwm_values[0])); i++) { + result = ioctl(servo_fd, PWM_SERVO_SET(i), pwm_values[i]); + + if (result) { + (void)close(servo_fd); + return ERROR; + + } else { + warnx("channel %d set to %d", i, pwm_values[i]); + } + } warnx("servo count: %d", servo_count); @@ -165,6 +168,7 @@ int test_ppm_loopback(int argc, char *argv[]) return ERROR; } } + } else { warnx("failed reading RC input data"); return ERROR; |