forked from FOSS/BangleApps
bluetooth widget
parent
5a5a12662e
commit
821bf21046
|
@ -120,6 +120,15 @@
|
|||
{"name":"=sbat","url":"widget-battery.js"}
|
||||
]
|
||||
},
|
||||
{ "id": "sbt",
|
||||
"name": "Bluetooth Widget",
|
||||
"icon": "widget-bluetooth.png",
|
||||
"description": "Show the current Bluetooth connection status in the top right of the clock",
|
||||
"tags": "widget,bluetooth",
|
||||
"storage": [
|
||||
{"name":"=sbt","url":"widget-bluetooth.js"}
|
||||
]
|
||||
},
|
||||
{ "id": "hrm",
|
||||
"name": "Heart Rate Monitor",
|
||||
"icon": "heartrate.png",
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
(function(){
|
||||
var img_bt = E.toArrayBuffer(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="));
|
||||
var xpos = WIDGETPOS.tr-24;
|
||||
WIDGETPOS.tr-=24;
|
||||
|
||||
function draw() {
|
||||
var x = xpos, y = 0;
|
||||
if (NRF.getSecurityStatus().connected)
|
||||
g.setColor(0,0.5,1);
|
||||
else
|
||||
g.setColor(0.3,0.3,0.3);
|
||||
g.drawImage(img_bt,10+x,2+y);
|
||||
g.setColor(1,1,1);
|
||||
}
|
||||
function changed() {
|
||||
draw();
|
||||
g.flip();
|
||||
}
|
||||
NRF.on('connected',changed);
|
||||
NRF.on('disconnected',changed);
|
||||
WIDGETS["bluetooth"]={draw:draw};
|
||||
})()
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue