mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-18 09:40:34 +08:00
ekf2: RingBuffer add reset method
This commit is contained in:
@@ -81,10 +81,7 @@ public:
|
||||
|
||||
_size = size;
|
||||
|
||||
_head = 0;
|
||||
_tail = 0;
|
||||
|
||||
_first_write = true;
|
||||
reset();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -171,6 +168,19 @@ public:
|
||||
return count;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
if (_buffer) {
|
||||
for (uint8_t i = 0; i < _size; i++) {
|
||||
_buffer[i] = {};
|
||||
}
|
||||
|
||||
_head = 0;
|
||||
_tail = 0;
|
||||
_first_write = true;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
data_type *_buffer{nullptr};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user