turn off sensors

Posted on
  • I am interested in "turning off" the sensors (gps, temperature, hrm ...) when I deem it necessary.
    From ide trying to turn off the hrm sensor it seems to me that it reactivates independently, probably some app calls an activation.
    If I make an app that turns off the sensors is it bypassed by these other calls?
    Is there a risk of doing unnecessary work?
    Is there a solution to this need?

    Thanks!

  • On the latest firmwares, they keep track of which software request which hardware. For example something might say Bangle.setHRMPower(1,"widhrm"), and that info gets stored in Bangle._PWR.HRM, which is ["app"].

    So, you could do Bangle._PWR.HRM = []; Bangle.setHRMPower(0) which would turn the HRM off. If you want to stop an app turning it back on at any point later, you could just change the function: Bangle.setHRMPower = function(){}

  • perfect, I'll try, thanks!

  • I go back to this thread again, is it possible to block the bluetooth exactly as you indicated above for HRM?
    I have not found the way, I put the bluetooth to sleep and shortly after I find it active again.

    Thanks for the help!

  • How do you put the bluetooth to sleep? And are you changing apps between times?

    Best bet is just to set BLE to Off in settings? If you want to do that with your app you could always just set the value in settings.json and then reload your app and it's done

  • To "turn off the bluetooth" I use the command:

    NRF.sleep ();

    For example, the idea is to put the sensors to sleep, especially the bluetooth when I go to bed or when I don't want connections.
    So the general line is I set the setting and don't use any other apps for a while.
    I wish I could do everything from one of my apps.

    So you confirm that all the apps on the device check the setting in settings.json?
    I fear more there is anarchy and everyone activates and deactivates the sensors as needed.

    Wouldn't it make sense to have a reference layer that apps need to verify in order to proceed? (maybe it might already be the settings.json file)
    A little bit what happens on all the various devices, if I activate an app that requires bluetooth, it warns me that it is disabled and requires activation.

    Then I don't know if it's feasible in practice ..

    Thanks.

  • I set the setting and don't use any other apps for a while.

    Ok, as long as you don't load any other apps after you do NRF.sleep it should be fine?

    So you confirm that all the apps on the device check the setting in settings.json?

    When you load any app, everything is reset to default. Then the bootloader runs and that checks settings.json and configures everything accordingly.

    Wouldn't it make sense to have a reference layer

    Well, currently setXYZPower has a second argument where you add some kind of ID - so the Bangle knows to keep the required device on as long as at least one bit of code needs it.

    But there is no general framework for forcing devices off or checking whether Bluetooth is off. It hasn't really come up to date

  • ok, thanks for the clarification.

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

turn off sensors

Posted by Avatar for uname @uname

Actions