Avatar for halemmerich

halemmerich

Member since Jan 2022 • Last active Feb 2023
  • 6 conversations
  • 167 comments

Most recent activity

  • in Bangle.js
    Avatar for halemmerich

    The Chargie seems very cool. Thanks for dropping that name, I had searched for something like that a few months ago without success. I use a Palm Phone with a 770mAh battery and that degraded to about half its tiny capacity in 2 years of use. Charging daily or currently twice a day and using 100%-0% every day will do that fast. The Bangle with its week long runtime will probably degrade more by age than by charging.
    As for the Bangle, a workaround would be charging from a powerbank. Many of those cut off the charging when the current is low. The Bangle draws miniscule amounts of current at the end of charge so depending on the powerbank that might hit your target charge level on cut off. Some reviews check the minimal amount of current needed to keep the power on, that would be your charging cut off value ;).

  • in Bangle.js
    Avatar for halemmerich

    Default in Gadgetbridge is currently 10s, but since that is configurable, we must handle even longer pauses between events. Should be easy by just storing the time between two events and just ignoring the case where the user changes Gadgetbridge config to a significantly higher value while phone GPS is used.

  • in Bangle.js
    Avatar for halemmerich

    You can just use the library to draw an arc like this:

    g.clear();
    const GU = require("graphics_utils");
    let centreX = 0.5 * g.getWidth();
    let centreY = 0.5 * g.getWidth();
    let startAngle = GU.degreesToRadians(20);
    let endAngle = GU.degreesToRadians(135);
    let minRadius = 0.3 * g.getWidth();
    let maxRadius = 0.45 * g.getWidth();
    GU.fillArc(g, centreX, centreY, minRadius, maxRadius, startAngle, endAngle);
    

    Gordons code does very similar things by constructing a polygon that approximates the arc.

  • in Bangle.js
    Avatar for halemmerich

    That seems to be a valid compromise. We could just switch on the first Gadgetbridge GPS event, keep time until the next arrive to get the configured timeout and then set a timeout slightly longer to re-enable builtin GPS. That way no handling of connection events would be necessary and no internal keeping of state besides the expected time to next Gadgetbridge GPS event. Maybe even communicate the configured interval duration in the first or all GPS events to make this easier to do on the bangle.

  • in Bangle.js
    Avatar for halemmerich

    This could also use fillArc() from graphics_utils lib for drawing the segments.

  • in Bangle.js
    Avatar for halemmerich

    The PR does not fix the behaviour when the GB side is configured not to provide GPS events. At least not yet. Can we check if a GB setting is set? Then it would be easy to integrate a check and prevent this situation. If we can not check the settings, maybe the app should send it's GPS setting state to the bangle when the gps_power message arrives?

  • in Bangle.js
    Avatar for halemmerich

    I have had this exact problem on imageclock while working with 4 bit. Copying over my solution from there yields the correct result, but it seems a bit complicated. It essentially uses a palette to force the colors to be correct. I suspect there is an easier way.

        let colormap={
          "#000":0,
          "#00f":1,
          "#0f0":2,
          "#0ff":3,
          "#f00":4,
          "#f0f":5,
          "#ff0":6,
          "#fff":7
        };
    
        let palette = new Uint16Array([
          0x0000, //black #000
          0x001f, //blue [#00f](http://forum.espruino.com/search/­?q=%2300f)
          0x07e0, //green [#0f0](http://forum.espruino.com/search/­?q=%230f0)
          0x07ff, //cyan [#0ff](http://forum.espruino.com/search/­?q=%230ff)
          0xf800, //red [#f00](http://forum.espruino.com/search/­?q=%23f00)
          0xf81f, //magenta [#f0f](http://forum.espruino.com/search/­?q=%23f0f)
          0xffe0, //yellow [#ff0](http://forum.espruino.com/search/­?q=%23ff0)
          0xffff, //white [#fff](http://forum.espruino.com/search/­?q=%23fff)
          0xffff, //white
          0xffff, //white
          0xffff, //white
          0xffff, //white
          0xffff, //white
          0xffff, //white
          0xffff, //white
          0xffff, //white
        ]);
    
        let g2 = Graphics.createArrayBuffer(g.getWidth() * 2, g.getHeight(), 4, {msb:true});
        let g2img = { width:g2.getWidth(), height:g2.getHeight(), bpp:4, buffer:g2.buffer, palette: palette };
        let R = Bangle.appRect;
        let x = R.w / 2;
        let y = R.y + R.h / 2;
        let animInterval;
        let animate = function(step) {
          if (animInterval) clearInterval(animInterval);
          slideX = -g2.getWidth()/2;
          animInterval = setInterval(function() {
            slideX += step;
            let stop = false;
            if (slideX>=0) {
              slideX=0;
              stop = true;
            }
            g.drawImage(g2img, slideX, 0);
            if (stop) {
              clearInterval(animInterval);
              animInterval=undefined;
            }
          }, 50);
        };
        g.reset().setBgColor("#0f0").clearRect(R­); // clear whole background
        g.setFontAlign(0, 0).setFont("Vector:30").drawString("WIBB­LE", g.getWidth()/2, g.getHeight()/2);
        let screengrab = g.asImage();
        // Draw to offscreen buffer
        g2.setColor(colormap["#f00"]).fillRect(0­,0,g2.getWidth(),g2.getHeight());
        g2.setColor(colormap["#fff"]).setFontAli­gn(0, 0).setFont("Vector:30").drawString("FLIB­BLE", g2.getWidth()/4, g2.getHeight()/2);
        g2.drawImage(screengrab, g2.getWidth()/2, 0);
        animate(3);
    

    Edit: The forum search links in the comments are somehow autogenerated from the #colorvalues

  • in Bangle.js
    Avatar for halemmerich

    Wow, that is very cool. Throw GPS in there and some kind low power display (epaper or transflective LCD) and it would be very close to perfect for me.

  • in Bangle.js
    Avatar for halemmerich

    Just a note on another minifier problem:
    Classes defined in the script seem to be removed by the minifier. Wrapping the script in a scope apparently works around this. At least it does for 2047pp. https://github.com/espruino/BangleApps/p­ull/2500

Actions