Merge pull request #3053 from PX4/usb_enforce

Commander: prevent the user from arming the system with USB
This commit is contained in:
Roman Bapst
2015-10-30 17:51:41 +01:00
2 changed files with 20 additions and 1 deletions
+12
View File
@@ -1512,6 +1512,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;
}
}