Avatar for Gordon

Gordon

Member since Sep 2013 • Last active Dec 2022

Most recent activity

    • 23 comments
    • 1,840 views
  • in Bangle.js
    Avatar for Gordon

    Ok, all fixed I hope! You'll need to download a 'cutting edge' build to fix it though

  • in Bangle.js
    Avatar for Gordon

    Looks like that's it... This breaks on Bangle.js 1:

    var mainmenu = {
      "" : { title : "-- Main Menu --", back : function() {} },
      "Hello" : function() { }
    };
    E.showMenu(mainmenu);
    

    And this breaks on Bangle.js 1 and 2:

    E.showScroller({
      h : 40, c : 8,
      draw : (idx, r) => {
        g.setBgColor((idx&1)?"#666":"#999").clea­rRect(r.x,r.y,r.x+r.w-1,r.y+r.h-1);
        g.setFont("6x8:2").drawString("Item Number\n"+idx,r.x+10,r.y+4);
      },
      select : (idx) => console.log("You selected ", idx),
      back : function() {}
    });
    

    It's from this PR https://github.com/espruino/Espruino/pul­l/2286 so it looks like while it was tested, it wasn't tested on Bangle.js 1, and unfortunately showScroller didn't get tested on either of them (although it should have been on Bangle.js 2 as part of showMenu).

    I'll try and get a fix in now

  • in Bangle.js
    Avatar for Gordon

    Hi - is your Bangle.js firmware and JS apps all up to date?

    The back button is handled in the Bangle.js firmware itself, in Bangle.setUI: https://github.com/espruino/Espruino/blo­b/master/libs/js/banglejs/Bangle_setUI_F­18.js#L85-L101

    The thing is the back button goes into the Widget bar, so if your app doesn't have widgets (or isn't expecting them) then that can cause a problem.

    ... but the pictures you show are using E.showScroller and E.showMenu and both of those should really work fine.

    If you go to the emulator https://www.espruino.com/ide/ then top-left, Emulator, Bangle.js 1, then type Bangle.factoryReset() into the left-hand side of the IDE you can see the menus and the back button work great - so I wonder if the issue is that something is out of date

  • in Bangle.js
    Avatar for Gordon

    Looks like it was added 5 months ago for 2v15 - so I wouldn't worry too much about using it. I think if you're running with new software on 2v14 and earlier you may hit other issues too :)

    ... although we could still look at adding a polyfill to the bootloader to ensure this would work fine?

    Good spot about using toISOString when the rest of the check uses the timezone! Did you notice this because there was actually a problem, or were you just looking at the code?

    Before adding the change, it'd be really good to just verify that the scheduler does fail in some cases, and to then check that the change fixes it :)

  • in Bangle.js
    Avatar for Gordon

    it seems like supporting the back button widget is the intended way forward

    Yes, absolutely!

    However, the Weather app already calls for the clock UI, which sounds like it'd conflict with using Bangle.setUI({mode : "custom", back : function() … }) to provide a back button.

    I think it would still work fine. I just tested:

    Bangle.setUI({mode:"clock",back:function­() {
      Bangle.showClock();
    }});
    

    And I think that's good. I'm not really sure I understand the reasoning behind making the weather app behave differently to every other app (going to launcher instead of the clock) but my preference would be to make 'back' go back to the clock.

    Maybe we need some kind of UX guideline in the docs regarding the use of the back button?

    Yes, I guess this might clear things up? I'm just wary of adding to the existing pile of documentation when it seems not that many people read it anyway :)

    Or a default implementation going back to clock or launcher (configurable?).

    I think we'd already discussed this in a PR? Afaik nothing stops someone from making a one-line custom boot code app that does Bangle.showClock = Bangle.showLauncher if this is what they really want.

  • in Bangle.js
    Avatar for Gordon

    As @Ganblejs says - You have clock_info.json there which is just the config file, not the library. It's best just to set up the IDE as he says and you don't need the file copied in then at all.

    I'm getting the following error on the console when I try BTN1 and BTN3.

    You mean you are trying this on Bangle.js 1? What firmware version are you on?

    UPDATE: The Red colour is the highlight color setup in slope clock++ in clockInfoDraw();

    Yes - the idea is this is temporary - just when giving focus to the clock_info. I'd considered just drawing a border around it, it it would interfere with the time's font.

    QUESTION: Does Slope ++ clock have a full screen option ?

    Not at the moment.

    QUESTION: How does one control the font size of the clock info text. Is this controlled by clock info or the clock that provides the menu.

    The clock. If you look at the tutorial I linked before you can see that the clock is responsible for the drawing code: http://www.espruino.com/Bangle.js+Clock+­Info

    PROBLEM 2: Using Bw clock. I could not get Sunrise / Sunset to display.

    Thats odd - maybe you could try with the IDE connected and see if it shows any errors?

  • in Bangle.js
    Avatar for Gordon

    Thanks - glad you're enjoying it!

    Yes, it's totally possible to change the widget positions!

    First method is just to use require("widget_utils").swipeOn() which will allow you to swipe the widgets down from the top. It's used in a few clocks now and is nice and easy.

    Second method is just to change the 'area' of widgets and set the position manually. You could do this once, but some widgets start off with width=0 and change (maybe when a message is received).

    drawWidgets itself looks like https://github.com/espruino/Espruino/blo­b/master/libs/js/banglejs/Bangle_drawWid­gets_Q3.js so if you don't have the area as tl/tr/bl/br it'll skip setting a position but will render them anyway. All you need to do is add your own drawWidgets implementation that runs first and sets the position up yourself.

    For example:

    Bangle.loadWidgets();
    
    Bangle.drawWidgets = (oldDrawWidgets => {
      y = 0;
      for (var wd of WIDGETS) {
        wd.area="_";
        if (wd.width) {
          wd.y = y;
          wd.x = 0;
          y+=24;
        }
      }
      oldDrawWidgets();
    })(Bangle.drawWidgets);
    
    Bangle.drawWidgets();
    
  • in Bangle.js
    Avatar for Gordon

    Wow, nice - those 3D printed clips look great! I'm not sure my 3D printer is capable of that!

  • in Bangle.js
    Avatar for Gordon

    The Health app doesn't turn off the HRM when the watch is motionless, BUT the HRM itself (in Bangle.js 2) detects when it's not in contact with the skin and goes into a low power mode (you'll see if doesn't flash green unless it's very close to your skin) - so actually the power consumption is tiny if the Bangle is just sitting on your desk.

Actions