mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 18:53:34 +08:00
Fix NSH timeout logic
This commit is contained in:
@@ -66,20 +66,18 @@ nshterm_main(int argc, char *argv[])
|
|||||||
int fd = -1;
|
int fd = -1;
|
||||||
int armed_fd = orb_subscribe(ORB_ID(actuator_armed));
|
int armed_fd = orb_subscribe(ORB_ID(actuator_armed));
|
||||||
struct actuator_armed_s armed;
|
struct actuator_armed_s armed;
|
||||||
/* we assume the system does not provide arming status feedback */
|
|
||||||
bool armed_updated = false;
|
|
||||||
|
|
||||||
/* try the first 30 seconds or if arming system is ready */
|
/* try to bring up the console - stop doing so if the system gets armed */
|
||||||
while ((retries < 300) || armed_updated) {
|
while (true) {
|
||||||
|
|
||||||
/* abort if an arming topic is published and system is armed */
|
/* abort if an arming topic is published and system is armed */
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
if (orb_check(armed_fd, &updated)) {
|
orb_check(armed_fd, &updated)
|
||||||
|
if (updated) {
|
||||||
/* the system is now providing arming status feedback.
|
/* the system is now providing arming status feedback.
|
||||||
* instead of timing out, we resort to abort bringing
|
* instead of timing out, we resort to abort bringing
|
||||||
* up the terminal.
|
* up the terminal.
|
||||||
*/
|
*/
|
||||||
armed_updated = true;
|
|
||||||
orb_copy(ORB_ID(actuator_armed), armed_fd, &armed);
|
orb_copy(ORB_ID(actuator_armed), armed_fd, &armed);
|
||||||
|
|
||||||
if (armed.armed) {
|
if (armed.armed) {
|
||||||
|
|||||||
Reference in New Issue
Block a user