1
0
Fork 0

sunrise: redraw the clock exactly when a minute ticks

master
Rob Pilling 2023-10-30 20:05:27 +00:00
parent 752ef5512b
commit 267b1422c2
3 changed files with 8 additions and 2 deletions

View File

@ -3,3 +3,4 @@
0.03: Show day/month, add animations, fix !mylocation and text glitch 0.03: Show day/month, add animations, fix !mylocation and text glitch
0.04: Always show the widgets, swifter animations and lighter sea line 0.04: Always show the widgets, swifter animations and lighter sea line
0.05: Fixed hours increasing too early, added missing 23 o'clock, simplified code 0.05: Fixed hours increasing too early, added missing 23 o'clock, simplified code
0.06: Draw the screen exactly on the minute boundary

View File

@ -358,13 +358,18 @@ function initialAnimation () {
initialAnimationFrame(); initialAnimationFrame();
} }
function renderAndQueue() {
setTimeout(renderAndQueue, 60000 - (Date.now() % 60000));
renderScreen();
}
function main () { function main () {
sunRiseX = xfromTime(sunrise.getHours() + sunrise.getMinutes() / 60); sunRiseX = xfromTime(sunrise.getHours() + sunrise.getMinutes() / 60);
sunSetX = xfromTime(sunset.getHours() + sunset.getMinutes() / 60); sunSetX = xfromTime(sunset.getHours() + sunset.getMinutes() / 60);
g.setBgColor(0, 0, 0); g.setBgColor(0, 0, 0);
g.clear(); g.clear();
setInterval(renderScreen, 60 * 1000); renderAndQueue();
initialAnimation(); initialAnimation();
} }

View File

@ -2,7 +2,7 @@
"id": "sunrise", "id": "sunrise",
"name": "Sunrise", "name": "Sunrise",
"shortName": "Sunrise", "shortName": "Sunrise",
"version": "0.05", "version": "0.06",
"type": "clock", "type": "clock",
"description": "Show sunrise and sunset times", "description": "Show sunrise and sunset times",
"icon": "app.png", "icon": "app.png",