• Last, and 'giving up' test is uploading the following code:

    Modules.addCached("BME680",
    `function f(b,a,c){if(b<a||b>c)......write(b&127,c­,d)})}`);
    

    The multi-line string in the single back tick quotes is the minified code from espruino.com/modules/BM680.min.js and seems to be just too much for Pixl to handle on reception. Pixl starts to create the cache entry - you can find it w/ Modules.getCached() in the console - but the entry is incomplete... actually empty:

    >Modules.getCached()
    =[
      "BME680"
     ]
    >Modules.getCached()[0]
    ="BME680"
    >var m = require("BME680");
    ={  }
    >m
    ={  }
    > 
    

    There is too much node.js like stuff going on... (...things held floating...)

    This module was written a bit too Arduino-ish... where the crunch work happens at compile time in the IDE and BEFFORE upload to the board... and not what happens in ESPRUINO: NOT much in the IDE except finding nested require, all crunching ON the BOARD, AFTER the upload.

    Pixl has obviously not enough memory - my uneducated assumption - to do that heavy lifting. PICO can do it.

    You are NOT out of luck... just up for some significant work.

    Rewriting the Module would need some significant work... and absence of regression tests makes it worse. My approach of rewriting would be a base module containing the 'class'/constructor BME680 w/ the Constants - C - and making C accessible via the 'class'/constructor BME680. Subsequent uploads and extensions of this 'class'/constructor function would add the sensor areas as desired and reference the Constants C always via the 'class'/constructor BME680. Also, some name shortening and more JS like programming have to be applied...

    I know that there is a way to allow constants to be folded in, so they are not around anymore with these long names. Using one and the same constant definition in all the Main and Sub
    modules can tidy up the runtime code even more.

    May be @Gordon has a better answer...


    1 Attachment

    • BME680pixleUploadIssueV200_2.png
About

Avatar for allObjects @allObjects started