mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 20:50:36 +08:00
Commander: prevent the user from arming the system when USB was ever connected
This commit is contained in:
@@ -1494,6 +1494,18 @@ int commander_thread_main(int argc, char *argv[])
|
||||
|
||||
/* copy avionics voltage */
|
||||
status.avionics_power_rail_voltage = system_power.voltage5V_v;
|
||||
|
||||
if (status.usb_connected && !system_power.usb_connected) {
|
||||
/*
|
||||
* apparently the USB cable went away but we are still powered,
|
||||
* so lets reset to a classic non-usb state.
|
||||
*/
|
||||
usleep(100000);
|
||||
mavlink_log_critical(mavlink_fd, "USB disconnected, rebooting.")
|
||||
usleep(400000);
|
||||
px4_systemreset(false);
|
||||
}
|
||||
|
||||
status.usb_connected = system_power.usb_connected;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user