-
-
jsvArray, good point, I will try.
I want to have some animation.
I've already a JS-object supporting shifting in all directions (up/down/left/right) or rotating.
In Javascript looping throgh an Uint8array for rotating takes some time (up to 100ms).
Tested also a c-function to read a row from arraybuffer, but even using this takes some time.
Same function, in C, takes 5ms only
Some other functions similiar good old tennis game will follow, once I get the basics done. -
I'm working on a small object for 8*8 matrix of WS2812.
The project is right now developed for ESP8266, but my problems are more general for Espruino (hope so).
Based on @nkolban video a VM for ESP8266 is running, and a lot of testing runs fine.
Since I'm a newbie in this, I learned a lot but still run into problems.
Actual there are 2 problems, and if somebody could give me a hint, ....- JSON wrapper with more than 4 parameters (in my case setPixel(row,column,red,green,blue)) gives a warning during compiling. Sooner or later this will be changed to use a color instead of three values, therefore its not a big problem. Anyway, if somebody like me uses tons of args in the future, ...
- main problem is right now how to read my pixelbuffer (uint8array), change some values and store back.
Some code snippets:
create the buffer
JsVar *buf = jswrap_arrayBuffer_constructor(192); //192 is 8 rows with 8 columns having rgb jsvUnlock2(jsvAddNamedChild(parent,buf,"buffer"),buf); // I can see the buffer after that
read buffer inside a function like setPixel
JsVar *buf = jsvObjectGetChild(parent,"buffer",false); //read buffer JSV_GET_AS_CHAR_ARRAY(pixels,dataLength,buf); //convert to char Array uint8_t *p = (uint8_t *)pixels;//get a pointer to that
doing changes like a fill
for(int i = 0; i < 64;i++){ //loop over all fields to set colors *p++ = (char) green; *p++ = (char) red......
and last not least store the changes back. I did only find a way by creating an JsVar for string, then convert to ArrayBuffer. This, obviously has problems with colorvalue of zero.
JsVar *bufb = jsvNewFromString(pixels); //convert to JsVar-string, and get the zero problem (end of string) JsVar *bufa = jsvNewArrayBufferFromString(bufb,0); //did not find a function to create this from char array directly jsvSetNamedChild(parent,bufa,"buffer");
- JSON wrapper with more than 4 parameters (in my case setPixel(row,column,red,green,blue)) gives a warning during compiling. Sooner or later this will be changed to use a color instead of three values, therefore its not a big problem. Anyway, if somebody like me uses tons of args in the future, ...
-
Would it be an option to take first layout and move the pins down to the end of the board ?
Then move labels up the place where pins are right now.
This would give an option to those working with breadboards using 2 of them.
A big one for pins 0-14, and a small one turned by 90 degrees for other pins.
Labels would still be readable on the board this way, and you could use breadboards. -
-
-
Some more testing :-)
In my http-server an Url was added http://198.168.178.26/get?host=184.168.192.49&path=/
Server uses this information to get data from that server and forwards this to browser.
This works fine, heap was more than 10000 all the time and free memory about 200.
Next opened a websocket on my server and then called the url again.
This ended in a desaster, could see memory going down and got Execution interrupts and after that tons of errors. Even a HW-reset did not help anymore, had to reflash.
Tried to reproduce this error by:- open an url that causes a delay on server for about 10 secs bevor sending response.
- during this 10 secs called another page, everything fine
- still during this 10 secs called the url mentioned above (the get url) and could see, heap going down to 9800, but memory going down to 78 bevor Out of memory, followed by tons of Execution interrupt. Good news, this time I did'nt have to reflash.
- did some more testing and got out of memory and execution error often, but couldn't reproduce the flash corruption
Hope, this is of some help :-)
- open an url that causes a delay on server for about 10 secs bevor sending response.
-
Tested the flash-strings version. Everything is running fine.
During testing of http-server the logger below was added.
freeHeap was always between 10500 and 12300.
freeMemory was always between 200 and 350.
http-get is not a part of my test, will add this later.BTW, there was a discussion about large(1400 ?) and small(576 ?) buffers. Which one is used in your build ?
setInterval(function(){ console.log(srv.ESP.getState().freeHeap ,process.memory().free); },200);
-
@tve, your version made a test on 4MB version.
- Upload happened with ESP8266 Flasher and worked fine.
- Testing my http-Server worked fine.
testing flash:
var f = require("Flash"),s = 0x68000; for(var i = s;i < 0x80000;i+=4096){ console.log(i.toString(16),f.read(8,i)); } for(i = 0x80000; i < 0x100000; i += 0x4000){ console.log(i.toString(16),f.read(8,i)); }
worked. Some results are strange in my eyes:
- reading from 0x7E000 and 0x7F000 returns an empty array. This usually happens for areas, that can't be read using flash
- same for 0x80000 and 0x84000
- at 0x88000 is some data, is this some old data, or something totally different
Everything else looks fine to me.
Testing with wiflash will follow later, its time for bed now.
- Upload happened with ESP8266 Flasher and worked fine.
-
Hello tve,
weekend is gone, some time is free to test your new build.
Right now I get this message:
AccessDenied
Access Denied
AFC98212586720A3
myqc7IivAaBw9vPT1m6LXD5zKCCRvrXl+OHTxAbJ0PwEPp0U3tK9cjQPzP4dC6oWnUGWNbr0cnQ=
I'm pretty sure, I was doing a download at the weekend, but that computer is far, far away. -
@Gordon, AFAIK, erasing can only be done on whole page(usually 4K). Therefore I would recommend to publish empty pages only. Otherwise it would happen too often, that data needed somewhere else, will be deleted.
For example, someone could store some data in a page, used partly by save(). Erase this page and you could come in trouble.
@tve, I see the problem with single firmware for all ESP8266-boards. Would Gordons list of unused flash pages help ? Would it be possible to create something like unused_flash, similar to saved_code in ESP8266_BOARD.py ? -
I had to translate rant, interesting. Anyway lets go back to the facts:
- Flash-object works on ESP8266
- FlashEEPROM works on ESP8266
- with the actual firmware from EspruinoBuilds the free area starts at 0x6c000 and ends at 0x7c000, @tve please correct me if I'm wrong
- another option to load some data into flash is to create a binary file with a tool of your choice, and upload this with ESP8266Flasher.exe
- Flash-object works on ESP8266
-
By uploading new binary from http://www.espruino.com/binaries/git/commits/ I'm confused by version numbers.
Most actual version based on date is 1V81.700
The one before is 1V81.705
Download you recommended is 1V81.196
Somewhere between is 1V81.751
These are not released versions, no problem. But sometimes they are helpful and at least they are worth testing to find (eventually) problems, before they make it into release.
What are these numbers giving to me ?
Which one is most actual and should be used for testing ?
How do they match to ChangeLog ? -
-
-
What is the best solution to copy data from an typed Array (Uint8Array, ...) to an Array ?
Mozilla recommends Array.from(typedArray) or if .from is not available.
var typedArray = new Uint8Array([1, 2, 3, 4]),normalArray = Array.prototype.slice.call(typedArray);
Both are not available on Espruino (yet?)
Copy data in a loop is very time (and memory ?) consuming. -
Family part of weekend is gone, and I have some time again to play with my ESP8266 ;-)
@Kolban WS2812 is running now, there is only one problem, typed array (Uint8Array, Uint8ClampedArray etc) are not supported. This would be very helpful to save some memory.
To answer your question, I can run NeoPixel based on support in Espruino only. May be I misunderstood your question ?
@MarkusGritsch, @Kolban, on long term I would like to have an interface to upload binarys(compiled code) in addition to existing firmware, something like a plugin handling. This would end discussion of "does this belong to Espruino". -
May be, this is of help to define timing for several LED-strings.
Could it be used for something like "neopixel.init(...)" ?
https://github.com/FastLED/FastLED/blob/master/chipsets.h -
-
First I had the same problem with all three being white.
But now it works as expected, no idea why.
Only change I did was to add esp.debugLog(true).
From that moment on, it worked, even after setting esp.debugLog(false).var esp = require("ESP8266"); esp.logDebug(false); var p = new Pin(D4); pinMode(p, 'output'); esp.neopixelWrite(p, [0, 255, 255, 0, 0, 255, 0,255,0,255,0,0,128,128,0,255,255,0]);
-
-
-
-
I would not agree to the point "not that hard to compile".
First of all, you would need an environment to get compiling running. Without Neils video I wouldn't have tried to get this running. And even with that, a lot of those unexpected problems, that you have to expect, occured.
To get "my firmware" compiled, no changes have been made to make file. Only changes are in existing files for ESP8266. No idea right now, how actual espruino version from github could be used without loosing those changes, needed to get my firmware compiled. Lack of knowledge is obviously one part of the answer ;-)
My assumption is that more than 75% of Espruino users don't have time and/or knowledge to get this done. Next assumption is that we will have more than one extension, that some people would like to have. For example, once I got my WS2812-class running, next project will be an SHA1 implementation. For Websockets I don't need the full blown crypt with all the memory problems comin up. Latest at this time, I need to change makefile.
Both extensions will not make it into the standard firmware for Espruino, they are not really designed for that. On the other hand, I would like to share them to others. And here @allObjects comment comes in. How could we support sharing this to more Espruino users than those having the ability to compile their own version ?
BTW, just took a first look to Docker/Vagrant. From my point of view, its a first step only. Installation of developer environment with all those "unexpected problems" took a long time, and doing all of this with a script file seems to be, at least, very complex. To give an example, on my VM I never got the USB-flasher running. Or another one, never got Oracle VM running, using VMware right now, which is fine for a hobby developer but for companies ? Not even talking about using Linux, which is not that easy for windows guys.