jincao1 / qmk_firmware

Custom NuPhy Air75 V2 Firmware
GNU General Public License v2.0
83 stars 7 forks source link

[Bug] Unplugging cable on bluetooth doesn't update battery percentage #5

Closed jordanisaacs closed 2 days ago

jordanisaacs commented 1 month ago

Describe the Bug

On latest commit, unplugging the cable when on bluetooth doesn't update the battery percentage (stays at 100%) reported by the LEDs until some event that triggers an RF refresh. Turning on/off battery reporting with fn+/ does not update battery percentage. Only switching to wired mode or to a different bluetooth setting resets the batter percentage.

It seems like battery percentage is only being updated by the following RF event: https://github.com/jincao1/qmk_firmware/blob/badf85ec93c5b7dcfd89247f6bdb5cc8f3c377f1/keyboards/nuphy/air75_v2/ansi/rf.c#L211 Can this event be triggered by an unplug?

Also not sure if it is possible but instead of reporting 100%, can we report the actual value even when charging?

jincao1 commented 1 month ago

The sts sync runs every 200ms so it doesn't need to be manually triggered.

When you say the battery percent doesn't update, does the keyboard LEDs show 100% but the device it's connected to report differently? I ask this because the battery is returned by the wireless/RF chip. It will report the percentage directly to your BT device. The QMK firmware uses this value to display through the LEDs but it is reported independently to the linked device and isn't influenced by QMK.

Also note if you're fully charged it could take a while before it drops below 100% depending on usage.

Pertaining to reporting actual percent when charging, I wish it was possible. Since that value is reported by the RF chip it doesn't seem to do it for the Air75 and always reports 100 when charging. On some other Nuphy boards like Gem80 and Halo v2 it does report the actual current percentage when charging. Weird way for Nuphy to set this up I know. If you update to a specific RF firmware and notice that the percentage through the BT device is showing the charge go up when charging instead of jumping to 100% let me know. That means Nuphy fixes it on their closed source RF firmware which may be possible to make QMK respond the same way with that RF firmware.