Back button being weird on Bangle.js 1

Posted on
  • I recently updated my Bangle to the latest firmware and apps. However the back button seems to be clipping some stuff off (I attached some images). Has anyone ran into this before? Where even is the source code for the back button?


    2 Attachments

    • 20221204_143008.jpg
    • 20221204_142938.jpg
  • 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

  • This problem began recently when I updated (firmware 2v16, all apps are updated). One issue might be that I don't have any widgets installed (right now I'm using a custom clock I made that displays info on its own).

  • Reminds me a little of this issue regarding E.showMenu.

  • 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

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

  • Hm, so the problem was essentially the order of stuff accessing appRect and calling setUI? Would #2286 actually have influenced that?

  • This one? https://github.com/espruino/BangleApps/i­ssues/2286

    the problem was essentially the order of stuff accessing appRect and calling setUI

    Yes - it looked at the appRect before setUI (when there might be no widgets)

  • No, I meant the espruino pull you linked since that does not change the access order. I would suspect that it was broken even before that for the no widgets loaded situation.

  • Sorry - I was being dense there!

    I would suspect that it was broken even before that for the no widgets loaded situation.

    I don't think so, because the issue is setUI({back}) adds a widget even if there were no widgets loaded. But before that PR, showScroller/showMenu/etc couldn't ever call setUI with back so it couldn't happen

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Back button being weird on Bangle.js 1

Posted by Avatar for KTibow @KTibow

Actions