Skip to content

Fix and consolidate discharge rate and remaining time calculation

Stefan Brüns requested to merge work/bruns/fix_cleanup_remaining_time into master

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

For more details, see !118 (merged).

Edited by Stefan Brüns

Merge request reports