Hello, I have been searching through these forums and found that onPartialUpdate() should work to update at 1Hz. However, I can't seem to get it to work.
Here is the relevant part of my code:
using Toybox.WatchUi;
using Toybox.Graphics;
using Toybox.System;
using Toybox.Lang;
using Toybox.Time.Gregorian as Calendar;
using Toybox.ActivityMonitor as Mon;
using Toybox.SensorHistory as Sens;
using Toybox.Communications as Comm;
class HelloWorldView extends WatchUi.WatchFace {
function initialize() {
WatchFace.initialize();
}
// Load your resources here
function onLayout(dc) {
setLayout(Rez.Layouts.WatchFace(dc));
}
// Called when this View is brought to the foreground. Restore
// the state of this View and prepare it to be shown. This includes
// loading resources into memory.
function onShow() {
}
// Update the view
function onUpdate(dc) {
setClockDisplay_hoursmin();
setClockDisplay_seconds();
setBatteryDisplay();
setStepCountDisplay();
setAltitudeDisplay();
setFloorCountDisplay();
// setHeartrateDisplay();
setDateDisplay();
// Call the parent onUpdate function to redraw the layout
View.onUpdate(dc);
}
function onPartialUpdate(dc) {
// onPartialUpdate will display updates every second all the time (30 ms per call)
setClockDisplay_seconds();
setStepCountDisplay();
}
function onHide() {
}
// The user has just looked at their watch. Timers and animations may be started here.
function onExitSleep() {
}
// Terminate any active timers and prepare for slow updates.
function onEnterSleep() {
}
private function setClockDisplay_hoursmin() {
var clockTimeHoursMin = System.getClockTime();
var timeHoursMin = Lang.format("$1$$2$", [clockTimeHoursMin.hour.format("%02d"), clockTimeHoursMin.min.format("%02d")]);
var Time_HoursMin = View.findDrawableById("TimeLabelHoursMin");
Time_HoursMin.setText(timeHoursMin);
}
private function setClockDisplay_seconds() {
var clockTimeSeconds = System.getClockTime();
var timeSeconds = Lang.format("$1$", [clockTimeSeconds.sec.format("%02d")]);
var Time_Seconds = View.findDrawableById("TimeLabelSeconds");
Time_Seconds.setText(timeSeconds);
}