From 6a4b3ef0e72ee134b81a523ce41fd4c45f3b4429 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 4 Sep 2022 18:43:50 +0200 Subject: fixed wifi and cell --- fw/esp32/components/eos/cell_pcm.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'fw/esp32/components/eos/cell_pcm.c') diff --git a/fw/esp32/components/eos/cell_pcm.c b/fw/esp32/components/eos/cell_pcm.c index 57258c9..0648be7 100644 --- a/fw/esp32/components/eos/cell_pcm.c +++ b/fw/esp32/components/eos/cell_pcm.c @@ -44,11 +44,6 @@ static const char *TAG = "EOS PCM"; static void i2s_event_task(void *pvParameters) { i2s_event_t event; - unsigned char *buf; - unsigned char _type; - size_t bytes_w; - ssize_t bytes_r; - uint16_t bytes_e; ssize_t hold_bytes_r = 0; unsigned char *hold_buf = NULL; char hold_cnt = 0; @@ -57,9 +52,16 @@ static void i2s_event_task(void *pvParameters) { // Waiting for I2S event. if (xQueueReceive(i2s_queue, &event, portMAX_DELAY)) { switch (event.type) { - case I2S_EVENT_RX_DONE: + case I2S_EVENT_RX_DONE: { + ssize_t bytes_r; + size_t bytes_w; + uint16_t bytes_e; + unsigned char _type; + unsigned char *buf; + // Event of I2S receiving data if (!hold_cnt) { + buf = eos_net_alloc(); buf[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_PCM; bytes_r = eos_cell_pcm_read(buf + 1, PCM_MIC_WM); @@ -91,14 +93,17 @@ static void i2s_event_task(void *pvParameters) { xSemaphoreGive(mutex); } break; + } - case I2S_EVENT_DMA_ERROR: + case I2S_EVENT_DMA_ERROR: { ESP_LOGE(TAG, "*** I2S DMA ERROR ***"); break; + } - case I2S_EVENT_MAX: + case I2S_EVENT_MAX: { hold_cnt = PCM_HOLD_CNT_RX; break; + } default: break; -- cgit v1.2.3