widbt: memory usage improvements

pull/863/head
Gordon Williams 2021-10-22 08:54:44 +01:00
parent f413930ced
commit e9d3527d29
3 changed files with 15 additions and 18 deletions

View File

@ -790,7 +790,7 @@
{
"id": "widbt",
"name": "Bluetooth Widget",
"version": "0.06",
"version": "0.07",
"description": "Show the current Bluetooth connection status in the top right of the clock",
"icon": "widget.png",
"type": "widget",

View File

@ -3,3 +3,4 @@
0.04: Fix automatic update of Bluetooth connection status
0.05: Make Bluetooth widget thinner, and when on a bright theme use light grey for disabled color
0.06: Tweaking colors for dark/light themes and low bpp screens
0.07: Memory usage improvements

View File

@ -1,17 +1,13 @@
(function(){
function draw() {
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);
}
function changed() {
WIDGETS["bluetooth"].draw();
g.flip();// turns screen on
}
NRF.on('connect',changed);
NRF.on('disconnect',changed);
WIDGETS["bluetooth"]={area:"tr",width:15,draw:draw};
})()
NRF.on('connect',WIDGETS["bluetooth"].changed);
NRF.on('disconnect',WIDGETS["bluetooth"].changed);
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();
Bangle.setLCDPower(1); // turn screen on
}};