I modified the test code a bit, and it seems that the HRM event always gets a higher BPM than the manual counting:
var M = g.getWidth() / 2; var yr, yg, yc, yd; let beats = []; Bangle.on("HRM-raw", (hrm) => { g.scroll(0, 1); g.setPixel(M, 0, "#ff0"); g.setColor(hrm.adjusted ? "#000" : "#0F0").fillRect( yg, 0, (yg = hrm.raw / 32), 0 ); g.setColor("#F00").fillRect(yr, 0, (yr = M + hrm.filt / 256 - 30), 0); g.setColor("#F0F").fillRect(yc, 0, (yc = M + (hrm.raw - hrm.avg) / 128 + 30), 0); if (hrm.isBeat) { g.fillRect(yr - 4, 0, yr + 4, 0); beats.push(Date.now()); } }); Bangle.setHRMPower(1); Bangle.setLCDTimeout(0); Bangle.setLCDPower(1); setInterval(() => { beats = beats.filter(b => b > Date.now() - 60 * 1000); console.log(beats.length, "BPM"); }, 1000); Bangle.on("HRM", (hrm) => console.log("OFFICIAL:", hrm.bpm, "BPM", hrm.confidence));
Any idea why?
@KTibow started
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.
I modified the test code a bit, and it seems that the HRM event always gets a higher BPM than the manual counting:
Any idea why?