Skip to content

Commit 0ea7ea5

Browse files
authored
Merge branch 'espruino:master' into modclk-updates
2 parents a8dfd5b + 0769af1 commit 0ea7ea5

File tree

13 files changed

+176
-24
lines changed

13 files changed

+176
-24
lines changed

apps/eliteclock/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.01: initial import

apps/eliteclock/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Elite clock ![](app.png)
2+
3+
Simple binary clock for leet haxorz.
4+
5+
Written by: [Pavel Machek](https://github.com/pavelmachek)

apps/eliteclock/app-icon.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require("heatshrink").decompress(atob("mEwgIspiEPgEeAoU/4F/wGAiEAsEA4AFImAHBAolj/gRD4YFEC4UPwEfgAFC4EfF5IpHAp4dC4EQv/A/+AHYJlDnjY/AH4AJ"))

apps/eliteclock/app.png

9.63 KB
Loading

apps/eliteclock/eliteclock.app.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Bangle.js 2 - Binary Leet ClockZ
2+
/*
3+
4+
bangle.js2: create binary 'leet clock' where the time is shown as text
5+
"leet clockz" with binary 0 being normal character and binary one
6+
being leet translation. Be careful to only update time on minute
7+
boundaries.
8+
9+
So yeah — 1337 c10ckZ = certified leetspeak 😎
10+
11+
ChatGPT said:
12+
Alright, here’s a hardcore hacker variant of elite clock in full-on aggressive leetspeak:
13+
14+
£|173 ¢|_0¢|<Z
15+
16+
Breakdown:
17+
18+
E → £ or 3
19+
L → | or £
20+
I → 1 or !
21+
T → 7 or +
22+
C → ¢ or (
23+
O → 0
24+
K → |< or X
25+
26+
Other extreme variants:
27+
3|173 (|_0(<Z
28+
€|!73 ©|0xX
29+
3L1+3 (L0XXZ
30+
31+
*/
32+
33+
const TEXT = "leet\nclockz";
34+
const LEET = {
35+
"l": "1",
36+
"e": "3",
37+
"t": "7",
38+
" ": " ",
39+
"c": "(",
40+
"o": "0",
41+
"k": "X",
42+
"z": "2"
43+
};
44+
45+
// Convert hour (12h) and minute to binary mask
46+
function getBinaryFromTime(d) {
47+
let h = d.getHours() % 12;
48+
if (h === 0) h = 12; // 12-hour format: 0 becomes 12
49+
const m = d.getMinutes();
50+
const bin = ((h << 7) | m).toString(2).padStart(11, '0');
51+
return bin;
52+
}
53+
54+
// Map normal characters to leet if binary mask says so
55+
function getDisplayText(binMask) {
56+
return TEXT.split("").map((ch, i) =>
57+
binMask[i] === '1' ? (LEET[ch] || ch) : ch
58+
).join("");
59+
}
60+
61+
function draw() {
62+
g.reset().clear();
63+
const now = new Date();
64+
const bin = getBinaryFromTime(now);
65+
const txt = getDisplayText(bin);
66+
67+
const w = 0;
68+
g.setFont("Vector", 47).setFontAlign(0,0);
69+
70+
g.drawString(txt, (g.getWidth() - w) / 2, (g.getHeight() - 0) / 2);
71+
}
72+
73+
function scheduleNextDraw() {
74+
const now = new Date();
75+
const msToNextMin = 60000 - (now.getSeconds() * 1000 + now.getMilliseconds());
76+
setTimeout(() => {
77+
draw();
78+
scheduleNextDraw();
79+
}, msToNextMin);
80+
}
81+
82+
// Init
83+
draw();
84+
scheduleNextDraw();
85+
//Bangle.loadWidgets();
86+
//Bangle.drawWidgets();

apps/eliteclock/metadata.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ "id": "eliteclock",
2+
"name": "Elite clock",
3+
"version": "0.01",
4+
"description": "Simple binary clock for leet haxorz",
5+
"icon": "app.png",
6+
"readme": "README.md",
7+
"supports" : ["BANGLEJS2"],
8+
"type": "clock",
9+
"tags": "clock",
10+
"storage": [
11+
{"name":"eliteclock.app.js","url":"eliteclock.app.js"},
12+
{"name":"eliteclock.img","url":"app-icon.js","evaluate":true}
13+
]
14+
}

apps/iconbits/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ It is also possible to load existing icon into editor, using
1616
"load_icon("");" command. At the end of iconbits.app.js file there are
1717
more utility functions.
1818

19-
20-
19+
Create 48x48 icon in gimp.

apps/iconbits/icon.png

9.63 KB
Loading

apps/promenu/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
0.12: Fix bug where settings would behave as if all were set to false
1717
0.13: Update to new touch-event handling
1818
0.14: Fix bug in handling changes to `Bangle.appRect`
19+
0.15: Workaround bug in 2v26/2v27 firmware

apps/promenu/bootb2.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ var _a, _b;
22
var prosettings = (require("Storage").readJSON("promenu.settings.json", true) || {});
33
(_a = prosettings.naturalScroll) !== null && _a !== void 0 ? _a : (prosettings.naturalScroll = false);
44
(_b = prosettings.wrapAround) !== null && _b !== void 0 ? _b : (prosettings.wrapAround = true);
5-
E.showMenu = function (items) {
5+
E.showMenu = (function (items) {
6+
if (items == null) {
7+
g.clearRect(Bangle.appRect);
8+
return Bangle.setUI();
9+
}
610
var RectRnd = function (x1, y1, x2, y2, r) {
711
var pp = [];
812
pp.push.apply(pp, g.quadraticBezier([x2 - r, y1, x2, y1, x2, y1 + r]));
@@ -122,7 +126,6 @@ E.showMenu = function (items) {
122126
nameScroll_1 = 0;
123127
}, 300, name, v, item, idx, x, iy);
124128
}
125-
g.setColor(g.theme.fg);
126129
iy += fontHeight;
127130
idx++;
128131
};
@@ -204,19 +207,31 @@ E.showMenu = function (items) {
204207
else
205208
l.select(evt);
206209
};
207-
Bangle.setUI({
210+
var touchcb = (function (_button, xy) {
211+
cb(void 0, xy);
212+
});
213+
var uiopts = {
208214
mode: "updown",
209215
back: back,
210216
remove: function () {
211217
var _a;
212218
if (nameScroller)
213219
clearInterval(nameScroller);
214220
Bangle.removeListener("swipe", onSwipe);
221+
if (setUITouch)
222+
Bangle.removeListener("touch", touchcb);
215223
(_a = options.remove) === null || _a === void 0 ? void 0 : _a.call(options);
216224
},
217-
touch: (function (_button, xy) {
218-
cb(void 0, xy);
219-
}),
220-
}, cb);
225+
};
226+
var setUITouch = process.env.VERSION >= "2v26";
227+
if (!setUITouch) {
228+
uiopts.touch = touchcb;
229+
}
230+
Bangle.setUI(uiopts, cb);
231+
if (setUITouch) {
232+
Bangle.removeListener("touch", Bangle.touchHandler);
233+
delete Bangle.touchHandler;
234+
Bangle.on("touch", touchcb);
235+
}
221236
return l;
222-
};
237+
});

0 commit comments

Comments
 (0)