mavlink: stop fixes

This commit is contained in:
Anton Babushkin 2014-03-01 17:12:46 +04:00
parent c47ef70dd9
commit c10ef78753
2 changed files with 9 additions and 4 deletions

View File

@ -308,7 +308,7 @@ Mavlink::destroy_all_instances()
usleep(10000);
iterations++;
if (iterations > 10000) {
if (iterations > 1000) {
warnx("ERROR: Couldn't stop all mavlink instances.");
return ERROR;
}
@ -1850,18 +1850,23 @@ Mavlink::task_main(int argc, char *argv[])
delete _subscribe_to_stream;
_subscribe_to_stream = nullptr;
warnv("waiting for UART receive thread");
/* wait for threads to complete */
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);
/* close UART */
close(_uart);
/* destroy log buffer */
mavlink_logbuffer_destroy(&lb);
thread_running = false;
warnx("exiting.");
warnx("exiting");
_mavlink_task = -1;
_exit(0);

View File

@ -795,7 +795,7 @@ MavlinkReceiver::receive_thread(void *arg)
{
int uart_fd = _mavlink->get_uart_fd();
const int timeout = 1000;
const int timeout = 500;
uint8_t buf[32];
mavlink_message_t msg;