Addressing review comments 2

master
singintime 2020-04-21 11:52:36 +02:00
parent bc4a05e314
commit a8cf48c794
1 changed files with 11 additions and 6 deletions

View File

@ -48,25 +48,30 @@ function draw() {
} }
} }
function drawAll() { function startDrawing() {
hour = ''; hour = '';
minute = ''; minute = '';
date = ''; date = '';
g.drawImage(bob, 0, 0, { scale: 4 }); g.drawImage(bob, 0, 0, { scale: 4 });
Bangle.drawWidgets(); Bangle.drawWidgets();
draw(); draw();
setInterval(draw, 1000);
}
function stopDrawing() {
if (timer) {
clearInterval(timer);
}
} }
Bangle.on('lcdPower', function(on) { Bangle.on('lcdPower', function(on) {
stopDrawing();
if (on) { if (on) {
drawAll(); startDrawing();
timer = setInterval(draw, 1000);
} else if (timer) {
clearInterval(timer);
} }
}); });
Bangle.loadWidgets(); Bangle.loadWidgets();
drawAll(); startDrawing();
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: 'falling' }); setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: 'falling' });