Hey, I'm trying to make a watch face that displays your heart rate each second, my onPartialUpdate is:
function onPartialUpdate(dc) {
// The width changes based on the numbers, for now lets just use a constant.
var w = 50;
var h = heartRateLabel.height;
var y = heartRateLabel.locY;
// The text is aligned to the right, so subtract the width to get x.
var x = heartRateLabel.locX - w;
dc.setClip(x, y, w, h);
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_GREEN);
dc.fillRectangle(x, y, w, h);
heartRateLabel.setText(getHeartRate());
heartRateLabel.draw(dc);
}
function getHeartRate() {
var hrIterator = ActivityMonitor.getHeartRateHistory(1, true);
var previous = hrIterator.next();
if (previous == null || previous.heartRate == ActivityMonitor.INVALID_HR_SAMPLE) {
return "--";
}
return previous.heartRate.format("%02d");
}
The problem is that it only updates once a minute.
I've tried replacing with some dummy data and I know onPartialUpdate is called once per second. Also WatchFaceDelegate#onPowerBudgetExceeded is not called.
I've seen plenty of faces on the store that do it. I'm running this on a Forerunner 645 Music.
Also, is there any way to get the simulator to provide a changing heartrate instead of the constant 80?