Open bill-orange opened 5 years ago
Thanks, I don't have any time the coming weeks to validate your fix. If others post a positive result I'll merge it!
I have not retested but it may no longer be necessary. Since my post The serial library has been revised two more time (one still in the release process). The Intent of the changes were to resolve various compatibility issues.
Fingers crossed.
Recently the ESP8266 board manager ver. 2.6.0 was released. Several changes that had been in the works regarding SoftwareSerial were implemented. As a result the sample code for this project will no longer compile. @dok-net provided this explanation:
Software serial can handle the diagnostics to USB quite well, whereas using the HW UART for the real application is in almost any scenario the superior option. I can’t even begin to imagine why all those libraries never considered
Serial.swap();
Now, if you’re faced with this situation, it’s only fair that I give you the simple change that needs to be done to the sources:
Before, somewhere in the sketch, provided that RX and TX are defines for the RX and TX pin numbers respectively:
Now, for quite awhile:
Where for the HW UART things would be:
I hope you see the beauty of it – it makes it simpler to switch to HW UART, and it’s a bit easier on the eye. Plus, switching bitrate at runtime should not involve the constructor!
As a result, I believe that example code should be revised as shown below. Please note, I was not able to test it other than making sure it compiled!