Power Management for Sensors

Posted on
  • Hello All,
    I need some clarifications about what is the proper way of managing power of the various sensors (compass, barometer, ..).
    From the Espruino reference, I gather that there is a set of Bangle.setXYZPower() functions, which turn on or off the sensors, but I wonder what happens if an application is terminated or replaced, while a sensor is powered on.
    Does the sensor remains up, or is it everything reset each time a new app is loaded?
    Perhaps the firmware maintains a list of apps which are using the sensor, and remove the relative entry when an app exits?
    Any kind of atExit() callback, in order to clean up things properly before terminating?
    Thanks!

  • I wonder what happens if an application is terminated or replaced, while a sensor is powered on.

    It's fine. If an app was using something and you change app, the sensor is powered off.

    Espruino waits about 1 second after the new app has loaded, and then turns off anything that's not used by the new app. The reasoning is especially for stuff like GPS that can take a while to 'warm up' it's good to leave it running between apps if we can so it's ready to use as soon as possible.

    Any kind of atExit() callback, in order to clean up things properly before terminating?

    Yep, E.on('kill',...) - but no need to turn off the sensor (in fact because of the above, it may be a bad thing to do)

  • What about battery low options? Like below 10 percent, override any sensors to off?

  • You could create an app which will do that if you want?

  • Remembering the Pebble as a reference: It shut down all features and just displayed the time with a minimal watchface when battery got under a certain threshold.

  • I guess I just wonder, as long as you're using a simple watchface and you have GPS off, your battery life should be multiple weeks anyway. At what point is it actually going to be useful to prolong that, and isn't going to be really annoying if your watch refuses to do what you want when you want it to?

  • Good point, maybe we all are just used to those devices that care sh*t about power management :)

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

Power Management for Sensors

Posted by Avatar for GRikell @GRikell

Actions