how to restart bluetooth after light sleep

OutOfLine
Posts: 52
Joined: Sat Feb 24, 2018 1:32 pm

how to restart bluetooth after light sleep

Postby OutOfLine » Sat Dec 22, 2018 8:41 pm

I have a couple of art installations playing sound and light effects based on an ESP32.

My program has a serial menu interface that can give access to configuration
and a lot of infos about the running patterns.

Out of home at installations or for performances a wireless inteface is much more convenient,
so I looked a into bluetooth, now I have tons of questions...

I gave BluetoothSerial a try, and it works fine.

But I have two major problems:
* BluetoothSerial eats a *lot* of program space, much more then I want to give for it
I can get away with that, as the installations I have currently running do not need all
the program features.
But for the longer perspective I would prefer a solution that needs less ressources.
Pointers very welcome...

The two installations currently running run on an activation trigger, if there's nobody,
they go light sleep. To be able to sleep I run esp_bluedroid_disable() and get no error.
* But how can I activate bluetooth after wakup again?

Code: Select all

BLUEtoothSerial.begin(ESP alpha 0.009)  ok	// no effect, no error

ERROR: esp_bluedroid_enable() ESP_ERR_INVALID_STATE

// or tried (with different modes)
ERROR: esp_bt_controller_enable(ESP_BT_MODE_BTDM) ESP_ERR_INVALID_STATE
How do I get my bluetooth connection back?

I do not understand what 'bluedroid' or 'bt_controller' mean.
Could somebody explain that?

I have tried so many things, but do not get a connection again without resetting esp.

Thanks a lot for any help
Robert

My code is at https://github.com/reppr/pulses
Last edited by OutOfLine on Mon Dec 24, 2018 1:12 pm, edited 1 time in total.

OutOfLine
Posts: 52
Joined: Sat Feb 24, 2018 1:32 pm

Re: how to restart bluetooth after light sleep

Postby OutOfLine » Sun Dec 23, 2018 11:21 am

Sorry, forgot to mention that I *did* try to call BLUEtoothSerial.end(); before going light sleep.
This step seems logical to me, but if(BLUEtoothSerial.hasClient()) the end() function crashes and reboots. (Maybe I must disable the connection first? I do not now how to do that from the ESP side)

still trying and trying to find a working solution to re-enable bluetooth after wake up.

any help, pointer, function to try or whatever very welcome :)
Robert

OutOfLine
Posts: 52
Joined: Sat Feb 24, 2018 1:32 pm

Re: how to restart bluetooth after light sleep

Postby OutOfLine » Mon Dec 24, 2018 1:10 pm

some more infos:

ESP32 revision 1
ESP IDF version v3.2-dev-1055-g3276a1316

but I think it's me, not the chip or the IDF ;)
still searching...

Who is online

Users browsing this forum: Vilius and 109 guests