• I'm waiting for my BangleJS 2 to arrive by mail. In the meantime, I already had a look at a bunch of documentation and started building my first app with the emulator.

    My first attempt was trying to reimplement the pebble clock but using the layout library.

    However, my code seems to be very inefficient, even though I'm lacking still a bunch of features of the original implementation but the emulator is already running out of memory for the BangleJS 1. It wouldn't matter in my case since I have the BangleJS 2. But if something that small is already causing issues I should understand how to build apps more efficiently.

    >
     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v12 (c) 2021 G.Williams
    >
    >Execution Interrupted
    in function called from line 1 col 44
    c.type=='btn'&&b.push(c),c.c&&c.c.forEac­h(a)
                            in function called from line 1 col 44
    c.type=='btn'&&b.push(c),c.c&&c.c.forEac­h(a)
                                               in function "a" called from line 1 col 286
    ...(c),c.c&&c.c.forEach(a)}a(c),b.length­&&(this.physBtns=0,this...
                    in function "Layout" called from line 27 col 4
      });
       ^
    in function "createLayout" called from line 1 col 29
    const layout = createLayout();
                                ^
    New interpreter error: LOW_MEMORY,MEMORY
    

    The original version of the app seems to run fine in the emulator for BangleJS 1 + 2.

    I have attached the full code to this post, it's too long to post here due to the fonts. This is what it currently looks like:

    The font files seem to be pretty big, but they are also part of the original app, so I would exclude this as the main problem for now.

    If you have some pointers that can improve the efficiency, simplify the rendering/use layout for the calendar icon (function drawCalendar), or how to better push down the font for the time (id time-top-padding), then I'm happy to hear about it.


    1 Attachment

About

Avatar for fewieden @fewieden started