diff --git a/EKF/RingBuffer.h b/EKF/RingBuffer.h index 8f2f7312f2..f9f60d1598 100644 --- a/EKF/RingBuffer.h +++ b/EKF/RingBuffer.h @@ -127,7 +127,7 @@ public: int index = (_head - i); index = index < 0 ? _size + index : index; - if (timestamp >= _buffer[index].time_us && timestamp - _buffer[index].time_us < (uint64_t)1e5) { + if (timestamp >= _buffer[index].time_us && timestamp < _buffer[index].time_us + (uint64_t)1e5) { *sample = _buffer[index]; // Now we can set the tail to the item which