ESP32-BLE-Keyboard
ESP32-BLE-Keyboard copied to clipboard
BatteryLevel not sent
Hi there!
i implemented blekeyboard on a TinyPICO and try to send the Batterylevel via
bleKeyboard.setBatteryLevel(batterypercent);
But it only rarley get sent to my Windows11 Workstation ... But sometimes it seems to get transmitted ...
Any idea whats wrong there?
Thanks a lot, Robert
I don't know, it has never been tested with Windows 11 before.
Hi, same Problem on Windows 10
Holen Sie sich Outlook für Androidhttps://aka.ms/AAb9ysg
From: T-vK @.> Sent: Thursday, July 15, 2021 4:43:25 PM To: T-vK/ESP32-BLE-Keyboard @.> Cc: Robert Tausend @.>; Author @.> Subject: Re: [T-vK/ESP32-BLE-Keyboard] BatteryLevel not sent (#99)
I don't know, it has never been tested with Windows 11 before.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/T-vK/ESP32-BLE-Keyboard/issues/99#issuecomment-880752812, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC5DMX5VFUYSXNT7F3C6QGDTX3XY3ANCNFSM5ANMLNCA.
For me it seems to only update the battery percentage upon pairing. I don't think I've seen it ever update otherwise, even after power cycling the BT device.
This is on Win10 with a Lolin32 Lite
Hmmm sometimes it updates it, but really not stable ... Any idea what i could try here?
I don't know to be honest. Maybe the value is only transmitted when certain events happen. I haven't actually tested that feature at all beyond setting the initial battery level. Is this only happening on Windows or does it also not update correctly on Android, iOS, Mac OS and Linux?
Hey! I only tried it on Windows till now, on MacOS i don't even see the device in the BT Menu ... will open another Case for that and see if there is any solution... Thanks
I use this to read the latest battery charged informations status:
https://www.bluetoothgoodies.com/?v=020d0001&osv=10.0.19043
Windows is as far as I know, not ready with implementing to poll all devices
oh, I fix this bug, in BLEHIDDevice.cpp #45, you need to change this
this is origon:
BLE2904* batteryLevelDescriptor = new BLE2904();
batteryLevelDescriptor->setFormat(BLE2904::FORMAT_UINT8);
batteryLevelDescriptor->setNamespace(1);
batteryLevelDescriptor->setUnit(0x27ad);
m_batteryLevelCharacteristic = m_batteryService->createCharacteristic((uint16_t) 0x2a19, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_NOTIFY);
m_batteryLevelCharacteristic->addDescriptor(batteryLevelDescriptor);
m_batteryLevelCharacteristic->addDescriptor(new BLE2902());
this is my fix:
BLE2904* batteryLevelDescriptor = new BLE2904();
batteryLevelDescriptor->setFormat(BLE2904::FORMAT_UINT8);
batteryLevelDescriptor->setNamespace(1);
batteryLevelDescriptor->setUnit(0x27ad);
m_batteryLevelCharacteristic = m_batteryService->createCharacteristic((uint16_t) 0x2a19, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_NOTIFY);
m_batteryLevelCharacteristic->addDescriptor(batteryLevelDescriptor);
m_batteryLevelCharacteristic->addDescriptor(new BLE2904());
I've submitted a fix in the ESP Arduino GH https://github.com/espressif/arduino-esp32/pull/6864
This shall close this issue as well, I guess.
Would this fix be only in the base (original) BLE library? I'm having exactly the same issue using nimBLE - battery report works only in the constructor and not via bleKeyboard.setBatteryLevel()