• Bangle.setLCDOffset() promises to do what I'd like to do, (offset the current screen to display something else, then return to the previous screen), but I can't get it to work in Bangle 2. (Nothing changes when I give it an offset.) Is there a way to make it work that I've yet to discover, or a workaround if it doesn't?

  • Unfortunately setLCDOffset was something that went through into the LCD hardware on Bangle.js 1 and made use of a chunk of extra offscreen memory - but that doesn't exist on Bangle.js 2.

    I have got a branch where I attempted to emulate the functionality, but so far I didn't have much success making that reliable.

    However you can just get an image of what's on the screen and repaint it after, so something like this actually just works fine:

    var oldImage = g.asImage();
    g.scroll(0,32);
    g.reset().setFont("12x20").drawString("H­ello World!",0,0);
    setTimeout(function() {
      g.clear().drawImage(oldImage);
      delete oldImage;
    }, 2000);
    

    The only issue is stopping other apps trying to draw things in the mean time (if you're not the main app running).

    The other thing I'd considered (which feels like less of a hack than scrolling) is to provide Bangle.js 2 with the ability to overlay a Graphics instance on top of the main screen buffer. It'd be slower to update the screen while doing that, but would be an awful lot more flexible (eg background still updating, non-square overlays, and so on).

  • Thanks for that. I was afraid it was probably the case! And I was worrying about it conflicting with other apps drawing to the screen.

    Are you stuck with where the screen buffer is? As I was wondering if you could have two and choose one or the other as the active one that's flipped to the screen. Both could be continued to be updated then.

    Your overlay approach does sound the best way to go though.

  • As I was wondering if you could have two and choose one or the other as the active one that's flipped to the screen

    That's a good point - that would be relatively easy to implement, but we probably don't want to have two buffers kicking around all the time, so we might have to allocate the second one on demand.

    It wouldn't allow for the background updating while the foreground was displayed though - and I guess that would be a nice feature :)

  • Maybe an interim measure until you implement the overlay approach? :)

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

Programming question: Does setLCDOffset() work in Bangle 2?

Posted by Avatar for CarlR @CarlR

Actions