mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 19:23:35 +08:00
mavlink: stop fixes
This commit is contained in:
@@ -308,7 +308,7 @@ Mavlink::destroy_all_instances()
|
|||||||
usleep(10000);
|
usleep(10000);
|
||||||
iterations++;
|
iterations++;
|
||||||
|
|
||||||
if (iterations > 10000) {
|
if (iterations > 1000) {
|
||||||
warnx("ERROR: Couldn't stop all mavlink instances.");
|
warnx("ERROR: Couldn't stop all mavlink instances.");
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
@@ -1850,18 +1850,23 @@ Mavlink::task_main(int argc, char *argv[])
|
|||||||
delete _subscribe_to_stream;
|
delete _subscribe_to_stream;
|
||||||
_subscribe_to_stream = nullptr;
|
_subscribe_to_stream = nullptr;
|
||||||
|
|
||||||
|
warnv("waiting for UART receive thread");
|
||||||
|
|
||||||
/* wait for threads to complete */
|
/* wait for threads to complete */
|
||||||
pthread_join(receive_thread, NULL);
|
pthread_join(receive_thread, NULL);
|
||||||
|
|
||||||
/* Reset the UART flags to original state */
|
/* reset the UART flags to original state */
|
||||||
tcsetattr(_uart, TCSANOW, &uart_config_original);
|
tcsetattr(_uart, TCSANOW, &uart_config_original);
|
||||||
|
|
||||||
|
/* close UART */
|
||||||
|
close(_uart);
|
||||||
|
|
||||||
/* destroy log buffer */
|
/* destroy log buffer */
|
||||||
mavlink_logbuffer_destroy(&lb);
|
mavlink_logbuffer_destroy(&lb);
|
||||||
|
|
||||||
thread_running = false;
|
thread_running = false;
|
||||||
|
|
||||||
warnx("exiting.");
|
warnx("exiting");
|
||||||
|
|
||||||
_mavlink_task = -1;
|
_mavlink_task = -1;
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
|||||||
@@ -795,7 +795,7 @@ MavlinkReceiver::receive_thread(void *arg)
|
|||||||
{
|
{
|
||||||
int uart_fd = _mavlink->get_uart_fd();
|
int uart_fd = _mavlink->get_uart_fd();
|
||||||
|
|
||||||
const int timeout = 1000;
|
const int timeout = 500;
|
||||||
uint8_t buf[32];
|
uint8_t buf[32];
|
||||||
|
|
||||||
mavlink_message_t msg;
|
mavlink_message_t msg;
|
||||||
|
|||||||
Reference in New Issue
Block a user