bluejunimo / YX5300_ESP32

A library to support the YX5300 MP3 Module on the ESP32 platform.
MIT License
2 stars 1 forks source link

Add some error handling for when the YX5300 isn't detected? #3

Open scottchiefbaker opened 1 month ago

scottchiefbaker commented 1 month ago

I accidentally had my RX/TX flipped and didn't know it. This library happily chugs along even if it doesn't get a response in the constructor. Would it be possible to add something like:

mp3 = YX5300_ESP32(Serial2, RX, TX);

if (mp3.missing_board()) {
    Serial.printf("Warning YX5300 not found on RX:%d TX:%d", RX, TX);
    delay(1000);
}

Or possibly have the constructor itself do a Serial printout warning we couldn't init the YX5300? This would have saved me a lot of hair pulling-out.