Merge pull request #3122 from shansou504/master

Add binaryclk clock application
pull/3126/head^2
Rob Pilling 2023-12-10 10:26:23 +00:00 committed by GitHub
commit a3a3737fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwhC/AEUiAAQEEkECBRAX/C/4Xrd+hCDI4kgR/4X/C/4XIAF53/C/4X/A4gSDC4kgC5AAvR/4X/C/4A/ADoA=="))

BIN
apps/binaryclk/app-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

36
apps/binaryclk/app.js Normal file
View File

@ -0,0 +1,36 @@
function draw() {
var dt = new Date();
var h = dt.getHours(), m = dt.getMinutes();
const t = [];
t[0] = Math.floor(h/10);
t[1] = Math.floor(h%10);
t[2] = Math.floor(m/10);
t[3] = Math.floor(m%10);
g.reset();
g.clearRect(Bangle.appRect);
let i = 0;
const sq = 29;
const gap = 8;
const mgn = 20;
const pos = sq + gap;
for (let r = 3; r >= 0; r--) {
for (let c = 0; c < 4; c++) {
if (t[c] & Math.pow(2, r)) {
g.fillRect(mgn/2 + gap + c * pos, mgn + gap + i * pos, mgn/2 + gap + c * pos + sq, mgn + gap + i * pos + sq);
} else {
g.drawRect(mgn/2 + gap + c * pos, mgn + gap + i * pos, mgn/2 + gap + c * pos + sq, mgn + gap + i * pos + sq);
}
}
i++;
}
}
g.clear();
draw();
var secondInterval = setInterval(draw, 60000);
Bangle.setUI("clock");
Bangle.loadWidgets();
Bangle.drawWidgets();

View File

@ -0,0 +1,16 @@
{
"id": "binaryclk",
"name": "Bin Clock",
"version": "0.01",
"description": "Clock face to show binary time in 24 hr format",
"icon": "app-icon.png",
"screenshots": [{"url":"screenshot.png"}],
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"allow_emulator": true,
"storage": [
{"name":"binaryclk.app.js","url":"app.js"},
{"name":"binaryclk.img","url":"app-icon.js","evaluate":true}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB