@Gordon I've attached the partial output from a trace() after the error occurred. This time it manifested itself in some debug code. Basically a i++ became i,+ but again in the same function.
(just noticed i<a.length also became k<a.length)
The error is on line 917 of the file. I did a trace before the error occurred and the code was correct (I thought Closure may be corrupting something but that doesn't seem to be the case.)
I have no issues giving you the code but it would take a lot of setup to get it running (you would need an ILI9341 with touch & wiz5500io). Maybe there is something else I could try before that?
I'm unsure about the trace command - would it be worth doing a trace immediately before the error, then immediately after and doing a diff on them to see if there are more corruptions?
(I copied the trace output from the console, is there a better way - maybe a simple dos command to redirect the output from a com port to a file after ECHO trace() > COM5 ?)
I can reproduce the error in about 5 seconds of loading the program - basically a few clicks of the buttons on my ILI9341.
I tried to reproduce the error with less code but haven't managed to yet.
Hopefully i haven't done anything stupid since I don't want to waste your time!
EDIT: Just ran it again - this time:
Uncaught Error: Field or method does not already exist, and can't create it on undefined
at line 1 col 48
log became lpg. The error always seems to be 1 character out.