Questions about BLE and the app

Hrm, once the TBeams go to sleep, and say you had your phone / tablet in airplane mode, or turned off or out of range or it was disconnected because the TBeam went to sleep… how do you reconnect? As long as 1 device is still connected to a TBeam, and you send a message, it seems to wake the other units up and display the message on the screen. Most times the other droids reconnect and display the new message. But Im having a hard time getting them to reconnect without pressing the middle button on the TBeam, sometimes having to force stop the Android App.

Is the BLE fully sleeping or does it sit and listen for a connection request like the TBeams seem to be sleeping waiting for a message?

OK, I may have part of an answer, which leads to another question

In order to go to sleep, we have to disable Bluetooth and WiFi. Which means we cant wake up the device using Bluetooth the way we use a gpio button.

So my new question is, can we ask the TBeam to reconnect to the last connected device when it wakes up, since the Meshtastic Android App is still running in the background. The app can then send the messages waiting to send.

Maybe this is what is supposed to be happening? It certainly is not the case for me right now.

Yes that’s what’s supposed to happen. Every few minutes the esp32 wakes and the phone sees it can checks if there is anything new. That why the phone app tracks three states for the device. Either sleeping, connected or disconnected (ie the device is overdue for a connection per the apps timer).

That’s not what is happening for yours?

I have the same problem. The state sleeping seems to be missing in the app now. It goes from connected to disconnected.

Is this a limitation of the microcontroller?

Because the way I understood BLE, you register to GATT Service Change indications and remain dormant until you are notified of new data on the other end.

This behaviour is what I am seeing on some of my commercial BLE devices, too: E.g. my Garmin watch can sync to my phone without me waking up the phone first, and my Garmin App can sync with my watch without me tapping a button on my watch first.

And I think this is natively supported in Android and iOS, because none of the apps have to run a background service (at least they show no notification).

I assume to do that, the radio must remain switched on of course. So is switching off the radio

  • according to the BLE spec,
  • a limitation of the microcontroller,
  • or just an incorrect implementation of the BLE?

No, This was not true. I watched it now…
When in connected state if I leave it it takes 5 minutes to go to sleep mode. and then after 5-10 secs it will go to disconnected.

I watched it on my Heltec LoRA board. After minute…

  • 1:00: screen goes off, white LED continues flashing once per second
  • 3:00: white LED stops flashing, App reports “device sleeping”
  • 3:30: App reports “Disconnected”
1 Like

Yes, ok now using a second LoRa device as soon as you power it up or send a message from a second Android, you can watch the first sleepy LoRa wake up and start flashing LEDs but the Android paired to that LoRa never reconects. It seems like the first LoRa is going right back to sleep almost right away too.

Just wanted to point out, this is all purely on battery, not plugged in using USB. Though if you plug a USB in sometime after its gone to sleep, I have not been succeful at opening a serial comunication without first having to press the rst button.