Open JordanVlieg opened 2 years ago
@lolwheel sorry for the delay in response. Absolutely feel free to build on top of it. Though I would encourage the merging and release of a OWIE 2.0 with this as it is, since this changes nothing for users who don't enter a value, but those who want to beta test can access this feature before we measure on their behalf.
We can then follow up with 2.1 which determines capacity on your behalf.
This PR introduces the concept of battery % (SOC) tracking using mAh instead of a voltage table.
The new system tracks SOC using both voltage and mAh in parallel, and only uses mAh if the following conditions are true
It converts from mAh % remaining to watt hour % remaining using a set formula derived from the chemical properties of LiPo batteries. Namely that the voltage goes from 4.2V->2.8V. I know the maintainers are not a fan of "magic formulas", but this is a very simple square polynomial that is not an approximation, but rather an exact derivation. The only assumption made is that voltage decay is linear (which is obviously not quite true). However since everyone uses different cells, linear decay is the best choice.
Also adds a new (hidden) diagnostics page that displays more internal variables. Useful for developer debugging and visibility.
Known issues: