SD card access can actually block for some time, which would make your problems a lot worse I'm afraid.
How about just using the on-device storage with require("Storage"). There's about 40kB usually (and I could come up with a cut-down firmware that allowed you around 100k). I'd imagine for lap times that would be more than enough especially if written as binary, and it's nice and fast to write to (and easy!).
Hmmm. Blocking even if I use the async methods?
I would keep things small and simple. Just create one directory when starting.
And write a small file for one lap.
That would still cause issues you think?
About require("Storage") I am not sure actually how this could work.
Maybe create an "empty" file first that fills up all available space.
with my current code.
And then use it as binary ring buffer writing on pos = i * REC_SIZE or something like that.
pos = i * REC_SIZE
With my current set of datapoints (I ended up at 10 bytes) this would be something like 1800 laps which would give me 225 laps for 8 transponders meaning about 56 km distance on a 250 m track which can easily be reached with a fast velomobile in one hour.
Tight fit, but an improvement. I'll consider that - thanks.
What about this cut-down thing? This would mean disabling every compile-time module I don't need for this board I suppose?
At some point I thought since my code is in Flash and RAM is about the same size as Flash there would be more space in RAM instead (and RAM doesn't wear and is easier to access...).
Was that a wrong assumption?
© Espruino, powered by microcosm.
Report a problem