davepl / DavesGarageLEDSeries

Code for Tutorial series at http://YouTube.com/c/DavesGarage
169 stars 72 forks source link

I think Heat drift has a bug #1

Open devoh747 opened 3 years ago

devoh747 commented 3 years ago
    // Next drift heat up and diffuse it a little bit
    for (int i = 0; i < Size; i++)
        heat[i] = (heat[i] * BlendSelf +
                   heat[(i + 1) % Size] * BlendNeighbor1 +
                   heat[(i + 2) % Size] * BlendNeighbor2 +
                   heat[(i + 3) % Size] * BlendNeighbor3)
                  / BlendTotal;

Say the Size is 10 and coming thru the loop we are at i=9 (i+1) % Size will evaluate to 0 (i+2) % Size will evaluate to 1 (i+3) % Size will evaluate to 2

So at pixel 9 you will be adding in the heat[0]Blend+heat[1]Blend+heat[2]Blend when it should be the heat from heat[8]Blend+heat[7]Blend+heat[6]Blend. I figure you need something so that you do not go outside the array.

davepl commented 3 years ago

This was intentional so that he flame can “wrap around” a circular strip like a fan. Is it not working as you’d expect? It’s not to grab 1, 2, and 3, it’s to grab pixels 1, 2, and 3 to the “right” except wrap around if you go past the end of the strip. That’s what I intended anyway!

On Nov 16, 2020, at 2:21 PM, devoh747 notifications@github.com wrote:

// Next drift heat up and diffuse it a little bit
for (int i = 0; i < Size; i++)
    heat[i] = (heat[i] * BlendSelf +
               heat[(i + 1) % Size] * BlendNeighbor1 +
               heat[(i + 2) % Size] * BlendNeighbor2 +
               heat[(i + 3) % Size] * BlendNeighbor3)
              / BlendTotal;

(i+1) % Size will always evaluate to 1 (i+2) % Size will always evaluate to 2 (i+3) % Size will always evaluate to 3

So every at each pixel you will always be adding in the 1,2,3 indexes . I do not have a solution as of yet, but I understand you need something so that you do not go outside the array.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/davepl/DavesGarageLEDSeries/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4HCF3Z3HD2IDPX7TABTULSQGQWLANCNFSM4TXYW46Q.

devoh747 commented 3 years ago

Oh so it was meant for the fans and not the general case of the pixel strips. The code from https://github.com/davepl/DavesGarageLEDSeries/tree/master/LED%20Episode%2009 has a ClassicFireEffect and a FireEffectSmooth. The ClassicFireEffect has the code I mentioned above. I guess I should be using the FireEffectSmooth if I am not using a circular fan?

I am trying to use a 60led/meter strip and get a similar fire to what you have in your windows and art piece behind you. I have yet to get anything close. I'm using FireEffect fire(NUM_LEDS, 8, 5, 15, 2, true, false); and I think it's has a nice rolling look but it's missing the billowing yellows. Are you using the heat pallet or a custom pallet where you stretch out the yellow? My "uneducated guess" we need to do something to expand the yellows... perhaps a custom pallet. Can you share more on how they are doing it in your windows and art piece?

Zuni1971 commented 3 years ago

i was trying to make my house look like Dave's but it must be a secret as there is no update in this section about the fire lights.

Galaxy-Man commented 1 year ago

Has anyone managed to get the house on fire effect yet, Ive spent 3 days looking at this and tried many variable but ot no avail :-( Cannot get the Smoothclass working just looks like a maquee! Does anyone have the correct settings. Would like to order my parasol by the summer and build this for the kids. BTW great work and YouTube channel, wish it was the 80's

davepl commented 1 year ago

Which project are you building? I would think the simplest would be the DEMO project and change the default effect to FireEffect, and that should be that. What are you doing, and what results are you seeing or not seeing?

Thanks Dave

On Jul 2, 2023, at 5:05 PM, Galaxy-Man @.***> wrote:

Has anyone managed to get the house on fire effect yet, Ive spent 3 days looking at this and tried many variable but ot no avail :-(

— Reply to this email directly, view it on GitHub https://github.com/davepl/DavesGarageLEDSeries/issues/1#issuecomment-1616713623, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4HCF4MFUSFBF37N2LCGQTXOGL6LANCNFSM4TXYW46Q. You are receiving this because you commented.

Galaxy-Man commented 1 year ago

Hi Dave,

Aprreciated the prompt reply, even though I have not got it doing what yours does I am having fun learning. I think adding rotary knobs for each variable will allow me to adjust live and not wait for recompile and upload, this is my next task. I think this will help me solve the issue. There is nothing wrong with your code just me trying to find the settings to mimc what yoiu did in your window flames.

Im using Demo 10 code with these values. fire.h using this only ClassicFireEffect fire(NUM_LEDS); // NUM_LEDS =144

How did you wire the parasol? of the eight strips did you parallel the data lines together or does each data line have their own pin assigned?

Thanks Ian

Galaxy-Man commented 1 year ago

This is closed I have resolved the challenges. Thanks for your help dave.