1
0
Fork 0

Changed logic for reading settings

master
Stefan Kuehnel 2020-05-24 15:05:11 +02:00
parent 6c377eb582
commit 2818c1049f
2 changed files with 12 additions and 2 deletions

View File

@ -887,7 +887,7 @@
{ "id": "berlinc",
"name": "Berlin Clock",
"icon": "berlin-clock.png",
"version":"0.03.06",
"version":"0.03.07",
"description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)",
"tags": "clock",
"type":"clock",

View File

@ -5,7 +5,9 @@ const width = g.getWidth() - 2 * offset;
const height = g.getHeight() - 2 * offset;
const rowHeight = height / 4;
const show_date = require("Storage").readJSON('berlin-clock.json')['showdate'];
const storage = require("Storage");
const settingsfile = 'berlin-clock.json';
var show_date = false;
rowlights = [];
@ -58,6 +60,14 @@ function drawBerlinClock() {
}
}
// try to read settings
try {
const settings = storage.readJSON(settingsfile);
show_date=settings['showdate'] || false;
} catch (exception) {
console.log(exception)
}
// special function to handle display switch on
Bangle.on('lcdPower', (on) => {
g.clear();