Restored widbt
I restored the widbt code and made a separate widget widbt_notify.master
parent
3986899c8b
commit
85a0c4100d
|
|
@ -5,6 +5,3 @@
|
|||
0.06: Tweaking colors for dark/light themes and low bpp screens
|
||||
0.07: Memory usage improvements
|
||||
0.08: Disable LCD on, on bluetooth status change
|
||||
0.09: Vibrate on connection loss
|
||||
0.10: Bug fix
|
||||
0.11: Avoid too many notifications. Change disconnected colour to red.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "widbt",
|
||||
"name": "Bluetooth Widget",
|
||||
"version": "0.11",
|
||||
"version": "0.08",
|
||||
"description": "Show the current Bluetooth connection status in the top right of the clock",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
|||
|
|
@ -1,30 +1,12 @@
|
|||
WIDGETS.bluetooth = {
|
||||
area: "tr",
|
||||
width: 15,
|
||||
warningEnabled: 1,
|
||||
draw: function() {
|
||||
WIDGETS["bluetooth"]={area:"tr",width:15,draw:function() {
|
||||
g.reset();
|
||||
if (NRF.getSecurityStatus().connected) {
|
||||
g.setColor((g.getBPP() > 8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
|
||||
} else {
|
||||
// g.setColor(g.theme.dark ? "#666" : "#999");
|
||||
g.setColor("#f00"); // red is easier to distinguish from blue
|
||||
}
|
||||
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="), 2 + this.x, 2 + this.y);
|
||||
},
|
||||
connect: function() {
|
||||
WIDGETS.bluetooth.draw();
|
||||
},
|
||||
disconnect: function() {
|
||||
if(WIDGETS.bluetooth.warningEnabled == 1){
|
||||
Bangle.buzz(700, 1); // buzz on connection loss
|
||||
E.showMessage("Connection\nlost.","Bluetooth");
|
||||
WIDGETS.bluetooth.warningEnabled = 0;
|
||||
setTimeout('WIDGETS.bluetooth.warningEnabled = 1;', 30000); // re-notify only after 30 seconds.
|
||||
}
|
||||
WIDGETS.bluetooth.draw();
|
||||
}
|
||||
};
|
||||
|
||||
NRF.on('connect', WIDGETS.bluetooth.connect);
|
||||
NRF.on('disconnect', WIDGETS.bluetooth.disconnect);
|
||||
if (NRF.getSecurityStatus().connected)
|
||||
g.setColor((g.getBPP()>8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
|
||||
else
|
||||
g.setColor(g.theme.dark ? "#666" : "#999");
|
||||
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),2+this.x,2+this.y);
|
||||
},changed:function() {
|
||||
WIDGETS["bluetooth"].draw();
|
||||
}};
|
||||
NRF.on('connect',WIDGETS["bluetooth"].changed);
|
||||
NRF.on('disconnect',WIDGETS["bluetooth"].changed);
|
||||
|
|
|
|||
Loading…
Reference in New Issue