ekf2: RingBuffer add reset method

This commit is contained in:
Daniel Agar 2023-02-02 10:16:21 -05:00
parent e3d73cd837
commit f668ea5aa6
1 changed files with 14 additions and 4 deletions

View File

@ -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};