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.06: Tweaking colors for dark/light themes and low bpp screens
|
||||||
0.07: Memory usage improvements
|
0.07: Memory usage improvements
|
||||||
0.08: Disable LCD on, on bluetooth status change
|
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",
|
"id": "widbt",
|
||||||
"name": "Bluetooth Widget",
|
"name": "Bluetooth Widget",
|
||||||
"version": "0.11",
|
"version": "0.08",
|
||||||
"description": "Show the current Bluetooth connection status in the top right of the clock",
|
"description": "Show the current Bluetooth connection status in the top right of the clock",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,12 @@
|
||||||
WIDGETS.bluetooth = {
|
WIDGETS["bluetooth"]={area:"tr",width:15,draw:function() {
|
||||||
area: "tr",
|
|
||||||
width: 15,
|
|
||||||
warningEnabled: 1,
|
|
||||||
draw: function() {
|
|
||||||
g.reset();
|
g.reset();
|
||||||
if (NRF.getSecurityStatus().connected) {
|
if (NRF.getSecurityStatus().connected)
|
||||||
g.setColor((g.getBPP() > 8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
|
g.setColor((g.getBPP()>8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
|
||||||
} else {
|
else
|
||||||
// g.setColor(g.theme.dark ? "#666" : "#999");
|
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);
|
||||||
}
|
},changed:function() {
|
||||||
g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="), 2 + this.x, 2 + this.y);
|
WIDGETS["bluetooth"].draw();
|
||||||
},
|
}};
|
||||||
connect: function() {
|
NRF.on('connect',WIDGETS["bluetooth"].changed);
|
||||||
WIDGETS.bluetooth.draw();
|
NRF.on('disconnect',WIDGETS["bluetooth"].changed);
|
||||||
},
|
|
||||||
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);
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue