Replaced template String with concatenation. Performed code indentation. Enabled settings again.

master
Stefan Kuehnel 2020-05-24 13:54:32 +02:00
parent 17d5e1a1c4
commit bcea5326a5
2 changed files with 52 additions and 48 deletions

View File

@ -887,7 +887,7 @@
{ "id": "berlinc",
"name": "Berlin Clock",
"icon": "berlin-clock.png",
"version":"0.03.02",
"version":"0.03.03",
"description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)",
"tags": "clock",
"type":"clock",
@ -898,6 +898,7 @@
"storage": [
{"name":"berlinc.app.js","url":"berlin-clock.js"},
{"name":"berlinc.img","url":"berlin-clock-icon.js","evaluate":true},
{"name":"berlinc.settings.js","url":"settings.js"},
{"name":"berlin-clock.json","url":"berlin-clock.json"}
]
},

View File

@ -16,7 +16,10 @@ function drawBerlinClock() {
var yr = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
var dateString=`${yr}-${month<10?'0':''}${month}-${day<10?'0':''}${day}`;
//var dateString = `${yr}-${month < 10 ? '0' : ''}${month}-${day < 10 ? '0' : ''}${day}`;
var monthZero = month < 10 ? '0' : '';
var dayZero = day < 10 ? '0' : '';
var dateString = yr + "-" + monthZero + month + "-" + dayZero + day;
var strWidth = g.stringWidth(dateString);
g.setColor(1, 1, 1);
g.drawString(dateString, (g.getWidth() - strWidth) / 2, height + offset + 2);
@ -50,7 +53,6 @@ function drawBerlinClock() {
} else {
g.setColor(1, 0, 0);
}
g.fillRect(x1 + 2, y1 + 2, x2 - 2, y2 - 2);
}
}
@ -64,7 +66,8 @@ Bangle.on('lcdPower', (on) => {
Bangle.drawWidgets();
// call your app function here
drawBerlinClock();
}});
}
});
// refesh every 15 sec
setInterval(drawBerlinClock, 15E3);