Skip to content

Commit 24e991c

Browse files
authored
Update esp32-hal-uart.c
1 parent 2b05891 commit 24e991c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cores/esp32/esp32-hal-uart.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static uart_t _uart_bus_array[] = {
7171

7272
// solves issue https://github.com/espressif/arduino-esp32/issues/6032
7373
// baudrate must be multiplied when CPU Frequency is lower than APB 80MHz
74-
uint32_t _get_effective_baudrate(uint32_t baudrate)
74+
uint32_t _get_effective_baudrate(uint32_t baudrate)
7575
{
7676
uint32_t Freq = getApbFrequency()/1000000;
7777
if (Freq < 80) {
@@ -167,7 +167,7 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
167167
ESP_ERROR_CHECK(uart_param_config(uart_nr, &uart_config));
168168
ESP_ERROR_CHECK(uart_set_pin(uart_nr, txPin, rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
169169

170-
// Is it right or the idea is to swap rx and tx pins?
170+
// Is it right or the idea is to swap rx and tx pins?
171171
if (inverted) {
172172
// invert signal for both Rx and Tx
173173
ESP_ERROR_CHECK(uart_set_line_inverse(uart_nr, UART_SIGNAL_TXD_INV | UART_SIGNAL_RXD_INV));
@@ -184,7 +184,7 @@ void uartEnd(uart_t* uart)
184184
if(uart == NULL) {
185185
return;
186186
}
187-
187+
188188
UART_MUTEX_LOCK();
189189
uart_driver_delete(uart->num);
190190
UART_MUTEX_UNLOCK();
@@ -421,11 +421,12 @@ int log_printf(const char *format, ...)
421421
va_list copy;
422422
va_start(arg, format);
423423
va_copy(copy, arg);
424-
len = vsnprintf(NULL, 0, format, arg);
424+
len = vsnprintf(NULL, 0, format, copy);
425425
va_end(copy);
426426
if(len >= sizeof(loc_buf)){
427427
temp = (char*)malloc(len+1);
428428
if(temp == NULL) {
429+
va_end(arg);
429430
return 0;
430431
}
431432
}
@@ -553,7 +554,6 @@ void uartStartDetectBaudrate(uart_t *uart) {
553554
//hw->conf0.autobaud_en = 0;
554555
//hw->conf0.autobaud_en = 1;
555556
#elif CONFIG_IDF_TARGET_ESP32S3
556-
557557
#else
558558
hw->auto_baud.glitch_filt = 0x08;
559559
hw->auto_baud.en = 0;

0 commit comments

Comments
 (0)