Skip to content
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

Default pins don't work anymore. #19

Open
troisiemetype opened this issue Jan 22, 2025 · 0 comments
Open

Default pins don't work anymore. #19

troisiemetype opened this issue Jan 22, 2025 · 0 comments

Comments

@troisiemetype
Copy link

There was a change of default pins for serial 1 and serial 2, made by Espressif in the ESP32 Arduino core, documentend in pull request #8800.

This causes default definition to not work on boards which where designed before this pull request. I use the Minitel ESP dongle from Iodeo, which on the same minitel, with the same program, don't work anymore.

I've tried to call Serial2.begin(1200, SERIAL_8N1, 16, 17); after the instance constructor, and it works ok. But there are two class methods which don't work : changeSpeed(int bauds) and searchSpeed(). Both these methods use a call to myserial.begin(bauds), and this method hardcodes the pins to be use.

I believe a workaround would be to add two private members to store the TX and RX pins, and call the long begin method in the class methods, like :
mySerial.begin(bauds, SERIAL_8N1, rx_pin, tx_pin);
instead of :
mySerial.begin(bauds);

These two private members can be default initialized by the actual default constructor, or could be passed to a second constructor :

Minitel(HardwareSerial& serial, uint8_t rx_pin, uint8_t tx_pin){
    _rx_pin = rx_pin;
    _tx_pin = tx_pin;
    Minitel(serial);
}

Another way would be to have the pins default initialized in the constructor :

Minitel(HardwareSerial& serial, uint8_t rx = RX2, uint8_t tx - TX2){
    mySerial = serial;
    rx_pin = rx;
    x_pin = tx;
}

I've modified the class to work for me, I can make a pull request if needed.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant