1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-01 18:50:55 +00:00

Fix microphone read empty check

This commit is contained in:
Jesse Hills 2024-01-11 09:51:06 +09:00
parent 6e09f4b4d7
commit 317ee53188
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -227,7 +227,7 @@ void ESPADFMicrophone::stop() {
} }
size_t ESPADFMicrophone::read(int16_t *buf, size_t len) { 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 return 0; // No data
} }
int bytes_read = rb_read(this->ring_buffer_, (char *) buf, len, 0); int bytes_read = rb_read(this->ring_buffer_, (char *) buf, len, 0);