SnijderC / dyplayer

Abstracton for DY-XXXX mp3 player modules over UART.
Other
110 stars 30 forks source link

SoftwareSerial only for AVR? #43

Closed jenschr closed 1 year ago

jenschr commented 2 years ago

Hi, I wanted to use this library with an ESP32 S2 module with the Arduino IDE and I noticed that SoftwareSerial is only available on AVR? Any specific reason for this, given that SoftwareSerial also exists on many other platforms? (Here's the ESP32 one https://www.arduino.cc/reference/en/libraries/espsoftwareserial/ and it works identically to the AVR version)

Removing all the #ifdef AVR will solve this. I'm also a bit sceptical to the use of #ifdef HAVE_HWSERIAL0. On my ESP32 S2 dev board from Unexpected Maker, this is not defined despite the board having hardware Serial1 and Serial2 (ref https://www.youtube.com/watch?v=3sXtVuMhuoc). Removing all the ifdef's actually made this library work much better.

The compiler will complain if a feature is not present, so I would suggest to remove the "cleverness" since it does not work as intended. Thanks for an otherwise great lib!

SnijderC commented 1 year ago

For some boards it will actually not work, because for example they don't define SoftwareSerial.h at all. So this cleverness is actually necessary. That said, I've updated the cleverness, it should be more reliable now.

jenschr commented 1 year ago

+1 for more cleverness!