Protonerd / FX-SaberOS

System code for Arduino based Lightsaber replicas for DIYino family boards
Creative Commons Zero v1.0 Universal
91 stars 42 forks source link

Df player freezes and resets #112

Closed DootSlayer99 closed 2 months ago

DootSlayer99 commented 5 months ago

Well i did everything correctly and sounds are working while swinging however it freezes and resets back to boot around every 1 or 2 minutes. It also loops the poweroff sound and the config sounds like main color and swing sensitivity. How can i fix this?

rhansenne commented 5 months ago

Don't know about the freezing, but the incorrect looping of menu sounds is most likely due to the use of a clone DFPlayer chip. I had the same issue with the MH2024K-24SS and had to make some minor code changes to correct this. I created the following pull request, which should fix the issue when uncommenting "DFPLAYER_CLONE" in Config_HW. Give it a try to see if it works for you: https://github.com/Protonerd/FX-SaberOS/pull/113

DootSlayer99 commented 5 months ago

It works, now it doesnt loop! Thanks a lot! I am still trying to figure out why it resets for no reason. Can it be because of fake df player?

rhansenne commented 5 months ago

I can't reproduce the reset behavior. This sounds like a possible loose connection somewhere. Did you manage to track down the cause? The latest version of the code (in master) contains some further compatibility improvements for clone DFPlayer modules (such as a configurable DFPLAYER_OPERATING_DELAY in Config_HW), which may help.

Protonerd commented 4 months ago

Strangely for me it resets every few secounds and will never enter the main loop. The last message I get is about the DFPlayer being initialized and then the watchdog triggers. If watchdog is not enabled, the board just freezes. I used one of my known-working sabers for this trial, which worked for years, up to the point yesterday when I uploaded the new code. Funnily even though it's my board design and a code mostly written by me, for the first time I have no idea what I could still try.

rhansenne commented 4 months ago

@Protonerd does that saber still work correctly with the older v1.4 version of the code? If so, we can debug which of the recent changes may be causing the issues.

DootSlayer99 commented 4 months ago

Well after some testing i actually found out why it resets! The code works for me but the reason why it resets for me is because of the custom font i created on my own. I forgot to use the soundfont converter and when i used it the resetting issue was gone. Although the fake df player still reset after a couple seconds even if i use the sample soundfonts given in the master zip. Original work well though. @Protonerd perhaps there is an issue with the soundfonts you used?

Protonerd commented 4 months ago

Unlikely, as I use the ones in the zip and I never had issues with them. What do you mean it still resets every few secounds? This is what I have too, which is weird. It is in my case the watchdog barking, but it's set to 8 secs. So it should not reset at least for that amount of time, but it does. Which tells me it might be a problem with the AVR arduino package I use (the code from @rhansenne looks good for me). I need to purge my Arduino IDE installation on all machines and give it a fresh try. In the mean time let me know which IDE version and which AVR package you guys are using.

rhansenne commented 4 months ago

I'm currently using Arduino IDE v2.2.2 with AVR package version 1.8.6.

Protonerd commented 4 months ago

I was able to recover my saber with the last release before the recent ones. I think the problem was the AVR package, the newer ones do not have an option for the bootloader my DIYino boards are loaded with. So I went back to AVR 1.6.17 where I still found the board type Arduino/Genuino UNO, which hides the optiboot BL, which has slightly more memory left for code. With that one I was able to reload the code and now the saber works fine. Now I'm going to be more cautious and try the new features with a bare Nano board. I'm not sure why but earlier I did not have to take care about certain libraries staying in the cache and causing compile troubles but now most of the time I need to purge the cache every time I make changes to libraries. Crazy...