-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(HardwareSerial): fix pin remapping in begin() on master #10379
Conversation
The pin remapping functions have to be called as early as possible in the begin() function, to immediately convert the input parameters to the GPIO numbers used everywhere in the core. This issue has always been dormant since the introduction of pin remapping in 2.x via 9b4622d, but was exposed by the proper pin muxing support that is present in the 3.x core. Move the pin remapping function calls earlier in the begin() function to fix this issue.
👋 Hello pillo79, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 56 files - 83 56 suites - 83 4m 12s ⏱️ - 18m 4s Results for commit 2d6fcef. ± Comparison against base commit b05f18d. This pull request removes 13 tests.
♻️ This comment has been updated with latest results. |
The pin remapping functions have to be called as early as possible in the begin() function, to immediately convert the input parameters to the GPIO numbers used everywhere in the core. This issue has always been dormant since the introduction of pin remapping in 2.x via 9b4622d, but was exposed by the proper pin muxing support that is present in the 3.x core. Move the pin remapping function calls earlier in the begin() function to fix this issue.
Description of Change
The pin remapping functions have to be called as early as possible in the
HardwareSerial::begin()
function, to immediately convert the input parameters from the user to the GPIO numbers used everywhere in the core. However, there is code that assigns GPIO numbers totxPin
/rxPin
before the call todigitalPinToGPIONumber
.This issue has always been dormant since the introduction of pin remapping in 9b4622d, but is evident on 3.x due to the full pinmuxing support that actually detaches pins - disabling the default
Serial0
pins.Move the pin remapping function calls earlier in the
begin()
function to fix this issue.Tests scenarios
Tested on the Nano ESP32 -
Serial0.begin(115200)
was selecting "random" pins instead of the expected defaults.Related links
See also #10380 for the same fix on 2.x.