GithubHelp home page GithubHelp logo

Comments (12)

jbkuma avatar jbkuma commented on August 21, 2024 1

I think the issue here is that after the connection is broken by whatever means (disconnect, BT off, computer restart) the ESP32 isn't put back in advertising mode. I was tinkering around with things like bleKeyboard.end(); bleKeyboard.begin();, but .end() is actually an empty function that doesn't do anything.

I think ideally what we need is a method to start advertising after the device is disconnected. This doesn't need to be automatic, we can manually trigger it with bleKeyboard.isConnected().

I think if possible, an isAdvertising() function would help with some other house keeping.

I'll keep tinkering and see if I can figure out how to do this myself, but this nuts and bolts are a bit over my head.

from esp32-ble-keyboard.

Frost159 avatar Frost159 commented on August 21, 2024

I have not mentionned it, but I'm using a ttgo t display esp32 board , maybe the issue comes from the board.

from esp32-ble-keyboard.

T-vK avatar T-vK commented on August 21, 2024

I don't know what could be causing this. Does this only happen on one of your devices or can you reproduce this issue with any device? What kind of device did you test against btw? (Android, iOS, Windows, Mac OS, Linux, ... ?)

from esp32-ble-keyboard.

Frost159 avatar Frost159 commented on August 21, 2024

I had this issue with my computer (windows 10) and my android device (galaxy S10)

from esp32-ble-keyboard.

songotag avatar songotag commented on August 21, 2024

I've the same issue : when my phone is connected for the first time to the esp32 module with the BleKeyboard driver works fine. As soon as the phone is disconnected, I can no longer connect, I have to restart the ESP32 for it to work again. the blekeyboard driver don't advertise again.

from esp32-ble-keyboard.

evg26 avatar evg26 commented on August 21, 2024

I've the same issue

from esp32-ble-keyboard.

zalexzperez avatar zalexzperez commented on August 21, 2024

Same here.

Let's say we have phone1 and phone2.

It connects well for the first time on phone1. But if you then turn off phone1's bluetooth and turn it back on, the connection is not restablished.

Actually, the ESP32 bluetooth keyboard device is no longer visible to phone2 (other devices) right after phone1 made the connection. This makes me believe the issue happens once the device connects for the first time, not after the disconnection takes place.

As others have said, the Bluetooth connection is only restablished after ESP32 is rebooted.

This is terrible, as I'm powering the ESP32 directly from a headunit USB connection and my car shuts the electronics off while the car is igniting.

Android 11 phones.

from esp32-ble-keyboard.

T-vK avatar T-vK commented on August 21, 2024

Take a look at #53. The PR implements a startAdvertising method. The reason I haven't merged it yet is that you have to manually call it, breaking backwards-compatibility. I hope someone comes up with a way to automate this eventually.
The end method is empty indeed for now. I think I just included it because the USB keyboard library has an empty end function as well.

from esp32-ble-keyboard.

jbkuma avatar jbkuma commented on August 21, 2024

I tested this and it works great, thanks!

I used Rousir's version Without changing anything in my program, I was able to connect to the ESP32 automatically from a previously paired device, and to find the freshly booted ESP32 from an unpaired device. I have a button to press to restart advertising, and that works well.

I think it would be safe to merge unless there is another use case that I'm missing.

Rousir closed the PR for some reason, if you aren't ready to merge, maybe you should re-open it so others are more aware of it. The example sketch he made doesn't seem quite right, but I haven't tested it. It seems to me it would never retrigger the advertising since the check is within the isConnected() loop.

from esp32-ble-keyboard.

zalexzperez avatar zalexzperez commented on August 21, 2024

The example sketch he made doesn't seem quite right, but I haven't tested it. It seems to me it would never retrigger the advertising since the check is within the isConnected() loop.

Well, after updating the two modified library files, I just tried the example sketch and it certainly doesn't autoreconnect, the ESP32 bluetooth device is not advertising.
And yes, the algorithm doesn't make sense. bleKeyboard.startAdvertising() is only executed if bleKeyboard.isConnected().

I wonder how others made it work...
Edit:

if(!bleKeybaord.isConnected())

Did the trick for me, lol

from esp32-ble-keyboard.

jbkuma avatar jbkuma commented on August 21, 2024

from esp32-ble-keyboard.

T-vK avatar T-vK commented on August 21, 2024

I hope this got fixed in #86 which is included in the new release (v0.2.3).

from esp32-ble-keyboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.