07-08-2019 09:05 - edited 07-08-2019 09:07
07-08-2019 09:05 - edited 07-08-2019 09:07
Hi everyone!
My clock granularity is set to seconds, but I noticed that the watch doesn't actually update every second. A single second gets skipped randomly, and even the console.log output shows this.
My clock face is LCD style and it animates a person running on screen every frame, so it's really apparent when the clock neglects to update a second. Anyone know how to prevent this? Do I need to rely on setInterval(update, 1000)?
My update code is here:
// Update the clock every second. clock.granularity = "seconds"; clock.ontick = (evt) => { let todayDate = evt.date; let seconds = todayDate.getSeconds(); let minutes = todayDate.getMinutes(); let hours = todayDate.getHours(); let day = todayDate.getDay(); // If we've opened the watch for the first time, fill in all variables. if (!loaded) { doMinutesEvents(minutes); doHoursEvents(hours); doDaysEvents(day, todayDate); loaded = true; } doSecondsEvents(seconds); // Lower runtime by only doing some events on a minutely, hourly, or daily basis. if (seconds == 0) doMinutesEvents(minutes); if (minutes == 0) doHoursEvents(hours); if (hours == 0) doDaysEvents(day, todayDate); }
where the only updates in doSecondsEvents() are the blinking separator for the time (the : symbol) and the runner, both of which are image updates.
Thanks in advance!
EDIT: I found this thread previously, but it seems outdated, as the source code for the LCD example clock face has updated to resemble my code now: https://community.fitbit.com/t5/SDK-Development/TickEvent-skipping-seconds/m-p/2576633#M3181
07-29-2019 02:12
07-29-2019 02:12
I have this too in a very minimal clock face. However, I have only tried this in the simulator on macos, so possibly only an issue there.?
Are you having this on a real device as well?
08-01-2019 05:38
08-01-2019 05:38