From d9dd20ee9fcb7ce92cf406745a8cc409e7d34f8b Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Wed, 24 May 2023 20:28:18 -0300 Subject: [PATCH 1/2] Fixes HWCDC::end() There is a missing `tx_lock = NULL;` --- cores/esp32/HWCDC.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cores/esp32/HWCDC.cpp b/cores/esp32/HWCDC.cpp index 25744f0b0a3..95887ef6865 100644 --- a/cores/esp32/HWCDC.cpp +++ b/cores/esp32/HWCDC.cpp @@ -195,6 +195,7 @@ void HWCDC::end() intr_handle = NULL; if(tx_lock != NULL) { vSemaphoreDelete(tx_lock); + tx_lock = NULL; } setRxBufferSize(0); setTxBufferSize(0); From aae1d13491f01e7767b9acee1177767aff97b956 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 25 May 2023 19:48:02 -0300 Subject: [PATCH 2/2] Update HWCDC.cpp Initialize rx_data_buf[] with zeros. --- cores/esp32/HWCDC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp32/HWCDC.cpp b/cores/esp32/HWCDC.cpp index 95887ef6865..6ec8625cff9 100644 --- a/cores/esp32/HWCDC.cpp +++ b/cores/esp32/HWCDC.cpp @@ -28,7 +28,7 @@ ESP_EVENT_DEFINE_BASE(ARDUINO_HW_CDC_EVENTS); static RingbufHandle_t tx_ring_buf = NULL; static xQueueHandle rx_queue = NULL; -static uint8_t rx_data_buf[64]; +static uint8_t rx_data_buf[64] = {0}; static intr_handle_t intr_handle = NULL; static volatile bool initial_empty = false; static xSemaphoreHandle tx_lock = NULL;