ClemensElflein / OpenMower

Let's upgrade cheap off-the-shelf robotic mowers to modern, smart RTK GPS based lawn mowing robots!
Other
4.7k stars 282 forks source link

Feature/support df player clones #59

Closed Apehaenger closed 1 year ago

Apehaenger commented 1 year ago

Hi Clemens!

Because it took me 4 orders to get an original (working) DFPlayer module, I did some evaluation in the different DFPlayer modules (and their chip-clones).

As far as I could evaluate, Makuna's DFMiniMp3 lib has the best support, also for the clones you'll get (always) if you don't order by DFRobot.

If you've some time, please to a look to this lib switch. It works at least with my orginial DFRobot as well with the GD3200B chip. I also tested with the widely published MH2024K-24SS which also looks promising, but didn't work with this PR due to another issue (insufficient "global track" = "soundfiles in root" support)!

Even if Makuna's DFMiniMp3 lib has a larger support for DFPlayer clones, it has the drawback of his 'ugly' (my personally opinion) static implemented notification methods, which make it impossible (for me) to call instance methods/vars from the static notification methods. I didn't found a better way than making your soundsystem a singleton class (instead of over-engineere it with an observer pattern, as I guessed it will be the only sound on OM ;-)).

Please take a look and drop me your opinion.

I guess, it's one of your lessest interesting topics for you, but further on, I would like/offer to switch the sound system in that way that we're capable to play a background sound (i.e. for bootstrap, undocking, ...) while your current sounds could be played as "advert" sounds (DFPlayer manner) (interrupting the background sound). But for this it would be required to restructure the soundfiles on the SD-Card in "mp3" and "advert" folders. How do you think about such a change?