binaryclk: removed battery percentage and cleaned up logic
parent
37441775a8
commit
5bb3b0d3e0
|
|
@ -4,3 +4,4 @@
|
||||||
0.04: Added settings to hide unused squares and show date
|
0.04: Added settings to hide unused squares and show date
|
||||||
0.05: Minor code improvements
|
0.05: Minor code improvements
|
||||||
0.06: Added setting to show battery and added artwork to date
|
0.06: Added setting to show battery and added artwork to date
|
||||||
|
0.07: Removed percentage from battery and cleaned up logic
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
var settings = Object.assign({
|
var settings = Object.assign({
|
||||||
fullscreen: false,
|
fullscreen: true,
|
||||||
hidesq: false,
|
hidesq: false,
|
||||||
showdate: false,
|
showdate: true,
|
||||||
showbat: false,
|
showbat: true,
|
||||||
}, require('Storage').readJSON("binaryclk.json", true) || {});
|
}, require('Storage').readJSON("binaryclk.json", true) || {});
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
|
|
@ -81,22 +81,19 @@ function draw() {
|
||||||
if (cnt == 0) {
|
if (cnt == 0) {
|
||||||
if (settings.showbat) {
|
if (settings.showbat) {
|
||||||
var bat = E.getBattery();
|
var bat = E.getBattery();
|
||||||
if (bat > 50) {
|
if (bat < 20) {
|
||||||
g.setColor('#00FF00').fillRect(Math.floor(mgn/2) + gap + 2 * pos, mgn + gap, Math.floor(mgn/2) + gap + 2 * pos + Math.floor(bat * sq / 100), mgn + gap + sq);
|
g.setColor('#FF0000');
|
||||||
} else if (bat < 51 && bat > 21) {
|
} else if (bat < 40) {
|
||||||
g.setColor('#FFA500').fillRect(Math.floor(mgn/2) + gap + 2 * pos, mgn + gap, Math.floor(mgn/2) + gap + 2 * pos + Math.floor(bat * sq / 100), mgn + gap + sq);
|
g.setColor('#FFA500');
|
||||||
} else {
|
} else {
|
||||||
g.setColor('#FF0000').fillRect(Math.floor(mgn/2) + gap + 2 * pos, mgn + gap, Math.floor(mgn/2) + gap + 2 * pos + Math.floor(bat * sq / 100), mgn + gap + sq);
|
g.setColor('#00FF00');
|
||||||
}
|
}
|
||||||
bat = bat + '%';
|
g.fillRect(Math.floor(mgn/2) + gap + 2 * pos, mgn + gap, Math.floor(mgn/2) + gap + 2 * pos + Math.floor(bat * sq / 100), mgn + gap + sq);
|
||||||
if (g.theme.dark) {
|
if (g.theme.dark) {
|
||||||
g.setColor(-1);
|
g.setColor(-1);
|
||||||
} else {
|
} else {
|
||||||
g.setColor(1);
|
g.setColor(1);
|
||||||
}
|
}
|
||||||
g.setFontAlign(0, 0);
|
|
||||||
g.setFont("Vector",14);
|
|
||||||
g.drawString(bat, Math.ceil(mgn/2) + gap + 2 * pos + Math.ceil(sq/2) + 1, mgn + gap + Math.ceil(sq/2) + 1);
|
|
||||||
g.drawRect(Math.floor(mgn/2) + gap + 2 * pos, mgn + gap, Math.floor(mgn/2) + gap + 2 * pos + sq, mgn + gap + sq);
|
g.drawRect(Math.floor(mgn/2) + gap + 2 * pos, mgn + gap, Math.floor(mgn/2) + gap + 2 * pos + sq, mgn + gap + sq);
|
||||||
}
|
}
|
||||||
cnt =+ cnt;
|
cnt =+ cnt;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "binaryclk",
|
"id": "binaryclk",
|
||||||
"name": "Bin Clock",
|
"name": "Bin Clock",
|
||||||
"version": "0.06",
|
"version": "0.07",
|
||||||
"description": "Clock face to show binary time in 24 hour format",
|
"description": "Clock face to show binary time in 24 hour format",
|
||||||
"icon": "app-icon.png",
|
"icon": "app-icon.png",
|
||||||
"screenshots": [{"url":"screenshot.png"}],
|
"screenshots": [{"url":"screenshot.png"}],
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in New Issue