From 7ce12c31f3e838be99f1c05d43e1063a9a11d91f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 12 Mar 2026 11:19:34 -1000 Subject: [PATCH] add clear for https://github.com/esphome/esphome/pull/14733 --- esphome/core/helpers.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index a59e0553747..9d1d75b49e3 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -356,6 +356,13 @@ template class StaticRingBuffer { index_type size() const { return this->count_; } bool empty() const { return this->count_ == 0; } + /// Clear all elements (reset to empty) + void clear() { + this->head_ = 0; + this->tail_ = 0; + this->count_ = 0; + } + Iterator begin() { return Iterator(this, 0); } Iterator end() { return Iterator(this, this->count_); } ConstIterator begin() const { return ConstIterator(this, 0); }