This one's been a while coming, but it's got a few nice additions/fixes:
E.setBootCode and flash execution
You might have noticed the Save on send option in the Web IDE - this uses E.setBootCode to save your code as-is to Espruino's flash memory. It's then executed straight from read-only memory and any functions you define are kept in flash.
While this actually uses up more flash memory than the normal (compressed) arrangement, it can save you a lot of RAM.
Promises
Espruino now has a 'Promise' library built-in on all but the most constrained platforms - so stuff like this now works:
new Promise(function(resolve, reject) {
var ok = false;
// do stuff
if (ok) {
resolve("Stuff worked!");
} else {
reject("It broke");
}
}).then(function(result) {
console.log(result); // "Stuff worked!"
}).catch(function(err) {
console.log(err); // Error: "It broke"
});
I know some people like programming like this (to avoid all that nesting) so this may help...
process.on('uncaughtException', ...)
This allows you to catch any exceptions that your code produced but that weren't caught. For instance you might want to log the exceptions to read-only memory for later debugging, or just light up a warning light.
force argument on Serial.setConsole()
For example with USB.setConsole(true), you can make sure that Espruino's console always stays on USB and doesn't get in the way of Serial, regardless of whether USB is subsequently plugged or unplugged.
Fix software PWM glitches
It used to be that whenever you modified software PWM, PWM was stopped and then started again, and this made it 'glitch'. This is now fixed so you can animate software PWM values without any glitches.
E.kickWatchdog()
Espruino's had E.enableWatchdog for a while - which checks that the interpreter is always going around the idle loop, but you can now do E.enableWatchdog(time, false) which means that if your code doesn't call E.kickWatchdog() within the time period the chip will auto-reset.
It's a great way of making sure that your code really is running as expected.
micro:bit improvements
micro:bit's show() function now works well with Graphics
Many nRF51/2 fixes and improvements
Fixing micro:bit compass issues
Other Fixes and Improvements...
Telnet now built into linux builds (use --telnet to enable) - also some Telnet fixes
Finally added .removeListener so you can remove just one listener (for example when using multiple listeners on Serial)
Added require("Flash").getFree() as multiplatform way to find free flash pages
Add the ability to set clock frequencies on STM32F4 chips (like Pico) with E.setClock
Add E.setBootCode to allow JS scripts to be saved without being in RAM ()
Expecting a number or something iterable, got X changed to exception rather than warning (so you now get a stack trace of the error)
Ensure that pinMode/digitalWrite is re-constituted properly by dump() and save() (fix #833)
ESP8266: Some read-only variables moved to flash to save a whole bunch of RAM
Espruino WiFi has got a bit delayed due to some component sourcing issues, but I hope to have the first 100 available within the month now.
However I'm about to launch a KickStarter for a new Bluetooth LE Espruino (with a case and battery), which we're calling Puck.js. It should be starting within the week if all goes well, and I'll post up some more details then...
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 one's been a while coming, but it's got a few nice additions/fixes:
E.setBootCode
and flash executionYou might have noticed the
Save on send
option in the Web IDE - this usesE.setBootCode
to save your code as-is to Espruino's flash memory. It's then executed straight from read-only memory and any functions you define are kept in flash.While this actually uses up more flash memory than the normal (compressed) arrangement, it can save you a lot of RAM.
Promises
Espruino now has a 'Promise' library built-in on all but the most constrained platforms - so stuff like this now works:
I know some people like programming like this (to avoid all that nesting) so this may help...
process.on('uncaughtException', ...)
This allows you to catch any exceptions that your code produced but that weren't caught. For instance you might want to log the exceptions to read-only memory for later debugging, or just light up a warning light.
force
argument onSerial.setConsole()
For example with
USB.setConsole(true)
, you can make sure that Espruino's console always stays on USB and doesn't get in the way of Serial, regardless of whether USB is subsequently plugged or unplugged.Fix software PWM glitches
It used to be that whenever you modified software PWM, PWM was stopped and then started again, and this made it 'glitch'. This is now fixed so you can animate software PWM values without any glitches.
E.kickWatchdog()
Espruino's had
E.enableWatchdog
for a while - which checks that the interpreter is always going around the idle loop, but you can now doE.enableWatchdog(time, false)
which means that if your code doesn't callE.kickWatchdog()
within the time period the chip will auto-reset.It's a great way of making sure that your code really is running as expected.
micro:bit improvements
show()
function now works well with GraphicsOther Fixes and Improvements...
.removeListener
so you can remove just one listener (for example when using multiple listeners onSerial
)require("Flash").getFree()
as multiplatform way to find free flash pagesE.setBootCode
to allow JS scripts to be saved without being in RAM ()Expecting a number or something iterable, got X
changed to exception rather than warning (so you now get a stack trace of the error)For more info including bug numbers of fixed bugs, check out http://www.espruino.com/ChangeLog
New product!
Espruino WiFi has got a bit delayed due to some component sourcing issues, but I hope to have the first 100 available within the month now.
However I'm about to launch a KickStarter for a new Bluetooth LE Espruino (with a case and battery), which we're calling Puck.js. It should be starting within the week if all goes well, and I'll post up some more details then...