From 8bc5e3bd7f74642ccbf3def0ce9b4e51d395f915 Mon Sep 17 00:00:00 2001 From: Balduin Date: Thu, 7 May 2026 11:46:43 +0200 Subject: [PATCH] refactor(control_allocator): reorder inequality to avoid uint wrapping and add unit to variable name --- src/modules/control_allocator/ActuatorGroupPreflightCheck.cpp | 2 +- src/modules/control_allocator/ActuatorGroupPreflightCheck.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/control_allocator/ActuatorGroupPreflightCheck.cpp b/src/modules/control_allocator/ActuatorGroupPreflightCheck.cpp index cb666647aa..23299d55d6 100644 --- a/src/modules/control_allocator/ActuatorGroupPreflightCheck.cpp +++ b/src/modules/control_allocator/ActuatorGroupPreflightCheck.cpp @@ -168,7 +168,7 @@ void ActuatorGroupPreflightCheck::updateState(hrt_abstime now) } } - if (now - _started >= PREFLIGHT_CHECK_DURATION) { + if (now >= _started + PREFLIGHT_CHECK_DURATION_US) { _running = false; sendAck(_last_command, vehicle_command_ack_s::VEHICLE_CMD_RESULT_ACCEPTED, now); } diff --git a/src/modules/control_allocator/ActuatorGroupPreflightCheck.hpp b/src/modules/control_allocator/ActuatorGroupPreflightCheck.hpp index ba16d9c798..4a64b2cde4 100644 --- a/src/modules/control_allocator/ActuatorGroupPreflightCheck.hpp +++ b/src/modules/control_allocator/ActuatorGroupPreflightCheck.hpp @@ -84,7 +84,7 @@ public: ActuatorEffectiveness &effectiveness); private: - static constexpr hrt_abstime PREFLIGHT_CHECK_DURATION = 500'000; // 500 ms + static constexpr hrt_abstime PREFLIGHT_CHECK_DURATION_US = 500'000; // 500 ms static bool isThrust(uint8_t group); static bool isKnownGroup(uint8_t group);