This is another really big release with a whole range of changes!
Some of the changes are:
Changing from int64 to int32
This may seem like a step back, but it makes Espruino much more JS compatible. Quite a lot of code relies on numbers overflowing after 32 bits, and it will now work correctly. It also frees up some memory, speeds up execution, and paves the way for some better memory saving features in the future.
Improved Serial port handling
I've had to break backwards compatibility for this, but it's worth it! Serial.onData is now Serial.on('data', ...) which can return strings of data rather than just single characters. It means that Espruino can handle Serial data at much higher data rates than possible before, makes it more compatible with Node.js, and it also means...
Piping data from Serial/HTTP
Both Serial and HTTP now support the use of .available() and .read(nBytes) if there is no on('data', ...) handler present. This means that you can also use Serial.pipe(...) to pipe them directly to a file or even an HTTP socket!
Multiple arguments to SPI/I2C and Serial
This means you can be much more efficient with code - you can write I2C.write(addr, 1,2,myarray) and 1,2, and myarray will be output together. You can also write things like SPI.write(1,2,{data: [3,4], count:5}) which will output 1,2,3,4,3,4,3,4,3,4,3,4 - this is extremely handy for things such as LCD drivers.
Built-in Date class
There's now a Date module built into Espruino - which includes both parsing of dates, as well as creating string from dates. This means that you can easily read the current time and date right out of HTTP server responses, and can then use it to adjust Espruino's internal clock.
Exceptions!
While this needs a little more testing, there is now exception support, and most of the functions you'll call now return Exceptions. This means you can now 'catch' most errors that your code might generate, and can handle them yourself.
Increased Event Buffer size
The event buffer now stores 128 events instead of 64 - this means that you can now store up to 128 edge changes from setWatch, even if your code hasn't yet finished processing the first one.
Array.reverse
This one has been a long time coming, but it's here now. While not in ES5, ES6 has reverse support for ArrayBuffers, so it's been added to Espruino too. This will be really handy for all kinds of code that handle large blocks of data.
and hopefully there will be a few more coming as well!
... and many more fixes and improvements!
Check out the ChangeLog. Espruino keeps getting more capable by the day!
As always, there will be a small yellow triangle at the top right of the Web IDE when you connect to an Espruino board with an older version of the software on it. Click it, and you'll be walked through the process of updating your firmware...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
This is another really big release with a whole range of changes!
Some of the changes are:
Changing from int64 to int32
This may seem like a step back, but it makes Espruino much more JS compatible. Quite a lot of code relies on numbers overflowing after 32 bits, and it will now work correctly. It also frees up some memory, speeds up execution, and paves the way for some better memory saving features in the future.
Improved Serial port handling
I've had to break backwards compatibility for this, but it's worth it!
Serial.onData
is nowSerial.on('data', ...)
which can return strings of data rather than just single characters. It means that Espruino can handle Serial data at much higher data rates than possible before, makes it more compatible with Node.js, and it also means...Piping data from Serial/HTTP
Both Serial and HTTP now support the use of
.available()
and.read(nBytes)
if there is noon('data', ...)
handler present. This means that you can also useSerial.pipe(...)
to pipe them directly to a file or even an HTTP socket!Multiple arguments to SPI/I2C and Serial
This means you can be much more efficient with code - you can write
I2C.write(addr, 1,2,myarray)
and 1,2, and myarray will be output together. You can also write things likeSPI.write(1,2,{data: [3,4], count:5})
which will output1,2,3,4,3,4,3,4,3,4,3,4
- this is extremely handy for things such as LCD drivers.Built-in Date class
There's now a Date module built into Espruino - which includes both parsing of dates, as well as creating string from dates. This means that you can easily read the current time and date right out of HTTP server responses, and can then use it to adjust Espruino's internal clock.
Exceptions!
While this needs a little more testing, there is now exception support, and most of the functions you'll call now return Exceptions. This means you can now 'catch' most errors that your code might generate, and can handle them yourself.
Increased Event Buffer size
The event buffer now stores 128 events instead of 64 - this means that you can now store up to 128 edge changes from
setWatch
, even if your code hasn't yet finished processing the first one.Array.reverse
This one has been a long time coming, but it's here now. While not in ES5, ES6 has
reverse
support for ArrayBuffers, so it's been added to Espruino too. This will be really handy for all kinds of code that handle large blocks of data.New Tutorials/modules/examples
There's:
and hopefully there will be a few more coming as well!
... and many more fixes and improvements!
Check out the ChangeLog. Espruino keeps getting more capable by the day!
As always, there will be a small yellow triangle at the top right of the Web IDE when you connect to an Espruino board with an older version of the software on it. Click it, and you'll be walked through the process of updating your firmware...