I developed a watch face (LCD style with a few PNGs) and I've noticed that 1-2 seconds are missing every 10-15 seconds.
Is there an issue with this API? Or just performance?
Not that I care much, but I would love to understand a bit what's going on...
Answered! Go to the Best Answer.
Found it. I was using setInterval(clocker, 1000) as in the sample provided. The right way though is to use:
clock.granularity = "seconds";
clock.ontick = (evt) => {
clocker(evt.date);
}
This is more accurate then setting the interval.
The sample code should be updated to use this.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Are the images flickering, or do you think it's just skipping the tick event entirely?
You could try adding `load="sync"` on your <image> tags.
Are you doing much other processing within the tick event? And are you using the date object from the event itself, or are you instantiating a new date object?
Best AnswerIt's not flickering at all, it's just skipping seconds.
I am instantiating a new date and not using sync. Let me make these changes and get back to you.
I use the LCD sample on github as starting point.
Best AnswerFound it. I was using setInterval(clocker, 1000) as in the sample provided. The right way though is to use:
clock.granularity = "seconds";
clock.ontick = (evt) => {
clocker(evt.date);
}
This is more accurate then setting the interval.
The sample code should be updated to use this.