[SOLVED] Numerals app fails to update with errors

Posted on
  • Hi all,

    I got a problem with the Numerals app I can't explain. Occasionally it just stops updating the time at all. I finally had the oppportunity to right then connect it to the Web IDE.

    I get the following errors when the lcdPower-on event fires:

    Uncaught Error: Cannot read property 'setColor' of undefined
     at line 1 col 349
    ...undefined)drawFunc=drawFuncs.fill;g.c­learRect(0,24,240,240);drawNum(...
                                          ^
    in function "draw" called from line 1 col 76
    ...andom()*_hCol.length);draw();setUpdat­eInt(1);}else setUpdateInt(...
                                      ^
    in function called from system
     at line 1 col 2
    g.reset();
     ^
    in function "draw" called from line 2 col 26
         WIDGETS["ram"].draw();
                             ^
    in function called from system
     at line 14 col 4
      g.setColor(-1);
       ^
    in function "draw" called from line 2 col 30
      else WIDGETS["batpc"].draw();
                                 ^
    in function "update" called from line 2 col 11
       update();
              ^
    in function called from system
    

    Is the draw function from the numerals app somehow conflicting with the draw methods from the widgets? It worked fine before, not sure when it stopped working reliably.

  • Do you have any other apps/widgets installed? Since by default things share a global namespace if some code overwrote the g variable you'd get an error like this.

    Since it seems you're connected with the IDE maybe you could just look at what g actually is? It might give you some clues as to where it is being overwritten

  • >g
    =undefined
    

    Hmm, it's undefined. I am running those widgets:

    >WIDGETS
    ={
      heart: {
        area: "tl",
        width: 0,
        draw: function () { ... },
        reload: function () { ... },
        x: 28, y: 0 },
      bluetooth: {
        area: "tr",
        width: 24,
        draw: function () { ... },
        x: 188, y: 0 },
      ram: {
        area: "tl",
        width: 24,
        draw: function () { ... },
        x: 28, y: 0 },
      batpc: {
        area: "tr",
        width: 40,
        draw: function () { ... },
        reload: function () { ... },
        x: 148, y: 0 },
      gbridgex: {
        area: "tl",
        width: 24,
        draw: function () { ... },
        x: 52, y: 0 },
      gpsrec: {
        area: "tl",
        width: 0,
        draw: function () { ... },
        reload: function () { ... },
        x: 76, y: 0 }
     }
    

    gbridgex is a custom gbridge widget, but worked fine in the past.

    I am also using notifyfs which seems to set oldg=g and then later oldg=undefined but also worked fine in the past.

    I am pretty sure it is one of the two, because it just happened to not refresh after displaying a text message on the watch.

    I will have to dig further on this one.

  • Thanks, that's great! I think if .hide got called twice it could cause problems by the look of it.

    I've just put in a fix, so if you try updating notifyfs to 0.05 via https://espruino.github.io/BangleApps/ it might well fix it for you

  • Nice find thx. But wow, that somehow broke my watch, see screenshot.

    First the app loader showed this:
    ui.js:86 <TOAST>[error] Fullscreen Notifications update failed, Unexpected response

    Then after long press BTN3 and a long pause and retry to upload it showed this:
    ui.js:86 <TOAST>[error] Upload failed, Unexpected response Uncaught Error: File already written with different data

    I uploaded the log output from Chrome also. Let see if I can clean up the mess manually and start again.

    EDIT: ok, got it cleaned up and seems to work now. Not sure what happened there though.


    2 Attachments

  • Thanks - that's an odd one. There are filenames in there that aren't even in the uploaded text so something went very wrong.

    It looks like maybe there was something running that was taking a long time to complete (eg. seconds) and maybe that overflowed the input buffer and some characters got lost. Having that happen in such a way that the filename gets changed and the code is valid JS so doesn't cause an error seems amazingly unlikely though

  • I think if .hide got called twice it could cause problems by the look of it.

    That seems to have fixed it. I did not have the issue since. :-)

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

[SOLVED] Numerals app fails to update with errors

Posted by Avatar for Raik @Raik

Actions