scottlawsonbc / audio-reactive-led-strip

:musical_note: :rainbow: Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
MIT License
2.67k stars 642 forks source link

256 LEDs limitation, still relevant for new protocols such as WLED? #326

Open mirko opened 3 years ago

mirko commented 3 years ago

I do get the limit of 256 LEDs for certain scenarios / combinations. So far, according to the other issues, the hard limit is assumed to be as part of the ESP8266 (firmware). I'm using the WLED protocol on the ESP8266 (not the wled firmware direct, though, just in case its of relevance), which /should/ not have this limitation. In regard of "audio-reactive-led-strip" I merged over the WLED support from Aircoookie's fork (https://github.com/Aircoookie/audio-reactive-led-strip.git). Any chance to get >256 (RGBW) LEDs working here?

joeybab3 commented 3 years ago

The limit is for the transfer protocol, 256*4(index,r,g,b) = 1024, it doesn't matter which library you use to drive the less. I think that there are some forks or people on here who have added an additional bit or something in order to get more options for the index byte, I'll see if I can find some.

joeybab3 commented 3 years ago

150 has some more discussion on this

mirko commented 3 years ago

I now read the code and everything is pretty clear, sorry for the noise.

First mistake to begin with, I assumed WLED is the protocol, while there's severals (WARLS, GRGB, DNRGB, ..). With WARLS 256 is the limit, with the others not having an N in the name all LEDs are updated altogether (not supported by this project) whereas DNRGB uses 2 bytes for indexing the LED which best case scenario is just a one-liner. So I'm going trying to get DNRGB working now - thanks!

joeybab3 commented 3 years ago

How are you going to get the second byte over the network?

mirko commented 3 years ago
diff --git a/python/led.py b/python/led.py
index c162c8b..9e4713d 100644
--- a/python/led.py
+++ b/python/led.py
@@ -73,13 +73,14 @@ def _update_esp8266():
         if _is_python_2:
             m+= chr(1) + chr(2)
         else:
-            m.append(1)
+            m.append(4)
             m.append(2)
         for i in packet_indices:
             if _is_python_2:
                 m += chr(i) + chr(p[0][i]) + chr(p[1][i]) + chr(p[2][i])
             else:
-                m.append(i)  # Index of pixel to change
+                m.append(i >> 8)  # Index of pixel to change
+                m.append(i & 0xFF)  # Index of pixel to change
                 m.append(p[0][i])  # Pixel red value
                 m.append(p[1][i])  # Pixel green value
                 m.append(p[2][i])  # Pixel blue value