You are reading a single comment by @HughB and its replies. Click here to read the full conversation.
  • I have developed a little widget that works like the bluetooth widget to show the power status of the GPS.

    This uses Bangle.isGPSOn() which is in the leading edge formware v2.08.167
    I wont check in until that firmware is generally available.

    One thing I have found is that when I switch to a multiclock face that switches the GPS On; the widget does not repond and display the status until the LCD has powered off, or I change to a different clock face. To get round this I am poking the widget using.

            // poke the gps widget indicator to change
            if (WIDGETS.gps !== undefined) {
              WIDGETS.gps.draw();
            }
    

    Code of widget below:

    (function(){
      var img = E.toArrayBuffer(atob("GBiBAAAAAAAAAAAAAA­//8B//+BgYGBgYGBgYGBgYGBgYGBgYGB//+B//+B­gYGBgYGBgYGBgYGBgYGBgYGB//+A//8AAAAAAAAA­AAAA=="));
      
      function draw() {
        g.reset();
        if (Bangle.isGPSOn()) {
          g.setColor(1,0.8,0);     // on = amber
        } else {
          g.setColor(0.3,0.3,0.3); // off = grey
        }
        g.drawImage(img, 10+this.x, 2+this.y);
      }
    
      var timerInterval;
      Bangle.on('lcdPower', function(on) {
        if (on) {
          WIDGETS.gps.draw();
          if (!timerInterval) timerInterval = setInterval(()=>WIDGETS["gps"].draw(), 2000);
        } else {
          if (timerInterval) {
            clearInterval(timerInterval);
            timerInterval = undefined;
          }
        }
      });
    
      WIDGETS.gps={area:"tr",width:24,draw:dra­w};
    })();
    

    1 Attachment

    • thumbnail_IMG_20210206_182756 (1).jpg
About

Avatar for HughB @HughB started