Skip to content

Commit 07bf7be

Browse files
authored
Merge branch 'master' into esp-idf-v5.1-libs
2 parents 9507124 + 18164e6 commit 07bf7be

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Diff for: cores/esp32/HWCDC.cpp

+8-11
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ void HWCDC::setTxTimeoutMs(uint32_t timeout){
254254

255255
size_t HWCDC::setTxBufferSize(size_t tx_queue_len){
256256
if(tx_ring_buf){
257-
if(!tx_queue_len){
258-
vRingbufferDelete(tx_ring_buf);
259-
tx_ring_buf = NULL;
260-
}
257+
vRingbufferDelete(tx_ring_buf);
258+
tx_ring_buf = NULL;
259+
}
260+
if(!tx_queue_len){
261261
return 0;
262262
}
263263
tx_ring_buf = xRingbufferCreate(tx_queue_len, RINGBUF_TYPE_BYTEBUF);
@@ -355,19 +355,16 @@ void HWCDC::flush(void)
355355

356356
size_t HWCDC::setRxBufferSize(size_t rx_queue_len){
357357
if(rx_queue){
358-
if(!rx_queue_len){
359-
vQueueDelete(rx_queue);
360-
rx_queue = NULL;
361-
}
358+
vQueueDelete(rx_queue);
359+
rx_queue = NULL;
360+
}
361+
if(!rx_queue_len){
362362
return 0;
363363
}
364364
rx_queue = xQueueCreate(rx_queue_len, sizeof(uint8_t));
365365
if(!rx_queue){
366366
return 0;
367367
}
368-
if(!tx_ring_buf){
369-
tx_ring_buf = xRingbufferCreate(rx_queue_len, RINGBUF_TYPE_BYTEBUF);
370-
}
371368
return rx_queue_len;
372369
}
373370

0 commit comments

Comments
 (0)