Add command to run termination failsafe

This commit is contained in:
Lorenz Meier 2014-08-27 07:59:53 +02:00
parent c79bc7073e
commit 1fbdca4ee9
1 changed files with 20 additions and 1 deletions

View File

@ -654,9 +654,28 @@ pwm_main(int argc, char *argv[])
}
}
exit(0);
} else if (!strcmp(argv[1], "terminatefail")) {
if (argc < 3) {
errx(1, "arg missing [on|off]");
} else {
if (!strcmp(argv[2], "on")) {
/* force failsafe */
ret = ioctl(fd, PWM_SERVO_SET_TERMINATION_FAILSAFE, 1);
} else {
/* force failsafe */
ret = ioctl(fd, PWM_SERVO_SET_TERMINATION_FAILSAFE, 0);
}
if (ret != OK) {
warnx("FAILED setting termination failsafe %s", argv[2]);
}
}
exit(0);
}
usage("specify arm|disarm|rate|failsafe|disarmed|min|max|test|info|forcefail");
usage("specify arm|disarm|rate|failsafe\n\t\tdisarmed|min|max|test|info|forcefail|terminatefail");
return 0;
}