-
Two problems came up after updating to M33.
- reading process.env after connect often stops during reading data
I checked incoming data in getProcessInfo, and recognized that data in about 50% is not received to the end. Changing timeout did not change anything. After switching back to prevReader it looks like missed data comes in to prevReader.
Problem is easy to recognize. If you see process.env in terminal window, this problem happend. - by sending data to espruino board, sometimes characters are lost.
I checked this by copy/paste line by line to terminal window. Sometimes characters are lost, this happens in about 10% of lines.
- reading process.env after connect often stops during reading data
-
-
ct'Hacks is published 4-times a year, focus is hacking everything from furniture to Bio hacks, touching microcontrollers etc.
They have a nice page around Espruino in their homepage:
http://www.heise.de/hardware-hacks/artikel/Espruino-JavaScript-ganz-weit-unten-2132781.html -
Take a short look to this http://www.espruino.com/modules/PCD8544.js and you will see, a graphics object is returned.
Goto references for graphical object http://www.espruino.com/Reference#Graphics there is a description for changing fontsize http://www.espruino.com/Reference#l_Graphics_setFontVector
Hope this helps
Juergen -
-
did you switch sound on in options/options status ?
See video 3 named Status Options on Gordons page for WEB IDE
http://www.espruino.com/Web+IDE -
Based on this article I tried to connect the accelerometer to my Espruino board. Wrote some lines and get an error
INTERNAL ERROR: Timeout on I2C Write Transmit Mode 2
INTERNAL ERROR: Timeout on I2C Write Transmit
at line 2 col 33
this.i2c.writeTo(id,reg | 0x80);´´´
function GY291(i2c,sda,scl){
this.i2c = i2c;
var id = 0x53>>1;
this.i2c.setup({scl:scl,sda:sda});
}
GY291.prototype.write = function(reg,val){
this.i2c.writeTo(this.id,[reg,val]);
};
GY291.prototype.read = function(reg,count){
this.i2c.writeTo(id,reg | 0x80);
return this.i2c.readFrom(id,count);
};
GY291.prototype.turnOn = function(){
this.write(0x2d,0);
this.write(0x2d,16);
this.write(0x2d,8);
};
var a = new GY291(I2C2,B11,B10);
setInterval(function(){
var c = a.read(0x32,6);
console.log(c);
},2000);´´´
-
I would recommend FLOT http://www.flotcharts.org/
Example for zooming http://www.flotcharts.org/flot/examples/zooming/index.html
Example for mouseover/click http://www.flotcharts.org/flot/examples/interacting/index.html
A lot of additional examples and plugins are here http://jumflot.jumware.com/IndexJUMFlot.html
There is also an editor available http://jumflot.jumware.com/tools/FlotEdit/FlotEdit.html
Under help you will find some videos and may be, somebody will recognize the speaker ;-)
If you give me the data, I will create an example. -
-
-
During testing CC3000 and some other requires, sometimes the board stopped working and I had unplug to get it back to work.
After some testing, this workflow breaks Espruino- send code to Espruino Board
- wait to get IP adress
- disconnect from Espruino Board
connect to Espruino Board
Some secondes later I get the timeout error (4101).
Next another error comes up, "got '<' expected EOF at line 1 col 2...."
Version 1v50 and this sourcevar wlan = require("CC3000").connect(); var ip; wlan.connect( "JUMWARE-LTE", "B73FD193D04293D", function (s) { if (s=="dhcp") { ip = wlan.getIP().ip; console.log("My IP is "+wlan.getIP().ip); require("http").createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.write('IP is ' + ip + '<br>'); res.end(); }).listen(80); } });
- send code to Espruino Board
-
You can get the code by:
- right click in orange area on top of edit window
- in upcomin list click on 3rd item (in german element untersuchen), something like watch element
- you should now get a new chrome window
- click on console and you will see a lot
- at the end there should be something like Sending... clearInterval();clearWatch();setWatch(function() {.....
This is javascript which is sent to espruino.
You will see setTimeout and this is called 10 times, without waiting for completion before running loop next time.
- right click in orange area on top of edit window
-
Gave it a new try and got these numbers:
blinker object only, usage 50, history 37
3 blinker with object, usage 158, history 49
3 blinker with object, minified from 504 to 386, usage 149, history:31
3 blinker with require, usage 192, history:55
From my best understanding- the blinker object itself takes a few bytes only
- each instance with 4 variables(pin,duration,interval,status) takes around 600 bytes
- minifying reduces some bytes
require takes more memory than an object
Is there anything wrong with my interpretation ?function Blinker(pin,frequency){ this.interval = 0; this.status = true; this.duration = 1000 / frequency; this.pin = pin; this.start(); } Blinker.prototype.start = function(){ var me = this; me.interval = setInterval(function(){ me.status = !me.status; me.pin.write(me.status); },me.duration); }; Blinker.prototype.stop = function(){ this.pin.write(false); clearInterval(this.interval); }; var b = new Blinker(LED1,2); var c = new Blinker(LED2,5); var d = new Blinker(LED3,7);
- the blinker object itself takes a few bytes only
-
@Gordon,
I have in mind from an older response (http://forum.espruino.com/conversations/498/#comment5713) , that nightly build cannot be used directly for Espruino Board, because of missing Bootloader.
If this would be fixed, I would like to add a function to espruino_project.js to load from local drive. -
-
@Gordon, just tested uglifyjs and it doesn't handle 0b001.
I could not find any enabler in googles minify or uglifyjs to support 0b001/etc.
Pretty sure, this will change, but right now, there is no way.
If anybody knows better, please let me know.BTW uglifyjs could be the better solution compared to google minifier.
The way, how http://lisperator.net/uglifyjs/#demo supports clicking in minified code and see what this was in not modified code is great. To give one example only. -
@Kim, could you give an example which is not running after minifying. I would like to figure out, where the problems are. May be there is a way to "correct" this before sending to minify. 0b001... for example could be changed to 0x2.
-
Minifying sometimes has problems with handling requires and loading modules (Modules.-commands) The way this is minified by Google could be one reason for your problems. Same happens with binary data (0b0001...), which is also not know to minify.
May be we have to split minifying, to minify code only, not the modules. -
I have 1v47 from espruino/binaries on Espruino Board.
My understanding was the bug is for history only, sorry.
Already tested prototyping, this works fine and saves memory(about 20% less) even with the buggy calculation.
Anyway I will put any testing for memory consumption on hold, until next version is available, or we get a nightly build.
BTW, would it be possible to send mails around if new version is available ? -
Hello,
I tried it (see source) and got memory usage of 199, which is close to 4k or 3k by subtracting 4 bytes/block. Sourcecode is less than 400 bytes only.
Trace is not a help for me, my knowledge about that is too poor.
Checked memory-usage:- function Blinker only: usage is 60
- function Blinker with LED1: usage is 132
- function Blinker with LED1, LED2: usage is 199
- function Blinker with LED1, LED2, LED3: usage is 265
- used Blinker as module and required for LED1: usage is 178
- used Blinker as module and required for LED1, LED2: usage is 252
used Blinker as module and required for LED1, LED2, LED3: usage is 326
function Blinker(pin,frequency){ var me = this; me.iv=-1; me.status = true; me.dur = 1000 / frequency; me.stop = function(){ pin.write(false);clearInterval(me.iv); }; me.start = function(){ iv = setInterval(function(){ me.status = !me.status;pin.write(me.status); },me.dur); }; this.start(); } var b = new Blinker(LED1,2); var c = new Blinker(LED2,5);
- function Blinker only: usage is 60
-
Thanks a lot for this interesting answer, its very late, I appreciate this.
What I wanted to find with this question is the best way to write code.
There are at least two parameter, speed and size.
BTW, my next test used a module.
Base is an object called Blinker, which uses Interval.
Having LED1 to LED3 blinking in different frequency costs 175 blocks.
Same with function in modules takes more than 300 blocks.
Do you have a guide, something like "best architecture to save memory" ? -
process.memory() gives a total memory of 2000 and free of 1988 (after reset)
After sending a script with about 490 chars it gives free of 1841
Minifyied code has a length of about 270 and free returns 1875How should I interprete this numbers, bytes seem to be a wrong, and memory units(20 bytes) would be a lot (3000 bytes for 490 chars of code for example) .
dump() did not help either -
-
I am using last version from github.
Connection is via USB and worked fine until updating to M33.
I uploaded a video youtube
.
By copy/past (to avoid echo(0)) sometimes it stops even with small portions of code.