Trail-Sense icon indicating copy to clipboard operation
Trail-Sense copied to clipboard

Improve battery time calculations

Open kylecorry31 opened this issue 3 years ago • 0 comments

  • [ ] Store and update average battery percent increase/decrease per hour
  • [ ] Store and update average battery capacity (mAh) increase/decrease per hour
  • [ ] Store and update maximum battery capacity (mAh)
  • [ ] Show battery times for average usage
  • [ ] Show battery times for current usage
  • [ ] Add PowerSubsystem.getChargeTime(percent, current?)
  • [ ] Add PowerSubsystem.getDischargeTime(percent, current?)
  • [ ] Add PowerSubsystem.getTimeUntilDead(current?)
  • [ ] Add PowerSubsystem.getTimeUntilFull(current?)
  • [ ] Add PowerSubsystem.getBatteryPercentage()

Either the PowerSubsystem will update at a fixed interval (battery change events are too frequent) or the methods which need battery percentage will be suspend functions.

getChargeTime

  • percent: The percentage points to charge
  • current: If supplied, use the current to estimate the charge time

getDischargeTime

  • percent: The percentage points to discharge
  • current: If supplied, use the current to estimate the discharge time

getTimeUntilFull (suspend, or cached)

  • current: If supplied, use the current to estimate the charge time

getTimeUntilEmpty (suspend, or cached)

  • current: If supplied, use the current to estimate the discharge time

getBatteryPercentage (suspend, or cached)

kylecorry31 avatar Dec 24 '21 00:12 kylecorry31