diff --git a/libraries/AP_HAL/utility/RingBuffer.h b/libraries/AP_HAL/utility/RingBuffer.h index 937c44b2c0..d24acba656 100644 --- a/libraries/AP_HAL/utility/RingBuffer.h +++ b/libraries/AP_HAL/utility/RingBuffer.h @@ -104,6 +104,12 @@ public: delete buffer; } + // Discards the buffer content, emptying it. + void clear(void) + { + buffer->clear(); + } + // return number of objects available to be read uint32_t available(void) const { return buffer->available() / sizeof(T); @@ -229,6 +235,12 @@ public: return true; } + // Discards the buffer content, emptying it. + void clear(void) + { + head = count = 0; + } + /* pop earliest object off the queue */