updated app.js

added/fixed queuedraw
master
eleanor 2023-03-29 14:58:20 -05:00 committed by GitHub
parent b665fff3c3
commit a8bfd90ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 8 deletions

View File

@ -49,7 +49,15 @@ function clearText(){
g.drawRect(0,offset*2,175,175-offset*2);
}
function time() {
function queueDraw() {
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
drawtime();
}, 60000 - (Date.now() % 60000));
}
function drawtime() {
var time = locale.time(d, 1);
var date = locale.date(d);
var mo = dateutil.month(d.getMonth() + 1, 1);
@ -59,14 +67,16 @@ function time() {
g.setFontAlign(0,0).setFont(currentFont, 3).drawString(mo + " " + nowDate, width/2, 130);
}
function loader() {
g.clear();
Bangle.setUI("clock");
Bangle.drawWidgets();
Bangle.loadWidgets();
time();
drawtime();
queueDraw();
}
//ready set go!
loader();
g.clear();
loader(); //drawthings
Bangle.setUI("clock");
Bangle.drawWidgets();
Bangle.loadWidgets();