[SOLVED] Sensors switched off by default?

Posted on
  • Hi there,

    I didn't find anything in the documentation: are the sensors of the Bangle like compass, HRM and GPS switched off if not needed by an app?

    E.g. I noticed, that HRM LED turns on when using the HRM app and turns off again if returning to the clock by long pressing BTN3. So who switches of the HRM? Is that being managed by the firmware?

  • With https://banglejs.com/reference#Bangle you have a singleton with which you can control the specifics of BangleJs.

    For example, https://banglejs.com/reference#t_l_BanglĀ­e_setGPSPower Bangle.setGPSPower(1); will turn the GPS receiver on, and Bangle.setGPSPower(); turns it of (of course .setGPSPower(true); and .setGPSPower(false) or .setGPSPower(0); work as well.

    I n general:

    • application run mutually exclusive
    • widgets run all the time
    • games - for performance and real estate reasons - exclude / stop also widgets

    It all depends how the applications/widgets/games are built.

  • Thanks @allObjects, of course I know about the Bangle class and the methods exposed.

    I know I can activate and deactivate those sensors manually. I was just wondering: if my app does a Bangel.setGPSPower(1), is GPS then always active even if I leave the app?

    That does not seem very power efficient. Hence the question, will GPS be switched off if I return to the clock for example?

    I had a look at some apps and I don't see and explicit: "turn off when leaving the app" code.

  • if my app does a Bangle.setGPSPower(1), is GPS then always active even if I leave the app?

    No, every time you do a long-press on BTN3 (or call load(..)/reset()) Bangle.js will turn all sensors off (apart from accelerometer, which is on all the time).

    It's one of the nice side-effects of not trying to do fancy multi-tasking at the moment - each time you start a new app, everything starts up in the same state.

  • Ok, great. Thanks for the info.

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

[SOLVED] Sensors switched off by default?

Posted by Avatar for Raik @Raik