Add a clockinfo for displaying seconds - handy as most clocks don't support it

pull/3376/head
Gordon Williams 2024-04-19 15:30:44 +01:00
parent 7d59266438
commit 849b5ae545
5 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1 @@
0.01: New App!

BIN
apps/clkinfosec/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

View File

@ -0,0 +1,33 @@
(function() {
return {
name: "Bangle",
items: [
{ name : "Seconds",
get : () => {
let d = new Date(), s = d.getSeconds(), sr = s*Math.PI/30,
x = 11+9*Math.sin(sr), y = 11-9*Math.cos(sr),
g = Graphics.createArrayBuffer(24,24,1,{msb:true});
g.transparent = 0;
g.drawImage(atob("GBgBAP4AA/+ABwHAHABwGAAwMAAYYAAMYAAMwAAGwAAGwAAGwAAGwAAGwAAGwAAGYAAMYAAMMAAYGAAwHABwBwHAA/+AAP4AAAAA"));
g.drawLine(11,11,x,y).drawLine(12,11,x+1,y).drawLine(11,12,x,y+1).drawLine(12,12,x+1,y+1);
return {
text : s.toString().padStart(2,0)+"s",
img : g.asImage("string")
};
},
show : function() {
this.interval = setTimeout(()=>{
this.emit("redraw");
this.interval = setInterval(()=>{
this.emit("redraw");
}, 1000);
}, 1000 - (Date.now() % 1000));
},
hide : function() {
clearInterval(this.interval);
this.interval = undefined;
}
}
]
};
})

View File

@ -0,0 +1,13 @@
{ "id": "clkinfosec",
"name": "Secondx Clockinfo",
"version":"0.01",
"description": "For clocks that display 'clockinfo' (messages that can be cycled through using the clock_info module) this displays the time in seconds (many clocks only display minutes)",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clkinfo",
"tags": "clkinfo,seconds,time",
"supports" : ["BANGLEJS2"],
"storage": [
{"name":"clkinfosec.clkinfo.js","url":"clkinfo.js"}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB