mirror of
https://github.com/esphome/esphome.git
synced 2025-01-10 06:33:19 +01:00
Dont warn when buffer is just empty
This commit is contained in:
parent
a34569d314
commit
3190e86ba8
1 changed files with 5 additions and 2 deletions
|
@ -150,10 +150,13 @@ void ESPADFMicrophone::stop_() {
|
||||||
size_t ESPADFMicrophone::read(int16_t *buf, size_t len) {
|
size_t ESPADFMicrophone::read(int16_t *buf, size_t len) {
|
||||||
int bytes_read = raw_stream_read(this->raw_read_, (char *) buf, len);
|
int bytes_read = raw_stream_read(this->raw_read_, (char *) buf, len);
|
||||||
|
|
||||||
if (bytes_read == ESP_FAIL) {
|
if (bytes_read == -2 || bytes_read == 0) {
|
||||||
|
// No data in buffers to read.
|
||||||
|
return 0;
|
||||||
|
} else if (bytes_read < 0) {
|
||||||
ESP_LOGW(TAG, "Error reading from I2S microphone");
|
ESP_LOGW(TAG, "Error reading from I2S microphone");
|
||||||
this->status_set_warning();
|
this->status_set_warning();
|
||||||
return ESP_FAIL;
|
return 0;
|
||||||
}
|
}
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue