3

At the beginning I thought that EXTRA_LEVEL would return a percentage but I've seen in the API that to get the percentage I have to do EXTRA_LEVEL / EXTRA_SCALE

So now, I wonder, in which units are those pararameters? Are they mA? Thanks!

Spirrow
  • 1,120
  • 6
  • 18

1 Answers1

1

The EXTRA_SCALE value is (almost?) always set to 100. EXTRA_LEVEL does not contain a value in mA but the level from 0 to EXTRA_SCALE. Thus, assuming that EXTRA_SCALE is always 100, EXTRA_LEVEL would in fact contain the percentage. However, by computing the division you get the relative battery level as a fraction even if EXTRA_SCALE had a different value than 100.

cygery
  • 2,309
  • 3
  • 18
  • 25
  • In which cases EXTRA_SCALE may not be 100? – Spirrow Jul 12 '15 at 12:02
  • I'm not aware of any but since there's nowhere a contract/guarantee that EXTRA_SCALE always is 100 you should use the method shown in the official documentation. – cygery Jul 12 '15 at 12:03