mavlink: shell expand locking (#19308)

- on some H7 boards (cuav x7pro tested) there's an occasional hard fault when starting the mavlink shell that is no longer reproducible with the slightly expanded locking
 - this is likely just changing the timing (holding the sched lock for longer), but this should be harmless for now until we can identify the root cause
This commit is contained in:
Daniel Agar 2022-04-25 11:53:22 -04:00 committed by GitHub
parent af839c828d
commit 6359c8c008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

@ -1334,18 +1334,20 @@ MavlinkShell *
Mavlink::get_shell()
{
if (!_mavlink_shell) {
_mavlink_shell = new MavlinkShell();
MavlinkShell *shell = new MavlinkShell();
if (!_mavlink_shell) {
if (!shell) {
PX4_ERR("Failed to allocate a shell");
} else {
int ret = _mavlink_shell->start();
int ret = shell->start();
if (ret != 0) {
if (ret == 0) {
_mavlink_shell = shell;
} else {
PX4_ERR("Failed to start shell (%i)", ret);
delete _mavlink_shell;
_mavlink_shell = nullptr;
delete shell;
}
}
}

View File

@ -148,14 +148,14 @@ int MavlinkShell::start()
close(fd_backups[i]);
}
#ifdef __PX4_NUTTX
sched_unlock();
#endif /* __PX4_NUTTX */
//close unused pipe fd's
close(_shell_fds[0]);
close(_shell_fds[1]);
#ifdef __PX4_NUTTX
sched_unlock();
#endif /* __PX4_NUTTX */
return ret;
}