These are chat archives for Makuna/NeoPixelBus

11th
Mar 2018
Michael Miller
@Makuna
Mar 11 2018 07:05
@blotfi Esp8266 NeoPixelBus does not use any of the timers. It uses the DMA hardware feature (which also used by I2S). Are you trying to call Show() in inside the timer? This is not supported on the Esp8266. All timer handlers should do the minimal work and not call any complex methods, in this case show() will check and set some DMA hardware features which can not be called within an ISR (interrupt service routine), like timer handlers. Set a volatile flag and then in the main loop check for the flag and call show().
buildcomplete
@buildcomplete
Mar 11 2018 11:35
Hæælo, I am implementing some animation objects (of my own animation class), but I am a bit puzzled on how to generalize, right now for instance, I have defined 'using MyMosaic = NeoMosaic <ColumnMajorAlternatingLayout>;' and in my animatedObject constructor, I use the MyMosiac: 'AnimatedSun(int position, float speed, RgbColor baseColor, MyMosaic& mosaic)'... I would prefer to have the mosaic inhereting some general 2dlayout mapper so I wouldn't need that 'using' defining the MyMosaic... But perhaps it is just me not using c++ in an optimal way? Any toughts on this??
Michael Miller
@Makuna
Mar 11 2018 18:24

@buildcomplete use typedef instead like this
typedef NeoMosaic<ColumnMajorAlternatingLayout> MyMosaic;
This is just so you don't have to type so much but you can just place the class definition in every place.

But, you need to understand that inheritance design model is not what this library was based on. I use a more modern template models; which at times seems more verbose but is far more flexible and creates smaller/faster code. A great book on the subject is "Modern C++ Design" by Andrei Alexandrescu.

If you are wanting to be able to change which layout for your class, then you also need to use templates.

Lotfi
@blotfi
Mar 11 2018 21:20
@Makuna Yes I call it inside the timer. Ok I will try to call it from outside. I tried on ESP32 and get some flicking (2 or 3 leds on my 240 LED strip were flashing I don't know why) others were working ok.
By the way only Neo800KbpsMethod works (but with the 2 or 3 leds problem) for ESP32. The 400Kbps method lights all the 240 LED I don't know why
Michael Miller
@Makuna
Mar 11 2018 21:48
@blotfi Esp32 really only currently works with less than 32 pixels until I get the hardware support in; which has been waiting on a feature in the Esp32 Arduino core work. There is an issue tracking this.
For most modern NeoPixels, there is no need to use the 400Kbps methods; the first generation of NeoPixels used this slower speed.