From 5b9fc1b1467c7b9842ee18c41a63cd3a264cea2a Mon Sep 17 00:00:00 2001 From: murata Date: Tue, 14 Apr 2020 00:49:02 +0900 Subject: [PATCH] AP_Baro: Fix timestamp wrapping --- libraries/AP_Baro/AP_Baro_BMP085.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Baro/AP_Baro_BMP085.cpp b/libraries/AP_Baro/AP_Baro_BMP085.cpp index 770c77fee9..6857d07fcf 100644 --- a/libraries/AP_Baro/AP_Baro_BMP085.cpp +++ b/libraries/AP_Baro/AP_Baro_BMP085.cpp @@ -318,7 +318,7 @@ bool AP_Baro_BMP085::_data_ready() // No EOC pin: use time from last read instead. if (_state == 0) { - return AP_HAL::millis() > _last_temp_read_command_time + 5; + return AP_HAL::millis() - _last_temp_read_command_time > 5u; } uint32_t conversion_time_msec; @@ -339,5 +339,5 @@ bool AP_Baro_BMP085::_data_ready() break; } - return AP_HAL::millis() > _last_press_read_command_time + conversion_time_msec; + return AP_HAL::millis() - _last_press_read_command_time > conversion_time_msec; }