ESP32Easy BLE

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
enesbcs
Normal user
Posts: 429
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

ESP32Easy BLE

#1 Post by enesbcs » 23 Nov 2019, 22:23

I am struggling to make BLE based plugins for reading Mijia temperature and Flora plant monitor devices to ESPEasy, using the integrated Bluetooth in ESP32. Test version works but occasionally Wifi is unavailable, it seems that BLE blocks the system when tries to communicate... also sometimes reboot occurs which may be because i am not a good friend of pointers/ArduinoC. (or simply the ESP32 BLE library is unstable)
Whatever, i am publishing the code for testing/fixing:

https://github.com/enesbcs/ESPEasyRetro ... EMijia.ino
https://github.com/enesbcs/ESPEasyRetro ... EFlora.ino

(ESPEasyRetro is my own playground, plugins tested with it, but may work with other versions - BLE scan implemented in its Webserver.ino!)

TD-er
Core team member
Posts: 1922
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32Easy BLE

#2 Post by TD-er » 23 Nov 2019, 23:55

Why not let the BLE be handled by the 2nd core?

User avatar
ThomasB
Normal user
Posts: 444
Joined: 17 Jun 2018, 20:41
Location: USA

Re: ESP32Easy BLE

#3 Post by ThomasB » 24 Nov 2019, 01:32

The Arduino BLE library's scan and connect functions are code blockers. If that is a problem for ESPEasy then maybe TD-ers idea might help out.

Fortunately, once connected the BLE callbacks are not code blocked. But reconnects will experience the code blocking issue. So your plugin should schedule reconnect attempts so that they do not spend too much time trying to find a missing BLE server.

However, the Arduino BLE client library is a buggy. A recent release removed some useful NULL pointer checking which has invited crashes, at least for me. And there are some semaphore issues that can invite random endless hangs.

I recently completed a ESP32 BLE project (not ESP Easy) that experienced these bug issues. I used the BLE library's debug log function and with it's help I was able to apply some library tweaks to eliminate the problems. You may have to do that too.

- Thomas

kniazio
Normal user
Posts: 50
Joined: 12 Jun 2016, 11:12

Re: ESP32Easy BLE

#4 Post by kniazio » 24 Nov 2019, 07:12

I would like to open my lock using a telephone without using a Chinese application.
Is it possible to make an esp32 plugin?
https://pl.aliexpress.com/item/32839514 ... 39.99734.0

User avatar
enesbcs
Normal user
Posts: 429
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: ESP32Easy BLE

#5 Post by enesbcs » 24 Nov 2019, 08:55

Mijia data request works with BLE notification callback, and when i tried to run it another core it did not ends well. :) Flora may work on second core as it works as simple ble connect-than-read.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests