Multiple channels show identical patterns #144
Replies: 3 comments 2 replies
-
I figured out the issue mostly. I missed the following part in README.md
So we need to make our own FireEffect that treats each channel separately. |
Beta Was this translation helpful? Give feedback.
-
It’s all how you draw it. The default implementations of setPixel do the same thing on all channels, but you can also individually draw to a channel.
If you draw to _GFX[0], that’s one arm. If you draw to _GFX[1], that’s another arm. If you just call LEDStripEffect::setPixel, it does it on ALL arms. Hope that helps a bit!
There's already an effect that, or at least there was at one time, does different color fire on each arm. I can’t spot it now so maybe it’s gone!
- Dave
In the current fire effect, check the following code for FireFanEffect. It calls MapHeatToColor with iChannel if multicolor is set, and that has a switch statement that will yield different colors for each channel (arm).
Make sure you’re setting bMulticolor to TRUE in the constructor, and it should draw with a different color for each arm.
for (int iChannel = 0; iChannel < NUM_CHANNELS; iChannel++)
{
CRGB color = MapHeatToColor(abHeat[i*CellsPerLED], bMulticolor ? iChannel : 0);
// If we're reversed, we work from the end back. We don't reverse the bonus pixels
int j = (!bReversed || i > FAN_SIZE) ? i : LEDCount - 1 - i;
int x = GetFanPixelOrder(j, order);
if (x < NUM_LEDS)
{
FastLED[iChannel][x] = color;
if (bMirrored)
FastLED[iChannel][!bReversed ? (2 * LEDCount - 1 - i) : LEDCount + i] = color;
}
}
… On Aug 5, 2022, at 12:49 PM, MrCmonster ***@***.***> wrote:
I figured out the issue mostly. I missed the following part in README.md
Each channel of LEDs has an LEDMatrixGfx instance associated with it. _GFX[0] is the LEDMatrixGfx associated with LED_PIN0, and so on. You can get the LED buffer of Pin0 by calling _GFX[0]->GetLEDBuffer(), and it will contain _GFX[0]->GetLEDCount pixels. You can draw into the buffer without ever touching the raw bytes by calling fill_solid, fill_rainbow, setPixel, and other drawing functions.
So we need to make our own FireEffect that treats each channel separately.
—
Reply to this email directly, view it on GitHub <#144 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AA4HCF5JKYX4YVRG3GKOWVTVXVV3JANCNFSM55WZDBOA>.
You are receiving this because you are subscribed to this thread.
|
Beta Was this translation helpful? Give feedback.
-
I’’ll just add some trivia here - initially, there was only one channel, channel 0. Then when I added the channels feature, I did it as a bit mask, one but per pixel in an 8 bit byte. But rather than having 0 mean no channels, I opted to make it “all channels”.
So, drawing to channel 0 or channel 255 should both draw to all 8 channels… if you have 8 channels, of course!
It doesn’t mean this behavior is consistent, but it should be. Similarly there’s some inconsistency about which primitives draw to all channels...
- Dave
… On Oct 6, 2022, at 12:44 AM, DrL4ser ***@***.***> wrote:
It’s all how you draw it. The default implementations of setPixel do the same thing on all channels, but you can also individually draw to a channel. If you draw to _GFX[0], that’s one arm. If you draw to _GFX[1], that’s another arm. If you just call LEDStripEffect::setPixel, it does it on ALL arms. Hope that helps a bit! There's already an effect that, or at least there was at one time, does different color fire on each arm. I can’t spot it now so maybe it’s gone! - Dave In the current fire effect, check the following code for FireFanEffect. It calls MapHeatToColor with iChannel if multicolor is set, and that has a switch statement that will yield different colors for each channel (arm). Make sure you’re setting bMulticolor to TRUE in the constructor, and it should draw with a different color for each arm. for (int iChannel = 0; iChannel < NUM_CHANNELS; iChannel++) { CRGB color = MapHeatToColor(abHeat[iCellsPerLED], bMulticolor ? iChannel : 0); // If we're reversed, we work from the end back. We don't reverse the bonus pixels int j = (!bReversed || i > FAN_SIZE) ? i : LEDCount - 1 - i; int x = GetFanPixelOrder(j, order); if (x < NUM_LEDS) { FastLED[iChannel][x] = color; if (bMirrored) FastLED[iChannel][!bReversed ? (2 * LEDCount - 1 - i) : LEDCount + i] = color; } }
… <x-msg://50/#>
On Aug 5, 2022, at 12:49 PM, MrCmonster @.**> wrote: I figured out the issue mostly. I missed the following part in README.md Each channel of LEDs has an LEDMatrixGfx instance associated with it. _GFX[0] is the LEDMatrixGfx associated with LED_PIN0, and so on. You can get the LED buffer of Pin0 by calling _GFX[0]->GetLEDBuffer(), and it will contain _GFX[0]->GetLEDCount pixels. You can draw into the buffer without ever touching the raw bytes by calling fill_solid, fill_rainbow, setPixel, and other drawing functions. So we need to make our own FireEffect that treats each channel separately. — Reply to this email directly, view it on GitHub <#144 (comment) <#144 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4HCF5JKYX4YVRG3GKOWVTVXVV3JANCNFSM55WZDBOA <https://github.com/notifications/unsubscribe-auth/AA4HCF5JKYX4YVRG3GKOWVTVXVV3JANCNFSM55WZDBOA>. You are receiving this because you are subscribed to this thread.
Good Morning,
Since I am trying to do the exact same thing I would like to kindly ask if you got an example Code about how to create a effect like the rocket thruster using mulitple channels, PINs etc. It is not easy for me to find this out by myself and I guess a lot of people would appreciate your help :)
With best regards,
Norman
—
Reply to this email directly, view it on GitHub <#144 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AA4HCFYYE4HTJAF2L46GX6LWBZ7OLANCNFSM55WZDBOA>.
You are receiving this because you commented.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was under the impression that each channel would be separate from the others as far as the color data goes. In other words, if I have 8 channels running ClassicFireEffect, then each channel would have a different fire look like in the video that shows Dave's "rocket engine". As it is, the channels are all the same. Am I missing a setting somewhere or something? If they're all the same then what's the point of having multiple channels since you can just wire multiple strips to one output pin?
I'm on a TTGO board if that makes any difference.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions