Skip to content

Commit 234680e

Browse files
authored
Merge branch 'espruino:master' into StoragwAnalyser
2 parents 45978db + 169519a commit 234680e

38 files changed

+352
-245
lines changed

apps/clkinfoclk/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"icon": "app.png",
66
"screenshots": [{"url":"screenshot.png"}],
77
"type": "clkinfo",
8-
"tags": "clkinfo",
8+
"tags": "clkinfo,clock",
99
"supports" : ["BANGLEJS2"],
1010
"storage": [
1111
{"name":"clkinfoclk.clkinfo.js","url":"clkinfo.js"}

apps/clkinfodist/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.01: New App!

apps/clkinfodist/app.png

4.88 KB
Loading

apps/clkinfodist/clkinfo.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(function() {
2+
let strideLength = (require("Storage").readJSON("myprofile.json",1)||{}).strideLength ?? 0.79,
3+
lastSteps = 0;
4+
function stepUpdateHandler() { distance.emit("redraw"); }
5+
var distance = {
6+
name : "Distance",
7+
get : () => { let v = (Bangle.getHealthStatus("day").steps - lastSteps)*strideLength; return {
8+
text : require("locale").distance(v,1),
9+
img : atob("GBiBAAMAAAeAAA/AAA/AAA/gAA/gwAfh4AfD4APD4AOH4AAH4ADj4AHjwAHhwADgAAACAAAHgAAPAAAHAAgCEBgAGD///BgAGAgAEA==")
10+
};},
11+
run : function() {
12+
lastSteps = (lastSteps>=Bangle.getHealthStatus("day").steps) ? 0 : Bangle.getHealthStatus("day").steps;
13+
this.emit("redraw");
14+
},
15+
show : function() { Bangle.on("step", stepUpdateHandler); stepUpdateHandler(); },
16+
hide : function() { Bangle.removeListener("step", stepUpdateHandler); }
17+
};
18+
return {
19+
name: "Bangle",
20+
items: [ distance ]
21+
};
22+
})

apps/clkinfodist/icon.png

4.21 KB
Loading

apps/clkinfodist/metadata.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ "id": "clkinfodist",
2+
"name": "Clockinfo Distance",
3+
"version":"0.01",
4+
"description": "Uses the 'My Profile' app's Stride Length to calculate distance travelled based on step count. Tap to reset for measuring distances.",
5+
"icon": "app.png",
6+
"screenshots": [{"url":"screenshot.png"}],
7+
"type": "clkinfo",
8+
"tags": "clkinfo,distance,steps,outdoors,tool",
9+
"dependencies": {"myprofile":"app"},
10+
"supports" : ["BANGLEJS2"],
11+
"storage": [
12+
{"name":"clkinfodist.clkinfo.js","url":"clkinfo.js"}
13+
]
14+
}

apps/clkinfodist/screenshot.png

4.93 KB
Loading

apps/clock_info/ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@
1717
0.16: Add BLE clkinfo entry
1818
0.17: Fix BLE icon alignment and border on some clocks
1919
0.18: Tweak BLE icon to add gap and ensure middle of B isn't filled
20+
0.19: Fix Altitude ClockInfo after BLE added
21+
Tapping Altitude now updates the reading

apps/clock_info/lib.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,23 @@ exports.load = function() {
3939
var hrm = 0;
4040
var alt = "--";
4141
// callbacks (needed for easy removal of listeners)
42-
function batteryUpdateHandler() { bangleItems[0].emit("redraw"); }
43-
function stepUpdateHandler() { bangleItems[1].emit("redraw"); }
42+
function batteryUpdateHandler() { bangleItems.find(i=>i.name=="Battery").emit("redraw"); }
43+
function stepUpdateHandler() { bangleItems.find(i=>i.name=="Steps").emit("redraw"); }
4444
function hrmUpdateHandler(e) {
4545
if (e && e.confidence>60) hrm = Math.round(e.bpm);
46-
bangleItems[2].emit("redraw");
46+
bangleItems.find(i=>i.name=="HRM").emit("redraw");
4747
}
4848
function altUpdateHandler() {
4949
try {
5050
Bangle.getPressure().then(data=>{
5151
if (!data) return;
5252
alt = Math.round(data.altitude) + "m";
53-
bangleItems[3].emit("redraw");
53+
bangleItems.find(i=>i.name=="Altitude").emit("redraw");
5454
});
5555
} catch (e) {
5656
print("Caught "+e+"\n in function altUpdateHandler in module clock_info");
57-
bangleItems[3].emit('redraw');}
57+
bangleItems.find(i=>i.name=="Altitude").emit('redraw');
58+
}
5859
}
5960
// actual menu
6061
var menu = [{
@@ -120,7 +121,6 @@ exports.load = function() {
120121
},
121122
},
122123
{ name: "BLE",
123-
hasRange: false,
124124
isOn: () => {
125125
const s = NRF.getSecurityStatus();
126126
return s.advertising || s.connected;
@@ -156,6 +156,7 @@ exports.load = function() {
156156
min : 0, max : settings.maxAltitude,
157157
img : atob("GBiBAAAAAAAAAAAAAAAAAAAAAAACAAAGAAAPAAEZgAOwwAPwQAZgYAwAMBgAGBAACDAADGAABv///////wAAAAAAAAAAAAAAAAAAAA==")
158158
}),
159+
run : function() { alt = "--"; this.emit("redraw"); altUpdateHandler(); },
159160
show : function() { this.interval = setInterval(altUpdateHandler, 60000); alt = "--"; altUpdateHandler(); },
160161
hide : function() { clearInterval(this.interval); delete this.interval; },
161162
});

apps/clock_info/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ "id": "clock_info",
22
"name": "Clock Info Module",
33
"shortName": "Clock Info",
4-
"version":"0.18",
4+
"version":"0.19",
55
"description": "A library used by clocks to provide extra information on the clock face (Altitude, BPM, etc)",
66
"icon": "app.png",
77
"type": "module",

0 commit comments

Comments
 (0)