Pastel, recalc sunrise,sunset every hour

master
hughbarney 2021-11-27 11:23:03 +00:00
parent 21fe6e7ea4
commit 3fbb46b046
2 changed files with 6 additions and 2 deletions

View File

@ -4086,7 +4086,7 @@
"name": "Pastel Clock", "name": "Pastel Clock",
"shortName": "Pastel", "shortName": "Pastel",
"version": "0.08", "version": "0.08",
"description": "A Configurable clock with custom fonts and background", "description": "A Configurable clock with custom fonts and background. Has a cyclic information line that includes, day, date, battery, sunrise and sunset times",
"icon": "pastel.png", "icon": "pastel.png",
"dependencies": {"mylocation":"widget"}, "dependencies": {"mylocation":"widget"},
"screenshots": [{"url":"screenshot_pastel.png"}], "screenshots": [{"url":"screenshot_pastel.png"}],

View File

@ -23,6 +23,7 @@ function extractTime(d){
var sunRise = "00:00"; var sunRise = "00:00";
var sunSet = "00:00"; var sunSet = "00:00";
var drawCount = 0;
function updateSunRiseSunSet(now, lat, lon, line){ function updateSunRiseSunSet(now, lat, lon, line){
// get today's sunlight times for lat/lon // get today's sunlight times for lat/lon
@ -175,6 +176,10 @@ function draw() {
g.setFontLatoSmall(); g.setFontLatoSmall();
g.setFontAlign(0, -1); g.setFontAlign(0, -1);
g.drawString((infoData[infoMode].calc()), w/2, h - 24 - 24); g.drawString((infoData[infoMode].calc()), w/2, h - 24 - 24);
if (drawCount % 3600 == 0)
updateSunRiseSunSet(new Date(), location.lat, location.lon);
drawCount++;
} }
// Only update when display turns on // Only update when display turns on
@ -197,7 +202,6 @@ Bangle.setUI("clockupdown", btn=> {
loadSettings(); loadSettings();
loadFonts(); loadFonts();
loadLocation(); loadLocation();
updateSunRiseSunSet(new Date(), location.lat, location.lon);
g.clear(); g.clear();
var secondInterval = setInterval(draw, 1000); var secondInterval = setInterval(draw, 1000);