-
Mon 2017.03.13
Thank you for running tests on your boards. It's unfortunate that duplicating my experience didn't occur.
are you running with minification turned on
I haven't made any changes to the WebIDE settings for any of the examples. (for minification - left factory defaults as is - yes?)
ref:
//this is the problem section
I left this comment intact to avoid adding more confusion when removing lines of code. The comment actually refers to the commented out block that follows, there was an unresolved issue decoding the unknown JSON object that is returned from wifi.scan()
"You're saying you upload code20170206ESP8266FileServer.jsSTART.js exactly as it is, and then remove:"
Yes, with clarification.
I removed around 3K-4K of bytes each time, around ten times more than indicated above, both code and external comments. I was also jumping around seeking sections to remove, so this might be a contributing factor. e.g. whitespace
The only way to tell exactly what was removed would be to compare side by side with software that could detect the changes.
When I was able to duplicate this increase, I created the file 'NotesGordon20170224.txt' and appended the steps in chronological order.
I indicated (the best I could as a text file isn't the best here) which file, brief list of areas I removed code, the WebIDE process.memory()
output, followed by the saved bytes resolution, renamed and saved the file, then repeated the process. I did all the editing in the WebIDECould it be that ver 1v89 is problematic here?
I never was able to resolve why I couldn't flash 1v91 on this ESP8266-12 so I'm stuck at 1v89 ref: 'save() on espruino_1v91.122_esp8266 results in immediate Disconnected prompt'Note that I never did test on my Pico as I was working with wifi and EspruinoWifi was not available from suppliers here in the USA.
I'm not seeking a solution to the limited space issue nor am I seeking help in resolving coding issues. It's unfortunate that what happens on
my PC isn't being duplicated. I note that we are working with a different board and different software version.Still wondering if not being able to flash is related to the save() disconnect issues others have had with the puck and this weird anomaly when using large file sizes. If this has become too much a time sink, then maybe we should just shelve this for now and see if others ever have similar issues. I felt it important to document for the reasons above and the fact it is repeatable.
EDIT: After several hours of mulling this over I realize the following:
Point 1
In each test case above, a complete new file was loaded into the WebIDE before a transfer via 'Send to Espruino' button press.In my case, I used one file and reduced that, never reloading a fresh data set. Although the original file is gone, I started with a file that executed as expected, taking up one half the destination space of around 800 jsvar blocks. I inserted a 4K char chunk of function code towards the end of the file. This caused the error
Uncaught SyntaxError: Got UNFINISHED STRING expected EOF at line 1 col 8640
I started to remove unneeded comments and functions totaling around 4K chars each attempt. Then saved that result to a file, those that are included above.
Note that I'm always using the same file in the WebIDE memory space.Point 2
The available size on the 1v91 test above is much larger and compresses to a much larger result ~30000 vs ~10000
The difference using an Espruino board vs an ESP8266-12>process.memory().usage =1311 Compressed 81600 bytes to 30856
vs
>process.memory() ={ "free": 482, "usage": 1218, "total": 1700, "history": 431 } ERROR: Too big to save to flash (16445 vs 12284 bytes) Compressed 27200 bytes to 11884
So in this case, are you running with minification turned on?
You're saying you upload
code20170206ESP8266FileServer.jsSTART.js
exactly as it is, and then remove:from
onPageRequest
, and the code gets bigger?Because when I try this on a normal Espruino board with 1v91, I get:
or PASS1:
Compressed 81600 bytes to 25920
and PASS2:
Compressed 81600 bytes to 25058
or after minification:
PASS1:
Compressed 81600 bytes to 16304
and PASS2:
Compressed 81600 bytes to 15895
which is exactly what you'd expect? Sadly I can't find my working NodeMCU board at the moment to test this on.
If you're looking to save memory, it seems like you have multiple
joinWifi
functions, and also bothonPageRequest
andpageHandler
which I guess do similar things?