From 491b545fabb5e6565d519081a31f0706429402d4 Mon Sep 17 00:00:00 2001 From: CSe Date: Wed, 15 Mar 2017 14:01:45 +0100 Subject: [PATCH] SITL: fix gimbal connection on Windows --- libraries/SITL/SIM_Gimbal.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/SITL/SIM_Gimbal.cpp b/libraries/SITL/SIM_Gimbal.cpp index 598fb2077f..41c7e3d45f 100644 --- a/libraries/SITL/SIM_Gimbal.cpp +++ b/libraries/SITL/SIM_Gimbal.cpp @@ -181,6 +181,11 @@ void Gimbal::update(void) */ void Gimbal::send_report(void) { + if (AP_HAL::millis() < 10000) { + // simulated aircraft don't appear until 10s after startup. This avoids a windows + // threading issue with non-blocking sockets and the initial wait on uartA + return; + } if (!mavlink.connected && mav_socket.connect(target_address, target_port)) { ::printf("Gimbal connected to %s:%u\n", target_address, (unsigned)target_port); mavlink.connected = true;