Blob clock tweaks

pull/148/head
Gordon Williams 2020-01-16 16:01:29 +00:00
parent 668aa08fb6
commit fbb18d1128
3 changed files with 9 additions and 12 deletions

View File

@ -627,7 +627,7 @@
{ "id": "blobclk",
"name": "Large Digit Clock",
"icon": "clock-blob.png",
"version":"0.01",
"version":"0.02",
"description": "A clock with big digits",
"tags": "clock",
"type":"clock",

3
apps/blobclk/ChangeLog Normal file
View File

@ -0,0 +1,3 @@
0.02: Improve performance when screen wakes
Only draw widgets after clearing screen - they update automatically
Remove 'faceUp' check as it's automatic

View File

@ -17,7 +17,6 @@
function flip() {
g.setColor(1,1,1);
g.drawImage({width:buf.getWidth(),height:buf.getHeight(),buffer:buf.buffer},55,26);
try { if (drawWidgets) { drawWidgets();} } catch(err) {}
}
function drawPixel(ox,oy,x,y,r,p) {
let x1 = ox+x*(r*2+1);
@ -81,28 +80,23 @@
flip();
}
function clearTimers() {
if(intervalRef) {clearInterval(intervalRef);}
if(intervalRef) {
clearInterval(intervalRef);
intervalRef = undefined;
}
}
function startTimers() {
g.clear();
digits = [-1,-1,-1,-1,-1,-1];
try { if (drawWidgets) { drawWidgets();} } catch(err) {}
intervalRef = setInterval(redraw,1000);
redraw();
}
startTimers();
Bangle.on('lcdPower',function(on) {
if (on) {
g.clear();
startTimers();
try { if (drawWidgets) { drawWidgets();} } catch(err) {}
} else {
clearTimers();
}
});
Bangle.on('faceUp',function(up){
if (up && !Bangle.isLCDOn()) {
clearTimers();
Bangle.setLCDPower(true);
}
});
})();