Skip to content

Take property update frequency into account for smoothed remaining time

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

The time constant of the AR filter used for smoothing the remaining time should be independent of the calling frequency of updateDeviceProps.

There are two causes for varying update frequency:

  • The properties are updated due to update events from the firmware. UPower preferably uses firmware events and falls back to 30 second polling interval.
  • In case any peripherals are battery powered there will be regular "UpdateTime" property changes, also triggering updateDeviceProps.

The time constant is chosen to track a consumption rate change with about 20% remaining error after 5 minutes. This is about the same as before with an update interval of 10 seconds (or 30 seconds with main battery and 2 peripherals). The old constant had and error > 50% after 5 minutes. Short spikes are still averaged out fairly well.

Merge request reports

Loading