1
0
Fork 0

bluetooth widget

master
Gordon Williams 2019-11-07 09:17:24 +00:00
parent 5a5a12662e
commit 821bf21046
3 changed files with 31 additions and 0 deletions

View File

@ -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",

22
apps/widget-bluetooth.js Normal file
View File

@ -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};
})()

BIN
apps/widget-bluetooth.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB