12-13-2022 15:17
12-13-2022 15:17
Hi i have trouble using both the HeartRateSensor and the BodyPresenceSensor
When the user take of the watch (so body presence false) i want to disable the HeartRate Sensor and that works ok. But when the user put on the watch, the BodyPresenceSensor onreading fireup and i activate the HeartRateSensor, the BodyPresence is fired up with the present value at false
if (HeartRateSensor) {
this.heartrate = new HeartRateSensor({ frequency: 1 })
this.heartrate.onreading = () => {
this.showHeartRate()
}
this.heartrate.start()
if (BodyPresenceSensor) {
const bodySensor = new BodyPresenceSensor()
bodySensor.onreading = () => {
if (
bodySensor.present === false &&
this.heartrate.activated === true
) {
this.heartrate.stop()
} else if (this.heartrate.activated === false) {
this.heartrate.start()
}
}
bodySensor.start()
}
}
I can't see the documentation saying something abot this behaviour. Am I missing something ?