Espruino has supported pretokenisation for a while - replacing reserved words to convert if (i) return true to #(i)## to save on storage space and increase speed. You can enable this when uploading in the IDE or in the Bangle.js app loader, or by tagging a function with "ram".
As of 2v21, Espruino can pretokenise Strings, including base64 encoded strings. This means that program code in Flash that writes something like atob("abcdef.....") will be replaced with a 'string token', length, and then raw data (when before it had to be parsed and then decoded). When the String is parsed it won't even be loaded into RAM, but will stay as a reference to that area of flash memory, which is really efficient.
It'll help everywhere, but it makes a massive difference on Bangle.js where fonts and images might have been stored as base64. On the default Anton clock, setting the font is now a whopping FORTY times faster than it was before and it's really noticeable with how snappy the new firmware is when loaded with pretokenised code (which is the default if factory resetting).
Other features
Graphics drawImage speed improvements for partially cropped images, also added subsampling with {filter:1} to allow images to be zoomed out cleanly
Allow E.pipe from big strings (even if they're in flash memory)
Bluetooth bootloader now keeps connection open even when iOS refuses to negotiate higher data rate
Speed improvements - strings aren't parsed if not executing
Storage reliability fixes (like ensuring we don't try to compact if we have low battery)
Storage.writeJSON now writes a simplified JSON ({a:"\x10"} vs {"a":"\u0010"}) for speed/space efficiency
Graphics wrapString now wraps on comma/etc and will wrap a word multiple times
Graphics.stringMetrics now returns unrenderableChars/imageCount/maxImageHeight as well
Big JIT improvements with reliability/functionality
Added I2C.readReg to combine I2C.writeTo+readFrom in an easy/fast way
Added console.debug/info/warn/error as aliases of console.log
Added Pin.pulse/pwm/analog as aliases of digitalPulse,analogWrite,analogRead
Allow E.nativeCall to take 32 bit floats (eg for Inline C)
Add built-in Stepper motor handling with the Stepper class (beta!)
Flash Memory usage optimisations to get Espruino's size down even more
A file called .bootPowerOn is now executed at power-on only
Bangle.js specific features
Recovery Menu (since 2v19) - if you boot Bangle.js with the button held (or storage is corrupt) you get a recovery menu which allows you to turn off, factory reset, even run some tests.
PBF font support and Unicode - we're not using PBF yet, but it's now possible to store fonts with 10,000+ characters on Bangle.js's storage and render them (eg for Chinese language).
Bangle.js Current Time Service support (to get the time from iOS devices)
Bangle.js 2 now supports two central connections at once! This can be built into other devices if needed, but isn't by default as it uses more RAM
Add wakeOnDoubleTap to Bangle.setOptions, and the "lock" event now has second argument giving a reason (if known)
Add 'lcdBufferPtr' to Bangle.getOptions to allow low-level screen access
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.
I haven't made announcements for the previous few releases, but there have been some great additions recently I thought I'd share!
As always, a full list of changes is at https://www.espruino.com/ChangeLog
First, the big one:
Pretokenised Strings
Espruino has supported pretokenisation for a while - replacing reserved words to convert
if (i) return true
to#(i)##
to save on storage space and increase speed. You can enable this when uploading in the IDE or in the Bangle.js app loader, or by tagging a function with"ram"
.As of 2v21, Espruino can pretokenise Strings, including base64 encoded strings. This means that program code in Flash that writes something like
atob("abcdef.....")
will be replaced with a 'string token', length, and then raw data (when before it had to be parsed and then decoded). When the String is parsed it won't even be loaded into RAM, but will stay as a reference to that area of flash memory, which is really efficient.It'll help everywhere, but it makes a massive difference on Bangle.js where fonts and images might have been stored as base64. On the default Anton clock, setting the font is now a whopping FORTY times faster than it was before and it's really noticeable with how snappy the new firmware is when loaded with pretokenised code (which is the default if factory resetting).
Other features
{filter:1}
to allow images to be zoomed out cleanlyE.pipe
from big strings (even if they're in flash memory){a:"\x10"}
vs{"a":"\u0010"}
) for speed/space efficiencyunrenderableChars/imageCount/maxImageHeight
as wellStepper
class (beta!).bootPowerOn
is now executed at power-on onlyBangle.js specific features
wakeOnDoubleTap
to Bangle.setOptions, and the "lock" event now has second argument giving a reason (if known)