01-10-2019 08:05
01-10-2019 08:05
It appears that the body presence detector is using up quite a bit of battery life. Is it possible to deactivate it when not required and then only turn it on when required to determine if the person is wearing it?
The API doesnt appear to have a deactivate command.
Thanks,
Answered! Go to the Best Answer.
01-14-2019 09:30
01-14-2019 09:30
It really shouldn't be. The onreading event should only be called when the state changes, but I guess it's always running in the background, so that may have an impact.
Anyway, all sensors should support the stop() method, you could try using that when the display is off, then start() when the display is on.
import { display } from "display"; display.addEventListener("change", function() { if (display.on) { // start } else { // stop } })
01-14-2019 09:30
01-14-2019 09:30
It really shouldn't be. The onreading event should only be called when the state changes, but I guess it's always running in the background, so that may have an impact.
Anyway, all sensors should support the stop() method, you could try using that when the display is off, then start() when the display is on.
import { display } from "display"; display.addEventListener("change", function() { if (display.on) { // start } else { // stop } })