see edit below Regarding Bangle.getHealthStatus().movement > 146: from the docs,
movement is the sum of diffs, so you can't just use a constant
threshold. And as Gordon pointed out, it only resets every 10min.
Anyways, Bangle.js already detects movement for powerSave option and for me this would be sufficient. The following proof-of-concept works well enough for me:
function is_worn() {
return new Promise(function(resolve, reject) {
var i = 0;
function on_accel(a) { i++; }
Bangle.on('accel', on_accel);
setTimeout(function() {
Bangle.removeListener('accel', on_accel);
resolve(1 < i);
}, 3*80);
});
}
I didn't find a way to get the current power state/poll interval/"hasn't moved". Is there?
edit: I was wrong, acceleration diffs are unsigned, sry
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
I was using https://banglejs.com/apps/?id=health for a day until I realized that it doesn't stop HRM when I stop wearing it at night.
see edit below
Regarding
Bangle.getHealthStatus().movement > 146
: from the docs,movement is the sum of diffs, so you can't just use a constant
threshold. And as Gordon pointed out, it only resets every 10min.
Anyways, Bangle.js already detects movement for powerSave option and for me this would be sufficient. The following proof-of-concept works well enough for me:
I didn't find a way to get the current power state/poll interval/"hasn't moved". Is there?
edit: I was wrong, acceleration diffs are unsigned, sry