• I updated the renderTopBar() method to draw the "widgets" only if its value has been changed but there's something wrong. Last night battery drop from 70% to 30% :-(

    let prevLocked = undefined;
    let prevConnected = undefined;
    
    function renderTopBar() {
        const itemW = 10;
        const itemH = 2;
    
        let locked = Bangle.isLocked();
        if (locked != prevLocked) {
          const lockColor = locked ? g.theme.fg : g.theme.bg;
          g.setColor(lockColor).fillRect(0, 0, itemW, itemH).setColor(g.theme.fg);
          prevLocked = locked;
        }
    
        let connected = NRF.getSecurityStatus().connected;
        if (connected != prevConnected) {
          const bluetoothColor = connected ? (g.theme.dark ? "#0ff" : "#00f") : (g.theme.dark ? "#666" : "#999");
          g.setColor(bluetoothColor).fillRect(item­W + 1, 0, 1 + itemW * 2, itemH).setColor(g.theme.fg);
          prevConnected = connected;
        }
    }
    
    Bangle.on("lock", b => {
        renderTopBar();
    });
    NRF.on("connect", () => {
        renderTopBar();
    });
    NRF.on("disconnect", () => {
        renderTopBar();
    });
    

    Am I missing anything else?

About

Avatar for Alessandro @Alessandro started