diff --git a/apps/widbt/ChangeLog b/apps/widbt/ChangeLog index b5a50210e..4c2132122 100644 --- a/apps/widbt/ChangeLog +++ b/apps/widbt/ChangeLog @@ -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. diff --git a/apps/widbt/metadata.json b/apps/widbt/metadata.json index 6e705584e..e2d5082a5 100644 --- a/apps/widbt/metadata.json +++ b/apps/widbt/metadata.json @@ -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", diff --git a/apps/widbt/widget.js b/apps/widbt/widget.js index 58b4d4b4a..c7ef8c0ad 100644 --- a/apps/widbt/widget.js +++ b/apps/widbt/widget.js @@ -1,30 +1,12 @@ -WIDGETS.bluetooth = { - area: "tr", - width: 15, - warningEnabled: 1, - 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); +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.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);