Skip to content
Commit e6afa898 authored by Stefan Brüns's avatar Stefan Brüns
Browse files

Take property update frequency into account for smoothed remaining time

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.
parent ec704f26
Pipeline #384484 passed with stage
in 6 minutes and 10 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment