-
Fri 2021.10.15
Hi @TTBangler a couple of points as numbers didn't seem to add up.
'Minified 74751 bytes to 37349 bytes.'
'process.memory() usage from 1239 down to 1215'Note: 37349 / 16 = 2334
I'm not so sure the value returned from the emulator is representative of the physical Bangle hardware.
As Espruino will require some of the free JsVars for housekeeping, stack, vars, function returns, etc., depending on what your code is doing, my target minimum remaining would leave around 1900 JsVars available for your code. Not sure what the capacity of Bangle V2 is but,
The results of my Bangle V1
>process.env ={ VERSION: "2v04.218", GIT_COMMIT: "5439331a", BOARD: "BANGLEJS", FLASH: 524288, RAM: 65536, SERIAL: "330b0ad8-0c11713d", CONSOLE: "Bluetooth", MODULES: "Flash,Storage,hea" ... "ow,graphical_menu", EXPTR: 536883676 } >process.memory() ={ free: 2057, usage: 43, total: 2100, history: 13, gc: 0, gctime: 3.20434570312, "stackEndAddress": 536923072, flash_start: 0, "flash_binary_end": 471492, "flash_code_start": 1073741824, flash_length: 524288 } >
Hello Robin, Gordon,
Sorry if I caused any confusion. Just to clarify, the app I uploaded to this post (that is a subset of a much larger app) results in the 'JSCODE' exceeded error for me on Chrome/Ubuntu with the non-beta Web IDE Bangle.js v1 Emulator. I've just confirmed that with the change Gordon made, the (subset) app does now successfully minify/upload for me on the same Chrome/Ubuntu system using the beta Web IDE Bangle.js v1 Emulator. Also, by entering 'window.localStorage.clear()' after getting the 'JSCODE' error in the non-beta IDE, the (subset) app can also be successfully uploaded/minified.
My full app (that I have not posted here) results in an "Execution Interrupted"/"Prompt not detected - upload failed" IDE crash even with the beta Web IDE Bangle.js v1 Emulator on both Windows and Ubuntu. However--and this is great news--my full app does successfully upload/minify with either the non-beta or beta Bangle.js v2 Web IDE Emulator on Ubuntu. Moreover, I just discovered that I can download the minified source code from the Bangle.js v2 emulator and upload it into storage in the Bangle.js v1 emulator, and the minified version of the source reduces the process.memory() usage from 1239 down to 1215. I had to make a couple of minor changes to the minified source code to get the app to run but it seems to run fine. Oh, and I forgot to mention that the message I receive when uploading my full app to the v2 Emulator is "No errors. Minified 74751 bytes to 37349 bytes."
Hope that clarifies things--thank you both very much again for your help!