Skip to content

Commit

Permalink
AP_NavEKF: correct setting of _filled
Browse files Browse the repository at this point in the history
Co-authored-by: luweiagi <[email protected]>
  • Loading branch information
peterbarker and luweiagi committed Apr 6, 2024
1 parent ab69c9e commit c36b6b4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libraries/AP_NavEKF/EKF_Buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,14 @@ void ekf_imu_buffer::push_youngest_element(const void *element)
return;
}
// push youngest to the buffer
_youngest = (_youngest+1) % _size;
_youngest = (_youngest+1);
if (_youngest == _size) {
_youngest = 0;
_filled = true;
}
memcpy(get_offset(_youngest), element, elsize);
// set oldest data index
_oldest = (_youngest+1) % _size;
if (_oldest == 0) {
_filled = true;
}
}

// retrieve the oldest data from the ring buffer tail
Expand Down

0 comments on commit c36b6b4

Please sign in to comment.