Since current flow integration gives only a reliable short term battery level measure (e.g. internal power draw is currently completely neglected) i would suggest to implement battery voltage as a drift compensator. during periods of low
o power flow from or to the battery its voltage indeed represents a proper measure for its energy level. i’m aware of the rather flat voltage/energy level curve, but the resulting error is still minor in comparison to the current energy metering logic.