Improve battery percentage calculation and reporting#719
Improve battery percentage calculation and reporting#719JF002 merged 2 commits intoInfiniTimeOrg:developfrom Riksu9000:improve_battery_reporting
Conversation
While charging, percentage should only go up, and while discharging, percentage should only go down.
|
I can test this later tonight with my devkit, I have an external Power supply that i can change the voltage on so no need to wait for a battery. |
|
Here's a screenshot. Compare this to for example #609 (comment) In this screenshot you can see that the same percentage is only reported twice on reconnects. This allows Gadgetbridge to create smoother lines instead of hard steps. I guess this could've been fixed in Gadgetbridge too if they ignored duplicate percentages. During the night for example it can take many hours for the percentage to drop. Because the percentage isn't updated, Gadgetbridge will show the last point being the one from many hours ago. Basically if at 1am the percentage is 50% and at 8am it is still 50%, the graph stops at 1am, but this should probably be considered an issue with Gadgetbridge. Is there a standard on how the percentage should be notified? If not, then it is more efficient to only report changes instead of reporting periodically. |
|
This has been working well for me on a dev build...I have not yet actually paced it with the power supply. This mixed with #711 makes a really clean graph now with expected numbers instead of the jitter/spikes which is great! |
|
I agree with @geekbozu, the battery level measurement and graph are getting better and better thanks to you, @Riksu9000, thanks! |

While charging, percentage should only go up, and while discharging, percentage should only go down.
This is simpler than a proper filter and achieves practically the same thing. Should reduce, or even eliminate the noise that's visible in Gadgetbridge battery graph.
Also notify the battery level over ble only when it has changed. This should make the graph smoother.