TechTips • Charging/Discharging Time

Global Variables

  1. cr: charging rate (type: Number; 1…100) ➞ ∑ minutes per 1% when charging (example: 1.2)
  2. dr: discharging rate (type: Number; 1…100) ➞ ∑ minutes per 1% when discharging (example: 9)
  3. mins: time calculation (type: Text) ➞
    $if(bi(charging)>0, (100-bi(level))*gv(cr)), bi(level)*gv(dr)))$
  4. etatext: time display (type: Text) ➞
    $mu(floor, gv(mins)/60)))$h $mu(round, gv(mins)-mu(floor, gv(mins)/60)*60)$m

Element

  1. Text ➞
    $if(bi(charging)=1, "⚡️ Full in ", "🔋 Left: ")$$gv(etatext)$

Notes

CALIBRATION

  • Charging Rate (cr): Charge from a % level (example: 40%) for 10 minutes, then note the % increment. Then set cr = 10 / increment
  • Discharging Rate (dr): monitor the discharging at a % level (example: 60%) for an hour of normal use, then more the % decrement. Then set dr = 60 / decrement

The above Calibration are needed for a more accurate measurement, and they may be different from a phone model to the others and the charging power (example: 18W, 25W, 33W, etc.)

I hope this would help.

:smiling_face: :+1:

2 Likes

Great tip! bi(fullempty) gets fixed in the next release, it was returning wrong values while charging or discharging, after that you can also use $tf(bi(fullempty))$ to get the time left without calibrating

1 Like

Good to know. If $tf(bi(fullempty))$ reports a sane value after the update, the calibrated cr/dr formula could be kept as a fallback for devices where the battery service returns 0 or an unrealistic estimate. Showing both—system estimate when available, calibrated estimate otherwise—would avoid a blank or absurd time without removing the manual method.