mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 06:03:35 +08:00
Navigator: Only indicate timeout if we really time out
This commit is contained in:
@@ -314,6 +314,8 @@ Navigator::task_main()
|
|||||||
fds[0].fd = _global_pos_sub;
|
fds[0].fd = _global_pos_sub;
|
||||||
fds[0].events = POLLIN;
|
fds[0].events = POLLIN;
|
||||||
|
|
||||||
|
bool global_pos_available_once = false;
|
||||||
|
|
||||||
while (!_task_should_exit) {
|
while (!_task_should_exit) {
|
||||||
|
|
||||||
/* wait for up to 200ms for data */
|
/* wait for up to 200ms for data */
|
||||||
@@ -321,7 +323,9 @@ Navigator::task_main()
|
|||||||
|
|
||||||
if (pret == 0) {
|
if (pret == 0) {
|
||||||
/* timed out - periodic check for _task_should_exit, etc. */
|
/* timed out - periodic check for _task_should_exit, etc. */
|
||||||
PX4_WARN("navigator timed out");
|
if (global_pos_available_once) {
|
||||||
|
PX4_WARN("navigator timed out");
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (pret < 0) {
|
} else if (pret < 0) {
|
||||||
@@ -330,6 +334,8 @@ Navigator::task_main()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global_pos_available_once = true;
|
||||||
|
|
||||||
perf_begin(_loop_perf);
|
perf_begin(_loop_perf);
|
||||||
|
|
||||||
if (_mavlink_fd < 0 && hrt_absolute_time() > mavlink_open_time) {
|
if (_mavlink_fd < 0 && hrt_absolute_time() > mavlink_open_time) {
|
||||||
|
|||||||
Reference in New Issue
Block a user