Parent: f5043771c27b5d9c19b1415e4e4c1eb5f7d470f8
Author: Roman Smirnov <r.smirnov@omp.ru>
Committer: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: 2025-11-17 18:21:31
Tree: 94be01b831fc8b79f333a26cc9d6e4c6cb0e3ce5
shared/battery: improve the display of the charge level The battery charge level may fluctuate due to uncalibrated sensors. Commit smooths out such fluctuations. The algorithm for determining uncalibrated sensors consists of finding the number of changes in charge direction (i.e., "spikes"). If the number of spikes is zero, the device is charging or discharging. If there is one spike, it may mean that the device has started charging or has been disconnected from charging. If there are two or more spikes, this is a clear indication of an uncalibrated sensor. Check that the battery charge is fluctuating. If the battery charge is fluctuating, use the average charge value, otherwise use the current value. Fixes: https://github.com/bluez/bluez/issues/1612
Diffstat
| M | Makefile.am | | | 3 | ++- |
| M | src/battery.c | | | 10 | +++++++++- |
| A | src/shared/battery.c | | | 96 | ++++++++++++++++++++++++++++++++++++++++ |
| A | src/shared/battery.h | | | 21 | +++++++++++++++++++++ |
4 files changed, 128 insertions(+), 2 deletions(-)