can anyone please tell me, how i get the current heartrate every second in the "function onPartialUpdate(dc)" ?
Here's an example https://apps.garmin.com/en-US/apps/03030574-3c6e-484a-9bd8-ce2ca0249651#0
i tried with ActivityMonitor and SensorHistory but something is wrong, it is not the current heartrate.
var sensorIter = getHRIterator();
if (sensorIter != null) {
//System.println("HR-Iter " + sensorIter.next().data);
dc.setColor(HeartRateColor, BackgroundColor);
dc.drawText(25, ycenter+45, LCD30, sensorIter.next().data.format("%03d"), Graphics.TEXT_JUSTIFY_LEFT);
}
function getHRIterator() {
// Check device for SensorHistory compatibility
if ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getHeartRateHistory)) {
return Toybox.SensorHistory.getHeartRateHistory({});//{:period=>null,:order=>SensorHistory.ORDER_OLDEST_FIRST});
}
return null;
}
Thanks a lot from Germany
Patrick