PranjalKushwaha / ESP32-Bluetooth-FTP

This project aims to provide file-sharing capabilities between the ESP32 Bluetooth and any Android/Linux device over their default OBEX protocols.
21 stars 1 forks source link

Using this project with the Arduino environment #8

Open troisiemetype opened 1 year ago

troisiemetype commented 1 year ago

Hello,

I'm currently trying to use your project with the Arduino environment. It compiles flawlessly, but the device is not advertised, it does not appear when scanning with my phone. I believe it have to do with the settings config you expose in the readme :

Hope you can help.

Edit : I've dived further into your code, to try to find some hints. It appears that it gets stuck in the while loop of the start_bt() function, waiting for the controller to change its status. Trying to understand what was the matter, I've compared your code with another bluetooth app that I know, this one. Although the wrapper functions are a bit different, the bluetooth init is exactly the same, starting with the exact same nvs_flash_init(), then the default config loading, etc. The A2DP program also test for last connection and adds a 1-second delay between nvs init and bl init, but I don't think that has an impact. I've tried to add both in your code, it changes nothing.

troisiemetype commented 1 year ago

Hi,

I took more time to look for an answer, that I finally found. What happens is that there is a function that releases the BT memory, because of a wrong override in the Arduino Core. A bit of the Arduino automatic linking, that sometimes generate conflicts.

There is this thread about someone having the same error (that magically disappears when he indlues some unused library). And here is were I found the solution : https://github.com/espressif/arduino-esp32/issues/3436#issuecomment-927341016

I've added an unused call to btStarted() just before to init bluetooth, and that is enough to link the right file.

Hope that can help someone else !