add GPS speed clockinfo

pull/3428/head
Gordon Williams 2024-05-17 16:33:40 +01:00
parent 83e32cd75d
commit 3eb1f8ff6b
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1 @@
0.01: New Clock Info!

View File

@ -0,0 +1,27 @@
(function() {
var speed;
function gpsHandler(e) {
speed = e.speed;
ci.items[0].emit('redraw');
}
var ci = {
name: "GPS",
items: [
{ name : "Speed",
get : function() { return { text : isFinite(speed) ? require("locale").speed(speed) : "--",
v : 0, min : isFinite(speed) ? speed : 0, max : 150,
img : atob("GBiBAAAAAAAAAAAAAAAAAAD/AAHDgAMYwAbDYAwAMAoA0BgDmBgfGB4ceBgYGBgAGBoAWAwAMAwAMAf/4AP/wAAAAAAAAAAAAAAAAA==") }},
show : function() {
Bangle.setGPSPower(1, "clkinfogpsspeed");
Bangle.on("GPS", gpsHandler);
},
hide : function() {
Bangle.removeListener("GPS", gpsHandler);
Bangle.setGPSPower(0, "clkinfogpsspeed");
}
// run : function() {} optional (called when tapped)
}
]
};
return ci;
}) // must not have a semi-colon!

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,13 @@
{ "id": "clkinfogpsspeed",
"name": "GPS Speed Clockinfo",
"shortName":"GPS Speed",
"version":"0.01",
"description": "A Clockinfo that displays your current speed according to the GPS",
"icon": "icon.png",
"type": "clkinfo",
"tags": "clkinfo",
"supports" : ["BANGLEJS2"],
"storage": [
{"name":"clkinfogpsspeed.clkinfo.js","url":"clkinfo.js"}
]
}