forked from Archive/PX4-Autopilot
ekf2: RingBuffer add reset method
This commit is contained in:
parent
e3d73cd837
commit
f668ea5aa6
|
@ -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};
|
||||
|
||||
|
|
Loading…
Reference in New Issue