Widgets can create graphic glitches

Posted on
  • Hi Everyone,
    the Bluetooth Widget (https://github.com/espruino/BangleApps/t­ree/master/apps/widbt) is creating graphic glitches in my app.

    The app uses doublebuffered LcdMode.
    The Widged calls g.flip() because it turns the screen on as a sideeffect.

    -Maxi

    edit: The app isn't even calling Bangle.drawWidgets() but the Bluetooth Widget is shown.

  • Ahh - thanks. Yes, double-buffering can't work with Widgets (the screen space available is quite small, and the widgets aren't expecting that they will effectively have to redraw twice - once of each of the 2 buffers), although I hadn't considered that '.flip' would break things as well!

    Is your app calling Bangle.loadWidgets? If you don't call that, you shouldn't have widgets

  • Yep I call loadWidgets because I need widget functionality but I am handling the rendering myself.

  • I found another problem w/ widgets.

    • If a widget fails to define a valid area no widget will get rendered.
    • If a widget fails to define it's draw function, following error will be logged:
      Error: Error: Function "draw" not found!
  • If a widget fails to define it's draw function, following error will be logged

    Yes, that's because widgets are intended to be drawn. You can always add code in appname.boot.js if you want it to run at
    I guess one solution would be to just overwrite the draw functions: Object.keys(WIDGETS).forEach(id=>WIDGETS­[id].draw=function(){})

  • I think I didn't expressed it correctly:

    If a widget fails to define a valid area no widget will get rendered.

    What I meant is:
    if a faulty widget fails to define a valid area no widgets at all will be rendered.

    You can always add code in appname.boot.js if you want it to run at

    Will the code here also run when another app (e.g. the launcher) is loaded?

  • if a faulty widget fails to define a valid area no widgets at all will be rendered.

    So you mean if it doesn't define the area field it'll break everything? If so I could add a tweak for drawWidgets that fixes this.

    Will the code here also run when another app (e.g. the launcher) is loaded?

    Yes, it'll be run all the time regardless of if you need widgets.

    You can always define a widget, but just not put anything in the WIDGETS array? That would have the desired effect too.

  • So you mean if it doesn't define the area field it'll break everything? If so I could add a tweak for drawWidgets that fixes this.

    Yes, my test widget didn't define the area (or had a faulty value) field. The default battery widget was not rendered. Did do any other tests regarding that behaviour tho.

  • Ok - I just spotted the issue, so that should be fixed in the next release

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

Widgets can create graphic glitches

Posted by Avatar for sauerman @sauerman

Actions