diff --git a/cores/esp8266/core_esp8266_i2s.c b/cores/esp8266/core_esp8266_i2s.c index 119e8e78a6..b98005837a 100644 --- a/cores/esp8266/core_esp8266_i2s.c +++ b/cores/esp8266/core_esp8266_i2s.c @@ -66,7 +66,7 @@ bool ICACHE_FLASH_ATTR i2s_is_empty(){ } int16_t ICACHE_FLASH_ATTR i2s_available(){ - return (SLC_BUF_CNT - i2s_slc_queue_len) * SLC_BUF_LEN; + return (i2s_slc_queue_len * SLC_BUF_LEN) + (SLC_BUF_LEN - i2s_curr_slc_buf_pos); } uint32_t ICACHE_FLASH_ATTR i2s_slc_queue_next_item(){ //pop the top off the queue @@ -195,6 +195,47 @@ bool ICACHE_FLASH_ATTR i2s_write_sample_nb(uint32_t sample) { return true; } +#define MIN(a,b) (a