From 317ee531888a6d5ec6c8995d1997d0b194d8e29c Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 11 Jan 2024 09:51:06 +0900 Subject: [PATCH] Fix microphone read empty check --- esphome/components/esp_adf/microphone/esp_adf_microphone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/esp_adf/microphone/esp_adf_microphone.cpp b/esphome/components/esp_adf/microphone/esp_adf_microphone.cpp index 975d9f4898..ec3b7cbee2 100644 --- a/esphome/components/esp_adf/microphone/esp_adf_microphone.cpp +++ b/esphome/components/esp_adf/microphone/esp_adf_microphone.cpp @@ -227,7 +227,7 @@ void ESPADFMicrophone::stop() { } size_t ESPADFMicrophone::read(int16_t *buf, size_t len) { - if (rb_bytes_available(this->ring_buffer_) == 0) { + if (rb_bytes_filled(this->ring_buffer_) == 0) { return 0; // No data } int bytes_read = rb_read(this->ring_buffer_, (char *) buf, len, 0);