forked from FOSS/BangleApps
added gps and hrm power status widgets
parent
c81091e8b8
commit
bbc98d1d46
22
apps.json
22
apps.json
|
@ -2794,5 +2794,27 @@
|
|||
{"name":"walkersclock.app.js","url":"app.js"},
|
||||
{"name":"walkersclock.img","url":"icon.js","evaluate":true}
|
||||
]
|
||||
},
|
||||
{ "id": "widgps",
|
||||
"name": "GPS Widget",
|
||||
"icon": "widget.png",
|
||||
"version":"0.01",
|
||||
"description": "Show the power on/off status of the GPS",
|
||||
"tags": "widget,gps",
|
||||
"type":"widget",
|
||||
"storage": [
|
||||
{"name":"widgps.wid.js","url":"widget.js"}
|
||||
]
|
||||
},
|
||||
{ "id": "widhrt",
|
||||
"name": "HRM Widget",
|
||||
"icon": "widget.png",
|
||||
"version":"0.01",
|
||||
"description": "Show the power on/off status of the Heart Rate Monitor",
|
||||
"tags": "widget, hrm",
|
||||
"type":"widget",
|
||||
"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()
|
||||
- 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().
|
||||
- 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