Espruino 1v63 out now #3802
Replies: 1 comment
-
Posted at 2014-05-15 by DrAzzy OH HELL YEAH! Awesome changes! Can't wait to try some of this new stuff out. Great to see file piping finally done, and that the internet connectivity finally sounds like it's working. The streaming enables some pretty awesome things.
You rang? http://drazzy.com/espruino/espruino_1v63_espruino_1r3_bigram.bin (2600 jsvar, 64 ram 512 flash) Built with latest git as of like 40 mins ago, which I assume is the v63 release. My builds are untested. Posted at 2014-05-15 by @gfwilliams Nice. Thanks! Just had a quick look on one of my boards and your build seems to work great :) Posted at 2014-05-16 by JumJum Great job,
Posted at 2014-05-16 by @gfwilliams That could be really good - it'd be nice to have a way to display more data than would fit in to RAM. I also added a BMP Loader Module so you can load bitmaps off the SD card - it might be handy. About file handling - yes, it's possible. You just use
Note: something's broken in the build so the version that got uploaded is a few days old. I'll be updating 1v63 shortly though. Posted at 2014-05-16 by @gfwilliams Ok, fixed now. If you updated to 1v63 before now and the build date under settings->about says '12th May' you'll need to update again... Posted at 2014-05-20 by mgg1010 Wow - great set of additions - excellent work :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-15 by @gfwilliams
Hi there,
Just a quick explanation of some of the stuff that's in 1v63:
First the fun stuff...
Streaming File API
While you could load files before, you could only load an entire file into memory - you couldn't load a bit at a time.
Cephdon's done a bunch of work on this, and I just integrated it. We've settled on a nice simple file API:
I don't like deviating from the standards that everyone else has, but in this case every JavaScript file API I've come across seems unsuitable, so coming up with a nice clean File API seemed the best way forwards.
Piping files
This is where the streaming file API really shines. Because you couldn't load part of a file into memory before, you couldn't do things like serve up a webpage that wouldn't fit into memory. Now it's dead easy:
The code above will serve an arbitrarily-sized file directly from the SD card.
This uses standard JavaScript too, so you can actually make your own endpoints for pipes if you want to. I'll be working on making more of Espruino's built-in classes accept piping in the future - for example the Waveform class could stream sound directly from the SD card, or could even record sound and output it over HTTP!
Better HTTP stream support
Part of the work above involved tweaking the HTTP server and client to allow streaming. They now emit
drain
events when they're empty, so you can easily not just serve, but compute webpages that would never have fitted into memory before.For example, perhaps you're making a data logger and storing the last 10,000 samples in RAM. This is fine, but you can't send a webpage full of them, because if you convert that binary data to ascii, it could take up 40,000 bytes and use up all your memory.
Instead, you can use the
drain
event to send the data in chunks...Fixes/tweaks
And finally, I guess you won't notice these, but:
edit(...)
is now able to edit functions that are in use in callbacks - for example withsetInterval
E.reverseByte
has now been added - it's ends up being quite useful, especially when dealing with displays.Beta Was this translation helpful? Give feedback.
All reactions