Fix battery ...again

pull/1540/head
Stergios Mekras 2022-03-03 20:15:32 +01:00
parent 7a8f3d9bd9
commit fd9fb6cba4
2 changed files with 6 additions and 14 deletions

View File

@ -99,7 +99,7 @@ function draw() {
g.drawImage(background); g.drawImage(background);
const color = getBatteryColor(batLevel); const color = getBatteryColor(batLevel);
const bat; const bat = "";
const d = new Date(); const d = new Date();
const day = d.getDate(); const day = d.getDate();
const month = d.getMonth() + 1; const month = d.getMonth() + 1;
@ -111,9 +111,9 @@ function draw() {
const time = d02(h) + ":" + d02(m); const time = d02(h) + ":" + d02(m);
if (E.getBattery() < 100) { if (E.getBattery() < 100) {
bat = d02(E.getBattery()) + "%" bat = d02(E.getBattery()) + "%";
} else { } else {
bat = E.getBattery() + "%" bat = E.getBattery() + "%";
} }
g.reset(); g.reset();
@ -146,6 +146,8 @@ function draw() {
loadSettings(); loadSettings();
console.log(settings);
g.clear(); g.clear();
pollBattery(); pollBattery();

View File

@ -6,17 +6,7 @@
var FILE = "smclock.json"; var FILE = "smclock.json";
// load settings from the file // load settings from the file
// assign default values if it doesn't exist // assign default values if it doesn't exist
var settings = Object.assign( var settings = Object.assign(require("Storage").readJSON(FILE, true) || {});
{
dateFormat: "Short",
drawInterval: 10,
pollInterval: 60,
showAnalogFace: false,
showWeekInfo: false,
useVectorFont: false,
},
require("Storage").readJSON(FILE, true) || {}
);
// write the new settings to the file // write the new settings to the file
function writeSettings() { function writeSettings() {