fix(uart): Fixes UART CI script to work with Arduino Core 3.2.x (#11077)

* fix(uart): ci uart test fail on esp32s2 after uart break

* fix(uart): ci error with change pins test on ESP32

* fix(uart): ci test with perimgr using esp32 fails

* feat(uart): avoid electrical noise before setting pins

* fix(uart_ci): fixes the UART CI sketch due to IDF 5.3 pull up change

* fix(uart_ci): keeping previous formatting and applying changes

* feat(uart_ci): trick for passing esp32 wokwi ci test

Wokwi ESP32 fails with the pinMode() in line 56|58
Real device with Arduino Core 3.1.2 and 3.2 needs it to fix the issue.
This patch will skip the pinMode() when compiling with Wokwi and make it pass the CI test case.

* feat(uart_ci): reverting the wokwi patch, once it didn't make any difference

* fix(wokwi): Change CPU freq to 80

* fix(wokwi): Change CPU freq to 120

* ci(pre-commit): Apply automatic fixes

* fix(uart_ci): fixes a couple typos in commentatries

---------

Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
Sugar Glider 2025-03-17 12:36:10 -03:00 committed by GitHub
parent ba2ab1e4bb
commit 74ee9df48c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -6,7 +6,7 @@
{ {
"type": "board-esp32-devkit-c-v4", "type": "board-esp32-devkit-c-v4",
"id": "esp", "id": "esp",
"attrs": { "cpuFrequency": "40" } "attrs": { "cpuFrequency": "120" }
} }
], ],
"connections": [ "connections": [

View file

@ -53,6 +53,8 @@ public:
: uart_num(num), serial(serial_ref), peeked_char(-1), default_rx_pin(rx_pin), default_tx_pin(tx_pin), recv_msg("") {} : uart_num(num), serial(serial_ref), peeked_char(-1), default_rx_pin(rx_pin), default_tx_pin(tx_pin), recv_msg("") {}
void begin(unsigned long baudrate) { void begin(unsigned long baudrate) {
// pinMode will force enabling the internal pullup resistor (IDF 5.3.2 Change)
pinMode(default_rx_pin, INPUT_PULLUP);
serial.begin(baudrate, SERIAL_8N1, default_rx_pin, default_tx_pin); serial.begin(baudrate, SERIAL_8N1, default_rx_pin, default_tx_pin);
while (!serial) { while (!serial) {
delay(10); delay(10);
@ -365,6 +367,8 @@ void change_pins_test(void) {
if (TEST_UART_NUM == 1) { if (TEST_UART_NUM == 1) {
UARTTestConfig &config = *uart_test_configs[0]; UARTTestConfig &config = *uart_test_configs[0];
// pinMode will force enabling the internal pullup resistor (IDF 5.3.2 Change)
pinMode(NEW_RX1, INPUT_PULLUP);
config.serial.setPins(NEW_RX1, NEW_TX1); config.serial.setPins(NEW_RX1, NEW_TX1);
TEST_ASSERT_EQUAL(NEW_RX1, uart_get_RxPin(config.uart_num)); TEST_ASSERT_EQUAL(NEW_RX1, uart_get_RxPin(config.uart_num));
TEST_ASSERT_EQUAL(NEW_TX1, uart_get_TxPin(config.uart_num)); TEST_ASSERT_EQUAL(NEW_TX1, uart_get_TxPin(config.uart_num));