Restored widbt

I restored the widbt code and made a separate widget widbt_notify.
master
KungPhoo 2022-03-30 07:25:49 +02:00
parent 3986899c8b
commit 85a0c4100d
3 changed files with 13 additions and 34 deletions

View File

@ -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.

View File

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

View File

@ -1,30 +1,12 @@
WIDGETS.bluetooth = { WIDGETS["bluetooth"]={area:"tr",width:15,draw:function() {
area: "tr", g.reset();
width: 15, if (NRF.getSecurityStatus().connected)
warningEnabled: 1, g.setColor((g.getBPP()>8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f"));
draw: function() { else
g.reset(); g.setColor(g.theme.dark ? "#666" : "#999");
if (NRF.getSecurityStatus().connected) { g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),2+this.x,2+this.y);
g.setColor((g.getBPP() > 8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f")); },changed:function() {
} else { WIDGETS["bluetooth"].draw();
// g.setColor(g.theme.dark ? "#666" : "#999"); }};
g.setColor("#f00"); // red is easier to distinguish from blue NRF.on('connect',WIDGETS["bluetooth"].changed);
} NRF.on('disconnect',WIDGETS["bluetooth"].changed);
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);