You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I was trying to get around saving the module to flash since it would be written to RAM anyway

    Ahh - that's not actually the case. If you do the Storage option (or 'Save on Send': http://www.espruino.com/Saving) then the code is stored in flash and executed from there, so it doesn't use much RAM at all.

    Even if you use the normal 'save()' the code stored in ROM is stored compressed, so is actually pretty dense. GPS is super small anyway though (789 bytes!).

    are there some commands to tell the puck that the module code should be in a separate namespace/module

    I'm not sure I really understand the question...

    If you actually want to load everything into RAM from your own app, you might find it's easier to use the command-line tools with the -o file.js option - they'll wrap all the needed code together for you (using Modules.addCached, which is the solution for messing around with exports) and then write it to a JS file. You can then take that file and upload it from your app, and job done :)

    If you're trying to save memory, you could take a look at using the built-in compression library to compress the data you save: http://www.espruino.com/Reference#t_heat­shrink

    You could also try and add some external hardware - if you have 2 data pins free you could add an I2C EEPROM/flash memory which could give you a megabyte or more of memory.

About

Avatar for Gordon @Gordon started