Fix and consolidate discharge rate and remaining time calculation
This fixes several issues in the current code: 1. Instead of averaging the remaining time it averages the discharge rate, and uses the rate and remaining energy to calculate the time. 2. It gets rid of the history array, an autoregressive filter only needs one history value, no point recalculating it again and again. 3. It keeps the averaged discharge rate over plug/unplug events. This reduces the error after replugging, as the first few reported rate values are often too small, while there is no intrinsic reason the old rate estimate becomes invalid. 4. It brings the legacy remaining time calculation in line with the one based on the DisplayDevice UPower object, i.e. always uses rate and remaining energy to full/empty to calculate the time. CCBUG: 434432 (cherry picked from commit e6fdb5b1)
parent
d1d48071
Loading
Loading
Pipeline
#383054
passed
with stage
in
1 minute and 24 seconds
Loading
Please register or sign in to comment