ws2811 hue very slow #7144
Replies: 1 comment
-
Posted at 2019-04-12 by @gfwilliams You used this code?
Espruino isn't as fast as something like MicroPython by an order of magnitude - it's just a side-effect of it trying to be very efficient with memory (which admittedly is less of an issue on ESP32). The ESP32 port also hasn't had any real speed optimisation done at all either. However for 100 LEDs I'm extremely surprised that it's that slow - even one of the 64MHz ARM Espruino boards should be doing significantly better than that. Posted at 2019-04-12 by sebafudi This code is a little bit smoother I think, but it's about this same speed. I think looping through all objects in array is so slow, because I've commented out all other things, and it's still slow. I'm not even using neopixel library with this. function getPattern() {
pos++;
for (var i=0;i<arr.length;i+=3);
console.log('a');
//arr.set(E.HSBtoRGB((i+pos)*0.01,1,1,1),i);
} I've done this arr.set(E.HSBtoRGB((0+pos)*0.01,1,1,1),0);
arr.set(E.HSBtoRGB((3+pos)*0.01,1,1,1),3);
arr.set(E.HSBtoRGB((6+pos)*0.01,1,1,1),6);
arr.set(E.HSBtoRGB((9+pos)*0.01,1,1,1),9);
[...] 97 times And it's still slow. Posted at 2019-04-12 by Robin Fri 2019.04.12 In my tests, sending to the Web IDE using Posted at 2019-04-12 by @allObjects @sebafudi, since you just shift the pattern through the string, did you consider to just chop off the the falling off tuple(s) and calculate and append only the new ones? Posted at 2019-04-13 by Robin @sebafudi, have you tried the examples at: to gain additional insight? I think sebafudi hard coded each line with the offset just to test compare. Posted at 2019-04-13 by @allObjects @robin, I don't think so because it is calculating the values for each array element every time, even though it would need only to shift and only to calculate for the few new ones when also considering the modulus in the color sequence generation formula. Posted at 2019-04-14 by sebafudi @robin I wasn't using console.log in main code, and it was slow, so I don't think that's it.
was just for test. @allObjects Posted at 2019-04-14 by Robin Sun 2019.04.14 @sebafudi if you are still experiencing a delay as shown in the video, then I suggest we start with the basics. Please post the results of Please post the entire code block as it is right now, as it appears some edits have been made to the tutorial examples. What was the run time result of coding the example @gfwilliams provided in #2 above? Does the second full example at: (with embedded
Would you please post a video of that which 'worked perfectly' and the corresponding Arduino source code, so that we may see what visual effect that is desired? Posted at 2019-04-16 by @gfwilliams
This definitely isn't the case by the way - if you don't fill the output buffer then it's pretty fast. Obviously if you fill the buffer then you're limited by the time it takes to send that data over USB/Bluetooth/Serial/etc. Also, which firmware version are you using? If it's a firmware build that has been done without the RELEASE flag set then it'll have asserts all over it and will be an order of magnitude slower. Just to add some actual stats to this:
So official Espruino boards would appear to be 'fast enough', if not as fast as Arduino/Micropython. Posted at 2019-05-21 by DrAzzy My experience was that the ESP8266 (the one I do a lot of LED control with) was that this was very slow indeed. That's why I have only 10 pingpong lights on each of my strings.... I would very much like to see some speed optimizations for the ESP8266 and ESP32 boards - they are... painfully slow. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-04-12 by sebafudi
Hello.
I'm using example code to ws2811, and it's very slow. This example
He're is a video https://youtu.be/nvfhA3Y54ss
It's working ok when using <10 LEDs, but when I try to use more (I have 97 of them) it's very slow as in video. I've tried using Arduino for it and it worked perfectly. Same was for MicroPython. Is there some kind of setting I'm missing? I've even tried running only "for" loop that was counting to 10 000, and It took like 2 or 3 seconds. I've tried this same in MicroPython and it worked instantly.
Beta Was this translation helpful? Give feedback.
All reactions