forked from FOSS/BangleApps
Changed logic for reading settings
parent
6c377eb582
commit
2818c1049f
|
@ -887,7 +887,7 @@
|
||||||
{ "id": "berlinc",
|
{ "id": "berlinc",
|
||||||
"name": "Berlin Clock",
|
"name": "Berlin Clock",
|
||||||
"icon": "berlin-clock.png",
|
"icon": "berlin-clock.png",
|
||||||
"version":"0.03.06",
|
"version":"0.03.07",
|
||||||
"description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)",
|
"description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
|
|
|
@ -5,7 +5,9 @@ const width = g.getWidth() - 2 * offset;
|
||||||
const height = g.getHeight() - 2 * offset;
|
const height = g.getHeight() - 2 * offset;
|
||||||
const rowHeight = height / 4;
|
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 = [];
|
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
|
// special function to handle display switch on
|
||||||
Bangle.on('lcdPower', (on) => {
|
Bangle.on('lcdPower', (on) => {
|
||||||
g.clear();
|
g.clear();
|
||||||
|
|
Loading…
Reference in New Issue