Understanding how to show seconds and minutes properly #4844
Replies: 1 comment
-
Posted at 2022-06-11 by @halemmerich Several clock use something like
to get somewhat precise second long intervals starting on the next full second according to internal Bangle time. Posted at 2022-06-11 by Alessandro You could use the new ClockFace library and avoid low-level boilerplate :) Posted at 2022-06-12 by malaire That's only accurate for first
Posted at 2022-06-14 by @gfwilliams
... is it though? Because Posted at 2022-06-14 by Andreas_Rozek Well, I usually prefer a construction like
if
But, most often, a simple Posted at 2022-06-15 by malaire hmm, how Posted at 2022-06-15 by Andreas_Rozek No, do not mix both approaches! Either use
Posted at 2022-06-15 by Hank Is there any difference regarding battery consumption in these approaches? Posted at 2022-06-15 by Andreas_Rozek I don't think so If you change intervals seldomly, Posted at 2022-06-15 by Kilrah I've experimented with that the past days and looking at examples using timeout came up with the dynamically reconfigurable timeout that has been working fine for me, logging draw calls in the console and comparing with a stopwatch it's always triggering at the right time. https://github.com/espruino/BangleApps/blob/master/apps/2ofthemclk/app.js Posted at 2022-06-16 by @halemmerich Some experiments on timeouts and intervals: This does the timeout and the interval method and calculates some metrics. The most important for me is the sum, which is the summed up errors against the expected triggering time. This results in
This seems to hint to the timeout method accumulating only a tenth of the error the interval does with 100ms waiting time and 1000 tries. I would expect the error to get smaller over time with the timeout method. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2022-06-11 by Hank
I understand most watch faces do something like
to show the seconds and there is a queueDraw in some.
I still don't get how to syncronize seconds and minutes - and using setInterval is a bit laggy.
Example:
When I set the interval to 1 second it will be executed sometime between the beginning and ending of the second. How can I execute just at the beginning of the second of the internal clock? Is there some kind of trigger for that?
Beta Was this translation helpful? Give feedback.
All reactions