mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-17 12:10:36 +08:00
USB startup: Ensure that we are not talking to the peripheral too soon. Startup does not take longer due to smart rearrangement of launch calls
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
MODULE_COMMAND = nshterm
|
||||
SRCS = nshterm.c
|
||||
|
||||
MODULE_STACKSIZE = 1600
|
||||
MODULE_STACKSIZE = 1500
|
||||
|
||||
MAXOPTIMIZATION = -Os
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <apps/nsh.h>
|
||||
#include <fcntl.h>
|
||||
#include <systemlib/err.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
#include <uORB/topics/actuator_armed.h>
|
||||
|
||||
@@ -67,6 +68,11 @@ nshterm_main(int argc, char *argv[])
|
||||
int armed_fd = orb_subscribe(ORB_ID(actuator_armed));
|
||||
struct actuator_armed_s armed;
|
||||
|
||||
/* back off 800 ms to avoid running into the USB setup timing */
|
||||
while (hrt_absolute_time() < 800U * 1000U) {
|
||||
usleep(50000);
|
||||
}
|
||||
|
||||
/* try to bring up the console - stop doing so if the system gets armed */
|
||||
while (true) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user