These are chat archives for Makuna/NeoPixelBus

28th
May 2015
sticilface
@sticilface
May 28 2015 17:26
hi there!
sticilface
@sticilface
May 28 2015 17:52
tried it at 3.6 still does it. I had an idea... the original code included a 2 microsecond delay before sending out the data. I thought i'd try it... it seems better.. but still a bit of flickering. i think a scope is the only way this might get sorted!
Michael Miller
@Makuna
May 28 2015 17:53
I have a scope and a logic analyzer, if I can repro the issue myself I can look into how to fix it. But I am not seeing a problem.
If you have a few minutes, I would like to give you a few things to try
sticilface
@sticilface
May 28 2015 17:58
of course!
Michael Miller
@Makuna
May 28 2015 17:58
find and open NeoPixelBus.cpp, modify the send_pixels_800 to this
static inline void send_pixels_800(uint8_t* pixels, uint8_t* end, uint8_t pin)
{
    const uint32_t pinRegister = _BV(pin);
    uint8_t mask;  
    uint8_t subpix;  
    uint32_t cyclesStart;

    // add the below statement
    GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, pinRegister);
    // add the above statement

    cyclesStart = ESP.getCycleCount() + CYCLES_800;
    while (pixels < end)
    {
sticilface
@sticilface
May 28 2015 18:00
ok, doing it now
i have an extra line uint32_t state = esp8266_enter_critical();
am i out of date?
Michael Miller
@Makuna
May 28 2015 18:05
Yes! Sync and get the latest, but you need to make sure you are also using the latest esp8266/arduino (Arduino IDE 1.64 + Board download of esp8266)
Get the latest without the above change first and let me know what you see.
sticilface
@sticilface
May 28 2015 18:06
well! since i just added that one line of code! I've not had a green flicker... and the colour in the first pixel is rock solid. so i think you've cracked that nut! well done!
this flicker is one of the things my GF.. has said is annoying! when its off... it flickers...
Michael Miller
@Makuna
May 28 2015 18:07
That line should not be needed if you have the latest stuff; I am curious if you get the latest and still needed it. It might be a variance of boards.
sticilface
@sticilface
May 28 2015 18:08
i've got a little static with updating the IDE as i was pulling changes every day. multiple times a day and it was breaking parts of my project. i updated.. then mqtt broke, then i updated mqtt.. only to have to fix multiple other bugs! it cost me days... right now everything is working :) well...
so i should git pull neopixelbus....
git pull arduino-ESP...
Michael Miller
@Makuna
May 28 2015 18:09
At least, most of the stuff it needed has been in esp8266/arduino for awhile so you may not too new of a version of that.
I test against the "board" install only, as this is what most people will use.
sticilface
@sticilface
May 28 2015 18:12
ok git pull of NepPixelBus, without the line you just gave me... green flicker is back with avengance
i think that is defiantly it. put it back, and no more flicker!
nada! i wish all my programming worried were fixed that easily.
right, got to make some dinner... (or rather the GF is getting irate!) thanks for the help. let me know if i can do more
Michael Miller
@Makuna
May 28 2015 18:15
ok, I had that line a long time ago but I optimized a few things and pulled it. I will add it back.
thanks for the remote debugging ;-)
sticilface
@sticilface
May 28 2015 18:29
you are more than welcome, i really appreciate the help. Can I ask you a non-related question, re: the buffer stuff we were talking about on gihub?
the first time i've ever gone near C, or any programming since I did BBC basic when i was a teenager was when IGRR sent me a beta of the arduino IDE! so I'm quite out of my depth
Michael Miller
@Makuna
May 28 2015 18:38
Sure go ahead
sticilface
@sticilface
May 28 2015 18:53
in the process of making dinner hence my delay
        uint8_t* pixels = (uint8_t*)strip->Pixels();

          for (int I = 0; I < 3 * strip->PixelCount(); i =+ 3) {
                effectbuf[I] = pixels[I+1];       // Red
                effectbuf[I+1] = pixels [I];       // Green
                effectbuf[I+2] = pixels [I+2 ];      // Blue

          }
this is what i've tried to use to copy effectbuf to the pixel buffer based on what you said earlier...
it crashes the ESP.
I need to re-order... the pixels as they are RGB...
Michael Miller
@Makuna
May 28 2015 19:16
its += not =+
for (int I = 0; I < 3 * strip->PixelCount(); I += 3)
basically the compiler turns what you wrote into
I = +3
(spacing doesn't matter for C/C++)
Also, C/C++ is case sensitive, so I hope you don't have another variable that is a lower case I, as that would be what you are incrementing (was that a typo as you copied into chat?)
Michael Miller
@Makuna
May 28 2015 19:22
personally, I try to not use simple single letter variable names, its too easy to make the minor mistakes and hard to spot them, I use "index", "pixelIndex", etc, yes more typing, but it makes it easier to read and spot problems and less likely to reuse a variable later by mistake.
sticilface
@sticilface
May 28 2015 19:33
ahhhhhhh!!!!! i make a lot of mistakes like that... i automatically assumed that it was because i was trying something totally new!
thank you
trying now!
sticilface
@sticilface
May 28 2015 20:52
Right... got it to work
sticilface
@sticilface
May 28 2015 20:58
one thing... how do i set the update flag! the values get copied to the buffer but i need to set a pixel using strip->SetPixelColor() for the strip->Show() to work
sticilface
@sticilface
May 28 2015 21:28
despite trying it this way the time taken to actually do the whole thing is identical.. so its all unnecessary! having said that... its all good to learn.. thank you for your help though:) and the credit for helping you out!
Michael Miller
@Makuna
May 28 2015 21:33
Your right about the update flag, I think I might add an optional parameter to Show to force it to update.
Actually, you can mark it, call NeoPixelBus.Dirty() after updating the buffer and before Show().
sticilface
@sticilface
May 28 2015 21:48
i knew it was dirty something... i didn't actually try it as i couldn't find the function dirty... just references to it!
I should have tried!
thank you