Arduino
Arduino copied to clipboard
HardwareSerial: fix issue with swapping pins twice
Previously calling HardwareSerial::swap twice would set the pins back to the original setting (1, 3). This feature was lost when swap function got an optional argument for the TX pin. This change reverts that, restoring ability to swap pins back. To use TX pin 2, HardwareSerial::pins or HardwareSerial::set_tx methods can be used.
Ref https://github.com/esp8266/Arduino/issues/3192
@igrr what is the status of this? Assuming it's ok'd in #3192 by the OP, can it just be merged, or is there anything pending?
This was long time ago... I don't remember how thoroughly this was tested. Will revisit this and try to test all possible pin options.
I've done some testing on this and there are still some issues. Will consider #3192 a known issue for 2.4.0 and work on this fix again after the release.
#hwtest
#hwtest
@igrr what is needed to move forward on this?
This doesn't fit into 2.5.0. Pushing milestone back.
Thanks for your PR, but the core and libraries have changed enough that this PR now has a merge conflict.
Could you merge it manually with the latest core, so we can consider it for future releases?
This needs work, pushing back.
@devyte Regarding the issue mentioned in the title - if there's anything else to this PR beyond that, I have not looked for it and am disregarding it - it's not present in master, and this PR could be closed. I have successfully swap()
ed multiple times, and used the pins()
function as well, no unexpected behavior occurs.