You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Everyone, I am trying to make a device that can play both audio from bluetooth or audio from an SD card and switch between these sources at the press of a button.
I have been using pschatzmann's library for Bluetooth and this has worked well. I am also using Arduino-Audio-Tools for SD card playback but this has given me some trouble.
Currently I have issues switching between these sources. That is, it starts in BT mode by default and I can switch between BT and SD without issue, but if a BT device is connected then it will crash upon switching. This crash is accompanied by malloc errors in console and a register dump. I am able to start in BT mode and play music, only switching between BT/SD after a BT device is connected causes the crash.
The code uses a basic state machine with a playbackMode variable. This is setup so BT or SD will have an initialization stage before the main loop code runs. The stages are split up in if blocks like "currentState == initBluetooth" in handleBluetooth() and handleSDcard().
I think there is an issue with some of the BT variables not being deinitialized or reinitialized correctly but my experiments have not yielded much. I will include pastebin links to my source and error output. The code I linked is a simplified version and not very polished but includes all the same BT/SD parts.
If anyone has any experience or suggestion for this, please comment!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Everyone, I am trying to make a device that can play both audio from bluetooth or audio from an SD card and switch between these sources at the press of a button.
I have been using pschatzmann's library for Bluetooth and this has worked well. I am also using Arduino-Audio-Tools for SD card playback but this has given me some trouble.
Currently I have issues switching between these sources. That is, it starts in BT mode by default and I can switch between BT and SD without issue, but if a BT device is connected then it will crash upon switching. This crash is accompanied by malloc errors in console and a register dump. I am able to start in BT mode and play music, only switching between BT/SD after a BT device is connected causes the crash.
The code uses a basic state machine with a playbackMode variable. This is setup so BT or SD will have an initialization stage before the main loop code runs. The stages are split up in if blocks like "currentState == initBluetooth" in handleBluetooth() and handleSDcard().
I think there is an issue with some of the BT variables not being deinitialized or reinitialized correctly but my experiments have not yielded much. I will include pastebin links to my source and error output. The code I linked is a simplified version and not very polished but includes all the same BT/SD parts.
If anyone has any experience or suggestion for this, please comment!
Thanks for reading!
Error: https://pastebin.com/pvLTvDbW
Source: https://pastebin.com/t3TeA8Uy
Header: https://pastebin.com/AgK4mYjK
Beta Was this translation helpful? Give feedback.
All reactions