widadjust: Add option to hide widget
parent
70f91b5a6f
commit
5e223c24a1
|
|
@ -1,2 +1,3 @@
|
||||||
0.01: New widget
|
0.01: New widget
|
||||||
0.02: Use default Bangle formatter for booleans
|
0.02: Use default Bangle formatter for booleans
|
||||||
|
0.03: Add option to hide widget
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "widadjust",
|
"id": "widadjust",
|
||||||
"name": "Adjust Clock",
|
"name": "Adjust Clock",
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"version": "0.02",
|
"version": "0.03",
|
||||||
"description": "Adjusts clock continually in the background to counter clock drift",
|
"description": "Adjusts clock continually in the background to counter clock drift",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
"tags": "widget",
|
"tags": "widget",
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,11 @@
|
||||||
value: settings.debugLog,
|
value: settings.debugLog,
|
||||||
onchange: v => settings.debugLog = v,
|
onchange: v => settings.debugLog = v,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'Hide Widget': {
|
||||||
|
value: settings.hide || false,
|
||||||
|
onchange: v => settings.hide = v,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
E.showMenu(mainMenu);
|
E.showMenu(mainMenu);
|
||||||
|
|
|
||||||
|
|
@ -78,20 +78,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function debug(line) {
|
function debug(line) {
|
||||||
console.log(line);
|
//console.log(line);
|
||||||
if (debugLogFile !== null) {
|
if (debugLogFile !== null) {
|
||||||
debugLogFile.write(line + '\n');
|
debugLogFile.write(line + '\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
g.reset().setFont('6x8').setFontAlign(0, 0);
|
if (settings.hide !== true) {
|
||||||
g.clearRect(this.x, this.y, this.x + WIDTH - 1, this.y + 23);
|
g.reset().setFont('6x8').setFontAlign(0, 0);
|
||||||
g.drawString(Math.round(clockError), this.x + WIDTH/2, this.y + 9);
|
g.clearRect(this.x, this.y, this.x + WIDTH - 1, this.y + 23);
|
||||||
|
g.drawString(Math.round(clockError), this.x + WIDTH/2, this.y + 9);
|
||||||
|
|
||||||
if (lastPpm !== null) {
|
if (lastPpm !== null) {
|
||||||
g.setFont('4x6').setFontAlign(0, 1);
|
g.setFont('4x6').setFontAlign(0, 1);
|
||||||
g.drawString(lastPpm.toFixed(1), this.x + WIDTH/2, this.y + 23);
|
g.drawString(lastPpm.toFixed(1), this.x + WIDTH/2, this.y + 23);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,7 +210,7 @@
|
||||||
let updatedClockError = clockError + (now - lastClockErrorUpdateTime) * ppm / 1000000;
|
let updatedClockError = clockError + (now - lastClockErrorUpdateTime) * ppm / 1000000;
|
||||||
return now - updatedClockError;
|
return now - updatedClockError;
|
||||||
},
|
},
|
||||||
width: WIDTH,
|
width: settings.hide === true ? 0 : WIDTH,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settings.saveState) {
|
if (settings.saveState) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue