mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 09:13:32 +08:00
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:
committed by
Lorenz Meier
parent
344e969428
commit
f7d875d58d
@@ -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'");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user