From 285ddd410a559449b7e2cbab9b2b10e850efbd08 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 7 Jan 2026 22:13:36 +0100 Subject: added APP <-> FE310 bridge SPI messages; enabled esp32 wake from deep sleep; IP tunnel for app module supports NAT and port forwadring; introduced EOSMessage struct for SPI messages; --- fw/esp32/components/eos/cell_pcm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 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 3f5089d..67a3a08 100644 --- a/fw/esp32/components/eos/cell_pcm.c +++ b/fw/esp32/components/eos/cell_pcm.c @@ -23,16 +23,20 @@ static i2s_chan_handle_t rx_chan; static const char *TAG = "EOS CELL PCM"; static void pcm_rcvr_task(void *pvParameters) { - unsigned char *buffer; + EOSMessage msg; size_t size_r; esp_err_t ret; int done = 0; int rv; while (!done) { - buffer = eos_net_alloc(); - buffer[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_PCM; - ret = i2s_channel_read(rx_chan, buffer + 1, PCM_RX_WM, &size_r, 1000); + eos_net_alloc(&msg); + if (msg.size < PCM_RX_WM + 1) { + eos_net_free(&msg); + return; + } + msg.buffer[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_PCM; + ret = i2s_channel_read(rx_chan, msg.buffer + 1, PCM_RX_WM, &size_r, 1000); switch (ret) { case ESP_OK: { assert(size_r == PCM_RX_WM); @@ -51,10 +55,10 @@ static void pcm_rcvr_task(void *pvParameters) { } } if (ret == ESP_OK) { - rv = eos_net_send(EOS_NET_MTYPE_CELL, buffer, size_r + 1); + rv = eos_net_send(EOS_NET_MTYPE_CELL, &msg, size_r + 1); if (rv) ESP_LOGE(TAG, "NET SEND ERR:%d", rv); } else { - eos_net_free(buffer); + eos_net_free(&msg); } } vTaskDelete(NULL); -- cgit v1.2.3