Documentation error?

Posted on
  • @Gordon I'm reasonably certain that nRF.getBattery() returns percentage, not voltage as stated in Description and Returns in the API reference...

  • Do you have an example of the readings you're getting? I just checked and it should definitely just return the battery voltage in volts.

  • Thanks @Gordon. I guess I'm confused -- since it was an NRF function, I was assuming that it was the battery level of a remote connection, which over Bluetooth is expressed as percentage. Is this the battery voltage of the local system? In other words, an A/D reading from an input connected to the battery? If so, it would be good to document it a bit better to avoid future confusion. Thanks! Bill

  • So you never actually tried it out to see if it was a percentage?

    Is this the battery voltage of the local system?

    Yes. It's the voltage on the nRF52 chip itself - in nearly all cases that's also the battery voltage. There's Puck.getBatteryPercentage - but that only works because we know it's a CR2032 battery in Puck.js. In other devices it'd be much more difficult to be sure.

  • I didn't try it out, but I sure can if you'd like.

    I was reading through the commands and (erroneously) assumed anything with NRF on it was Bluetooth related, hence the confusion with Bluetooth battery values which are specified in the Battery Service as percentages (since there isn't known voltage and battery type). Sorry for my confusion, but perhaps a bit of clarification in the documentation would be good?

    BTW, just got my Ruuvi units; nice to see another espruino-capable product! I'm actually running espruino on my own designed board as well. It makes for handy prototyping.

  • No, it's fine - I tried it out when you said to make sure and it's fine.

    Yes, I have updated the docs - they will be live in a few days.

    Everything on NRF is to do with NRF51/52 devices - so usually bluetooth, but not always

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Documentation error?

Posted by Avatar for billsalt @billsalt