mirror of https://github.com/espruino/BangleApps
Merge pull request #669 from hughbarney/master
added tiny power status widgets for GPS and HRMpull/672/head
commit
414505339b
24
apps.json
24
apps.json
|
@ -2794,5 +2794,29 @@
|
||||||
{"name":"walkersclock.app.js","url":"app.js"},
|
{"name":"walkersclock.app.js","url":"app.js"},
|
||||||
{"name":"walkersclock.img","url":"icon.js","evaluate":true}
|
{"name":"walkersclock.img","url":"icon.js","evaluate":true}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{ "id": "widgps",
|
||||||
|
"name": "GPS Widget",
|
||||||
|
"icon": "widget.png",
|
||||||
|
"version":"0.01",
|
||||||
|
"description": "Tiny widget to show the power on/off status of the GPS. Require firmware v2.08.167 or later",
|
||||||
|
"tags": "widget,gps",
|
||||||
|
"type":"widget",
|
||||||
|
"readme": "README.md",
|
||||||
|
"storage": [
|
||||||
|
{"name":"widgps.wid.js","url":"widget.js"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ "id": "widhrt",
|
||||||
|
"name": "HRM Widget",
|
||||||
|
"icon": "widget.png",
|
||||||
|
"version":"0.01",
|
||||||
|
"description": "Tiny widget to show the power on/off status of the Heart Rate Monitor. Requires firmware v2.08.167 or later",
|
||||||
|
"tags": "widget, hrm",
|
||||||
|
"type":"widget",
|
||||||
|
"readme": "README.md",
|
||||||
|
"storage": [
|
||||||
|
{"name":"widhrt.wid.js","url":"widget.js"}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
0.01: First version
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
# GPS Power Status Widget
|
||||||
|
|
||||||
|
A simple widget that shows the on/off status of the GPS.
|
||||||
|
|
||||||
|
The GPS can quickly run the battery down if it is on all the time so
|
||||||
|
it is useful to know if it has been switched on or not.
|
||||||
|
|
||||||
|
- Uses Bangle.isGPSOn(), requires firmware v2.08.167 or later
|
||||||
|
- Shows in grey when the GPS is off
|
||||||
|
- Shows in amber when the GPS is on
|
|
@ -0,0 +1,28 @@
|
||||||
|
(function(){
|
||||||
|
var img = E.toArrayBuffer(atob("GBiBAAAAAAAAAAAAAA//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAAAAAA=="));
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
g.reset();
|
||||||
|
if (Bangle.isGPSOn()) {
|
||||||
|
g.setColor(1,0.8,0); // on = amber
|
||||||
|
} else {
|
||||||
|
g.setColor(0.3,0.3,0.3); // off = grey
|
||||||
|
}
|
||||||
|
g.drawImage(img, 10+this.x, 2+this.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
var timerInterval;
|
||||||
|
Bangle.on('lcdPower', function(on) {
|
||||||
|
if (on) {
|
||||||
|
WIDGETS.gps.draw();
|
||||||
|
if (!timerInterval) timerInterval = setInterval(()=>WIDGETS["gps"].draw(), 2000);
|
||||||
|
} else {
|
||||||
|
if (timerInterval) {
|
||||||
|
clearInterval(timerInterval);
|
||||||
|
timerInterval = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
WIDGETS.gps={area:"tr",width:24,draw:draw};
|
||||||
|
})();
|
Binary file not shown.
After Width: | Height: | Size: 328 B |
|
@ -0,0 +1,2 @@
|
||||||
|
0.01: First version
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Heart Rate Power Monitor Widget
|
||||||
|
|
||||||
|
A simple widget that shows the on/off status of the Heart Rate
|
||||||
|
Monitor.
|
||||||
|
|
||||||
|
- Uses Bangle.isHRTOn(). Requires firmware v2.08.167 or later.
|
||||||
|
- Shows in grey when the HRT is off
|
||||||
|
- Shows in red when the HRT is on
|
|
@ -0,0 +1,28 @@
|
||||||
|
(function(){
|
||||||
|
var img = E.toArrayBuffer(atob("FhaBAAAAAAAAAAAAAcDgD8/AYeGDAwMMDAwwADDAAMOABwYAGAwAwBgGADAwAGGAAMwAAeAAAwAAAAAAAAAAAAA="));
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
g.reset();
|
||||||
|
if (Bangle.isHRMOn()) {
|
||||||
|
g.setColor(1,0,0); // on = red
|
||||||
|
} else {
|
||||||
|
g.setColor(0.3,0.3,0.3); // off = grey
|
||||||
|
}
|
||||||
|
g.drawImage(img, 10+this.x, 2+this.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
var timerInterval;
|
||||||
|
Bangle.on('lcdPower', function(on) {
|
||||||
|
if (on) {
|
||||||
|
WIDGETS.widhrt.draw();
|
||||||
|
if (!timerInterval) timerInterval = setInterval(()=>WIDGETS["widhrt"].draw(), 2000);
|
||||||
|
} else {
|
||||||
|
if (timerInterval) {
|
||||||
|
clearInterval(timerInterval);
|
||||||
|
timerInterval = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
WIDGETS.widhrt={area:"tr",width:24,draw:draw};
|
||||||
|
})();
|
Binary file not shown.
After Width: | Height: | Size: 848 B |
Loading…
Reference in New Issue