px4io: add safety_arm and safety_disarm commands

This will be used to make updating firmware on boot for vehicles with
no safety switch possible without power cycling. The startup script
needs to be able to force safety on to allow the reboot to work.
This commit is contained in:
Jonathan Challinger
2015-01-28 17:10:25 -08:00
committed by Lorenz Meier
parent 344e969428
commit f7d875d58d
+17 -1
View File
@@ -3267,7 +3267,23 @@ px4io_main(int argc, char *argv[])
exit(0);
}
if (!strcmp(argv[1], "safety_arm")) {
int ret = g_dev->ioctl(NULL, PWM_SERVO_SET_FORCE_SAFETY_OFF, 0);
if (ret != OK) {
printf("failed to arm px4io\n");
exit(1);
}
exit(0);
}
if (!strcmp(argv[1], "safety_disarm")) {
int ret = g_dev->ioctl(NULL, PWM_SERVO_SET_FORCE_SAFETY_ON, 0);
if (ret != OK) {
printf("failed to disarm px4io\n");
exit(1);
}
exit(0);
}
if (!strcmp(argv[1], "recovery")) {
@@ -3396,6 +3412,6 @@ px4io_main(int argc, char *argv[])
out:
errx(1, "need a command, try 'start', 'stop', 'status', 'test', 'monitor', 'debug <level>',\n"
"'recovery', 'limit <rate>', 'current', 'bind', 'checkcrc',\n"
"'recovery', 'limit <rate>', 'current', 'bind', 'checkcrc', 'safety_arm', 'safety_disarm',\n"
"'forceupdate', 'update', 'sbus1_out', 'sbus2_out', 'rssi_analog' or 'rssi_pwm'");
}