From c7b64dc448c6fb264b0767b0bf7a403dae8e1943 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Fri, 23 Jun 2023 14:23:22 +0900 Subject: [PATCH] AP_Mount: Siyi health check avoids race condition --- libraries/AP_Mount/AP_Mount_Siyi.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Mount/AP_Mount_Siyi.cpp b/libraries/AP_Mount/AP_Mount_Siyi.cpp index 6ea9b465ff..32eb917a49 100644 --- a/libraries/AP_Mount/AP_Mount_Siyi.cpp +++ b/libraries/AP_Mount/AP_Mount_Siyi.cpp @@ -150,7 +150,8 @@ bool AP_Mount_Siyi::healthy() const } // unhealthy if attitude information NOT received recently - if (AP_HAL::millis() - _last_current_angle_rad_ms > 1000) { + const uint32_t now_ms = AP_HAL::millis(); + if (now_ms - _last_current_angle_rad_ms > 1000) { return false; }