Skip to content

Commit e681a94

Browse files
authored
fix(uart_test): do not detach both UART pins
Updated UART test configuration to detach TX pin while keeping RX pin active. Adjusted assertions to reflect the new pin settings.
1 parent c329742 commit e681a94

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/validation/uart/uart.ino

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,19 +377,23 @@ void change_pins_test(void) {
377377
UARTTestConfig &config = *uart_test_configs[0];
378378
// pinMode will force enabling the internal pullup resistor (IDF 5.3.2 Change)
379379
pinMode(NEW_RX1, INPUT_PULLUP);
380-
config.serial.setPins(NEW_RX1, NEW_TX1);
380+
// Detaching both pins will result in stoping the UART driver
381+
// Only detach one of the pins
382+
config.serial.setPins(NEW_RX1, /*NEW_TX1*/ -1);
381383
TEST_ASSERT_EQUAL(NEW_RX1, uart_get_RxPin(config.uart_num));
382-
TEST_ASSERT_EQUAL(NEW_TX1, uart_get_TxPin(config.uart_num));
384+
//TEST_ASSERT_EQUAL(NEW_TX1, uart_get_TxPin(config.uart_num));
383385

384386
uart_internal_loopback(config.uart_num, NEW_RX1);
385387
config.transmit_and_check_msg("using new pins");
386388
} else {
387389
for (int i = 0; i < TEST_UART_NUM; i++) {
388390
UARTTestConfig &config = *uart_test_configs[i];
389391
UARTTestConfig &next_uart = *uart_test_configs[(i + 1) % TEST_UART_NUM];
390-
config.serial.setPins(next_uart.default_rx_pin, next_uart.default_tx_pin);
392+
// Detaching both pins will result in stoping the UART driver
393+
// Only detach one of the pins
394+
config.serial.setPins(next_uart.default_rx_pin, /*next_uart.default_tx_pin*/ -1);
391395
TEST_ASSERT_EQUAL(uart_get_RxPin(config.uart_num), next_uart.default_rx_pin);
392-
TEST_ASSERT_EQUAL(uart_get_TxPin(config.uart_num), next_uart.default_tx_pin);
396+
//TEST_ASSERT_EQUAL(uart_get_TxPin(config.uart_num), next_uart.default_tx_pin);
393397

394398
uart_internal_loopback(config.uart_num, next_uart.default_rx_pin);
395399
config.transmit_and_check_msg("using new pins");
@@ -398,7 +402,6 @@ void change_pins_test(void) {
398402

399403
Serial.println("Change pins test successful");
400404
}
401-
402405
// This test checks if the auto baudrate detection works on ESP32 and ESP32-S2
403406
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
404407
void auto_baudrate_test(void) {
@@ -450,7 +453,7 @@ void periman_test(void) {
450453

451454
for (auto *ref : uart_test_configs) {
452455
UARTTestConfig &config = *ref;
453-
// detaching both pins will result in stoping the UART driver
456+
// Detaching both pins will result in stoping the UART driver
454457
// Only detach one of the pins
455458
Wire.begin(config.default_rx_pin, /*config.default_tx_pin*/ -1);
456459
config.recv_msg = "";

0 commit comments

Comments
 (0)