Skip to content

function setBatteryLevel() in BLEHIDDevice.cpp is invalid #6708

Closed
@BG2CRW

Description

@BG2CRW

Board

ESP32 DevModule

Device Description

a ble keyboard use ESP32 DevModule

Hardware Configuration

BLE Server

Version

v2.0.2

IDE Name

arduino ide

Operating System

win10

Flash frequency

40MHz

PSRAM enabled

no

Upload speed

921600

Description

BLEHIDDevice hid;
hid->setBatteryLevel(level);

esp32实现的蓝牙键盘(server 模式),用这种方法进行电量设置,在win10系统下显示键盘电量。
在初次连接时,电量显示正常,电量也可变化。但是断开连接后重新连接,电量始终显示为初次连接时的电量,且更改变量赋值后,win10系统显示变量仍然无变化。

I want to use this way to make my BLE keyboard change battery level in win10. but it is invalid.
When I connect my keyboard first time, it is work, meanwhile, win10 can show my real-time battery level.
but after disconnect and reconnect, win10 can only show its last battery level, and can't show my realt-ime battery level, when I change my battery level variable.

Sketch

BLEHIDDevice hid;
hid->setBatteryLevel(level);

I use this library https://github.com/T-vK/ESP32-BLE-Keyboard, it is also mentioned by T-vK/ESP32-BLE-Keyboard#99

Debug Message

no debug message

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions