diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-01-26 08:59:19 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-01-26 08:59:19 +0100 |
commit | 18d756dd599f93abcd5dc89f323a5df77384ceac (patch) | |
tree | db5d561379010436124979c0d4abd99e7f0e8890 /src/systemcmds/nshterm | |
parent | a7f6c0ea3a37688333a288dc53384d2c948c3ca0 (diff) | |
download | px4-firmware-18d756dd599f93abcd5dc89f323a5df77384ceac.tar.gz px4-firmware-18d756dd599f93abcd5dc89f323a5df77384ceac.tar.bz2 px4-firmware-18d756dd599f93abcd5dc89f323a5df77384ceac.zip |
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
Diffstat (limited to 'src/systemcmds/nshterm')
-rw-r--r-- | src/systemcmds/nshterm/module.mk | 2 | ||||
-rw-r--r-- | src/systemcmds/nshterm/nshterm.c | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/systemcmds/nshterm/module.mk b/src/systemcmds/nshterm/module.mk index a12bc369e..4e2710572 100644 --- a/src/systemcmds/nshterm/module.mk +++ b/src/systemcmds/nshterm/module.mk @@ -38,7 +38,7 @@ MODULE_COMMAND = nshterm SRCS = nshterm.c -MODULE_STACKSIZE = 1600 +MODULE_STACKSIZE = 1500 MAXOPTIMIZATION = -Os diff --git a/src/systemcmds/nshterm/nshterm.c b/src/systemcmds/nshterm/nshterm.c index ceaea35b6..50547a562 100644 --- a/src/systemcmds/nshterm/nshterm.c +++ b/src/systemcmds/nshterm/nshterm.c @@ -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) { |