-
• #2
Cool!
What setup do you have for regression testing?
For internal stuff, it can be done with loading the js and run it. With external components, it would require to either emulate them or actually physically connect and disconnect them... program controlled...
-
• #3
AT25 #MRAM #FRAM #1v72: add pinMode(pin,"output"); or external pull-up resistor on CS to guarantee read();
Update: The seemed to be a flashback bug... therefore: watch closely what the default flashing does.
-
• #4
@allObjects did you mean to post that last post here, and not just under the EEPROM/MRAM/FRAM discussion?
I don't test the Espruino board with all the external components each time - that'd end up being an insane amount of work. Having said that I guess having one of two of the obvious ones wired up might be helpful.
There's a test suite that gets run with a linux compile of the software, which is able to figure out most language errors. Also the builds I do for myself have a bunch of assertions in, so if none of them get hit in everyday use you can be relatively sure nothing is going too badly wrong.
I also have two espruinos connected together, which I use for flashing and benchmarking various commits on a variety of benchmarks. If those break then you know something is up as well!
-
• #5
Nevermind.
-
• #7
ESP8266 - when you build with ESP8266=1, does it actually work, as in you can talk to the ESP8266 and connect to the internet with it, or does that come later?
-
• #8
edit: It now works, and I updated the 1v72 esp8266 firmware on the site.
You can use it like CC3000 or WIZnet, but a few things (like getIP) are still missing right now. More info at http://www.espruino.com/ESP8266
Stuff like this should work:
Serial4.setup(115200, { rx: C11, tx : C10 }); console.log("Connecting to ESP8266"); var wifi = require("ESP8266").connect(Serial4, function() { console.log("Connecting to WiFi"); wifi.connect("WiFi_Name","WPA2_Key", function() { console.log("Connected"); require("http").get("http://192.168.1.50", function(res) { console.log("Response: ",res); res.on('data', function(d) { console.log("--->"+d); }); }); }); });
-
• #9
Oh cool, that's good news!
Sounds like I should add ESP8266 builds to my nightlies if it's usable now.Do I just build with ESP8266=1?
-
• #10
With minification set to simple optimization I get a message for statement is not supported yet. Minification changes the while loop in function f() into a for loop.
-
• #11
Yikes, that sounds really bad...
What is the code you're minifying?
And what's the code sent to espruino look like?
-
• #12
Yes, for ESP8266, all you need is
ESP8266=1
- just like WIZnet.It's just that the code is minified before being sent to the compiler. I'm actually pretty surprised the minifier doesn't rip out the
"compiled"
string too. I guess I should swap things round so it happens first.As I said, the compiler's pretty basic right now. It still handles
while
andif
though. If you need the speed it's not exactly a massive issue to re-writefor
loops aswhile
loops for now.edit: The compiler now supports
for
loops and function calls, but you'll need to use a Web IDE from GitHub
This release has been a long time coming - mainly delayed because of my work on the Pico. However a lot of that work has made its way into the core firmware, so there are some really great improvements in it:
Real-time clock
The real-time clock will now remember the time that has passed since Espruino last had power, regardless of whether it was reset inbetween or not. This means that if you connect Espruino to a battery you can just set the time, and it will keep track of it until the battery is removed.
Arrays in digitalPulse
You can now do something like
digitalPulse(LED1,1,[100,200,300,400,500,600]);
to quickly create a square wave with the given pulse lengths. This is great for radio or Infra-red transmission.Linux/Raspberry Pi improvements
If you want to run Espruino on Raspberry Pi, you now get much faster IO and interrupt-driven
setWatch
, courtesy of WiringPi. A separate thread for handling input means that you get much better behaviour when idle, and Ctrl-C can break out of running code.You can also access Serial ports - for instance:
Serial1.setup({path:"/dev/ttyUSB0"})
Socket Support via
net
library and MQTTThis means you can now do much lower level stuff on the network - including MQTT (Lars has kindly made a module to do this for you)
setWatch can now execute native functions from inside the IRQ
This is pretty low level stuff, but by specifying
irq:true
in setWatch you can now run inline assembler from within a setWatch IRQ. This has some great uses for stuff like decoding radio or scanning out displays.Added 'flat strings'
Espruino normally uses fixed-size blocks of memory for variables, which stops it having problems with memory fragmentation. However often you'll want to allocate one big lump of memory for an array, and 'flat strings' now do this. For the moment they're only allocated when you create a typed array (like
Uint8Array
), but over time they'll be rolled out to more things.Compiled functions
Using the new Web IDE (automatically rolling out now), you can use a JavaScript compiler on your PC to compile JavaScript down to ARM instructions that run directly on the processor. It's still very early days for this, but the performance is already really promising.
For instance see the speed difference when uploading the code below, with and without the string
"compiled";
There's more info on this here.
Machine code in variables
This one means that if you write inline assembler (or the new 'compiled' functions) the assembler will get loaded into a variable - which means it's loaded and saved along with everything else.
Peek and Poke can now act on multiple bits of data
For instance
peek8(0x20000000,8)
now returns the first 8 bytes of RAM as an array. While not so useful for accessing the internal peripherals, it's great if you've written something into Espruino's flash and you want to access it.Graphics an ArrayBuffer write performance
The speed of the graphics library (especially fills to ArrayBuffers) has now improved a great deal. It should really help when using higher resolution displays like the Memory LCDs.
VGA and TV output
You can now plug a VGA monitor or TV straight into Espruino using the tv module!
The video below is from a few weeks back. It now does work well on the Pico too!
https://www.youtube.com/watch?v=U-XOUVkjLKg
E.toString and E.toUint8Array
It's always been a bit of a pain to convert between the two most efficient types of storage in Espruino. You can now use
E.toString(...)
andE.toUint8Array(...)
to create strings or Uint8Arrays from whatever arguments you supply.Multi-byte OneWire read and write
This really helps to tidy code up, especially for:
EEPROM support
@DrAzzy's done loads of work on supporting several different types of EEPROMS (all with the same API). It means you've not got a very quick and easy way of storing data in a non-volatile way.
ESP8266 WiFi support
There's now support for the ESP8266 WiFi module as well, but you'll have to flash the special firmware first.
Finally...
There are loads of other small bug fixes, optimisations and improvements. If you want a full list, you can check out the ChangeLog