You are reading a single comment by @ChristianW and its replies.
Click here to read the full conversation.
-
Yes, it's reproducable.
This is/was the actual line:Flash.s.write(Flash.NAME, [CONST.LAP_DATA_SIZE], 0, 1 + CONST.LAP_DATA_SIZE * CONST.LAPS_STORAGE)
Being
Flash.NAME = 'laps'
,LAP_DATA_SIZE=8
,LAPS_STORAGE=2000
which would be:write('laps', [8], 0, 16001)
which worked perfectly fine in the console, but not when called via a
setWatch()
callback when a button was pressed.
I even changed all thethis.
references to absolute ones in case the context got lost inside the method.
Yes, that should be fine...
Strange... Could you
print
the arguments you're giving toFlash.s.write
? It might help to figure out if anything is 'off'.Wow, I haven't seen that before. And it's reproducable?
I guess maybe Espruino ends up compacting, but that compaction takes so long it causes the flow control to time out. Does the upload take a long time at that point? Do you get a FIFO_FULL message? Although I guess you might have got that at some point in the past.
You should be able to do something like:
m=process.memory();myArray = new Uint8Array((m.free-100)*m.blocksize)
So then you're leaving ~100 memory blocks free for execution. But you may well have to tweak that so you don't get out of memory errors