Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HeartRateSensor trigger the BodyPresenceSensor onreading

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 ?

Best Answer
0 Votes
0 REPLIES 0