Using WS2812B strips as a matrix #676
Replies: 9 comments 8 replies
-
Hi, and welcome.
The literal answer to the question you asked is "no". But that's probably
not the answer you're looking for.
The pixel-blasting code likes to think that there's one giant pixel array
that gets sent to a device. You've surely seen references to gfx->leds[]
everywhere in the various effects. The "trick" is to slice that strip up,
exactly like you've done physically, only logically.
There's a MATRIX_HEIGHT and MATRIX_WIDTH defined in the header, but for
things that aren't HUB75, they're not used super consistently. (The 3-panel
audio spectrum analyzer is probably the most notable exception.) There is
a combination of a macro (gfxbase.h:XY), a function (gxfbase.cc:XY) and a
virtual method (gfxbase:xy) that may be in play. I THINK if you set
MATRIX_HEIGHT and MATRIX_WIDTH to appropriate values for your frame, you
should (might?) fall into the definition of xy() that handles the common
xy-looping model you're describing. There's even ASCII art to describe it.
So set those two #defines, confirm with your debugger that _height and
_width are set correctly when GFXBase is constructed in gfxbase.cc:254 or
so, sanity check that GetLEDCount() matches what you think it should be,
and then see if our various matrix-aware code will play nice. We have a
bunch of convenience operators like drawPixel() that takes x, y that should
make manging them as a grid much more palatable.
I've thought about adding virtual scrolling marquee text for hardware like
the aforementioned wide panels of the 16x16 panels. I think we already have
fonts in the project for Mesmerizer.
Good luck!
…On Sat, Jan 11, 2025 at 9:44 PM Gray Oron ***@***.***> wrote:
Hi!
I have a bunch of 4' long WS2812B strips mounted on strips of wood that
are mounted with 3d printed clips, allowing me to use them in different
configurations. I would love to use them as a matrix as well (to create
wider effects or to display text). For the life of me I cannot figure out
if there is an actual simple way to define a matrix zigzagged led strips in
the projects (I have an din and dout on the ends, so I would just ideally
chain them and inject some power ever so often).
Help please!
Oh, I am running them on Seeed Studio esp32-s3 which was not too hard to
do with this project, but have not added too many effects so far...
—
Reply to this email directly, view it on GitHub
<#676>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCSD37V5D4W7Q34NTSHQWD2KHQIFAVCNFSM6AAAAABVATD666VHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXHAYDSNZVHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thank you @robertlipe! |
Beta Was this translation helpful? Give feedback.
-
I think you'll find all the needed pieces there. The gate was on "simple".
Certainly the spectrum project uses all the parts as the 8x8 panels that it
uses are wired in the same layout as you're describing. It sets up width
and height at
https://github.com/PlummersSoftwareLLC/NightDriverStrip/blob/08d1895783da955584534930ee3e329b6b87ec2e/include/globals.h#L597
It is then able to address them at the software level like an x/y frame
buffer.
Good luck!
…On Mon, Jan 13, 2025, 3:20 PM Gray Oron ***@***.***> wrote:
Thank you @robertlipe <https://github.com/robertlipe>!
That gives me plenty to work from, good to know there is no (clear)
implementation of that yet.
I might just have to document my steps well and post something here for
future reference, or better yet, suggest some code/config changes :-)
—
Reply to this email directly, view it on GitHub
<#676 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCSD3YP3IP2R2ESL2Y6R4T2KQUYHAVCNFSM6AAAAABVATD666VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOBSGQ4DINI>
.
You are receiving this because you were mentioned.Message ID:
<PlummersSoftwareLLC/NightDriverStrip/repo-discussions/676/comments/11824845
@github.com>
|
Beta Was this translation helpful? Give feedback.
-
I am very confused about this error message while trying to run PatternSMFire2021 on a simple led matrix:
As the xy virtual method is defined right above the calling 'include' in gfxbase.h:
I even added: I am trying to run "EFFECT_MATRIX_SMFIRE2021" with a simple led matrix...
|
Beta Was this translation helpful? Give feedback.
-
@GrayOrion Do you have your code pushed to a branch in your fork that I can pull and look at? I ask because I'm almost certain this is caused by something that's not included in the code you're now sharing. Phrased one way, there are 41 projects/environments that compile successfully with the current codebase, so somehow some change you made got things misaligned. If I can comprehensively examine the state of what it is you try to compile then I can see if I can figure out exactly where that happened. |
Beta Was this translation helpful? Give feedback.
-
Without looking, Rutger, I'll bet he's trying to make that fire effect work
on a hardware hardware configuration that approximately like your spectrum
build.
For you, I'll be a fireplace and the aspect ratio may act wacky at 48x16,
but I'll bet that's the approximate goal. (I also get that doing it from
scratch isn't YOUR project. 😊)
…On Sun, Jan 19, 2025, 4:02 AM Rutger van Bergen ***@***.***> wrote:
@GrayOrion <https://github.com/GrayOrion> Do you have your code pushed to
a branch in your fork that I can pull and look at?
I ask because I'm almost certain this is caused by something that's not
included in the code you're now sharing. Phrased one way, there are 41
projects/environments that compile successfully with the current codebase,
so somehow some change you made got things misaligned.
If I can comprehensively examine the state of what it is you try to
compile then I can see if I can figure out exactly where that happened.
—
Reply to this email directly, view it on GitHub
<#676 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCSD3ZXU7CKXPZUZDQ2XAD2LNZ3ZAVCNFSM6AAAAABVATD666VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOBYGA2TGNY>
.
You are receiving this because you were mentioned.Message ID:
<PlummersSoftwareLLC/NightDriverStrip/repo-discussions/676/comments/11880537
@github.com>
|
Beta Was this translation helpful? Give feedback.
-
Sure, it's always best to have complete code and a buildable reproduction
step for this kind of thing.
I had a few minutes and thought I'd look into it. I see only pretty small
changes but the demo project still links.
I don't have a matrix within reach to confirm working, but from your
description, I expected a compile error. I have LOTS of experience with
those, so was willing to help take a look.
You changed the demo target, so that's what I built:
$ pio run -e demo
Compiles and links without issue
Can you please provide steps to repro the compile failure so we can help
you?
…On Wed, Jan 22, 2025 at 1:14 AM Gray Oron ***@***.***> wrote:
Sorry for the slow response, work took over my life in the past few days...
My branch is at
https://github.com/GrayOrion/NightDriverStrip/tree/graysMatrixTest
I added my environment changes as well (platformio.ini) so that you can
see everything I might have screwed up...
It is most likely something I missed on the C++ side of things rather than
anything with the actual project... :-(
—
Reply to this email directly, view it on GitHub
<#676 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCSD3YUNJNZH5F3TMVUPP32L5AN5AVCNFSM6AAAAABVATD666VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOJRGE4TCMA>
.
You are receiving this because you were mentioned.Message ID:
<PlummersSoftwareLLC/NightDriverStrip/repo-discussions/676/comments/11911910
@github.com>
|
Beta Was this translation helpful? Give feedback.
-
OK, I found the problem. Following GitHub's instructions lost the branch
you were working on. Got it.
It now compiles without error. This time, instead of being in bed without
strips, I'm in a dentist parking lot without strips, but I can explain the
needed changes to get to a succesful build.
Your approach of reusing DEMO kind of hits a few other branches in our
configuration system. The lines between 'use 2d', "MESMERIZER", and
USE_HUB75 are...fuzzy. globals.h and effects.* make it clear that you're
the first to try this in a while.
ledstripeffects.h and ledmatrixeffects.h are mutually exclusive. For better
and worse, since you chose -DDEMO, you fell into the stripeffects.h path.
This means that perfectly lovely definition of xy() in *matrixefffects.h
was never seen because it was nuked via the USE_HUB75 at the top. (To split
hairs, "provide 2d support" and "USE_HUB75" aren't quite the same thing,
but here we are. If you're serious about pushing this upstream, we'll
figure out how to solve some of these things better.)
So the trick is to provide an xy() in ledstripeffects.h that provides the
snaking effect you need. I just copied the one from *matrix*. It's looking
for class members that don't exist, so I hardwired it to use the #defines
you provided in globals.h. That made it blow up someewhere else, so I had
to reset _width and _hegigtht when done.
src/effects.cpp has similar logic that trips you up. There was a warning
that you didn't report, but it provided hints probably only recognizable to
those of us that have implemented effects.
src/effects.cpp is the file that uses the effect name from p*ini to decide
which effects/{strip,matrix}/file to include and when to add it to the
needed arrays. You found a way to jam in the latter, via sticking an
ADD_EFFECT, but you missed the #include. I just bypassed all that clever
stuff and stuffed it in unconditionally, which is totally wrong if you were
to try to upstream this, but it's fine for a personal project if you're
building only one project from this tree...and if you're not, you have the
hint yo need.
You probably missed it, but you can put the ADD_EFFECT stuff in a personal
custom_effects.h and bypass all that too-clever stuff for defines. That
doesn't work for something you plan to upstream, but it's how I do my
custom builds, and it works well. This does point out a hole in the scheme
that there should also probably be a corresponding custom_effects_includes
or something.
Patch attached since I can't exactly run a p4 upload from here.
I made it compile. Making it _work_ and making it awesome is back in your
court for now. :-)
If this is something you're interested in upstreaming, and I'd encourage
you to, if we can get a nod from a reviewer on project name and loose
agreement that we need to separate "1d" and "2d" along slightly different
internal clues than we're using now, I'll help you add the needed goo to
platform to create a new environment (you had the right idea reusing DEMO
and that probably let you defer dodging several bullets...) I'm interested
in landing this and will help whip all that into a shape to integrate it if
you want to partner up on it.
Use case: running many of our grand effects on WS281x panels and/or custom
strip builds for that thing in the desert.
RJL
…On Wed, Jan 22, 2025 at 8:01 AM Robert Lipe ***@***.***> wrote:
Sure, it's always best to have complete code and a buildable reproduction
step for this kind of thing.
I had a few minutes and thought I'd look into it. I see only pretty small
changes but the demo project still links.
I don't have a matrix within reach to confirm working, but from your
description, I expected a compile error. I have LOTS of experience with
those, so was willing to help take a look.
You changed the demo target, so that's what I built:
$ pio run -e demo
Compiles and links without issue
Can you please provide steps to repro the compile failure so we can help
you?
On Wed, Jan 22, 2025 at 1:14 AM Gray Oron ***@***.***>
wrote:
> Sorry for the slow response, work took over my life in the past few
> days...
> My branch is at
> https://github.com/GrayOrion/NightDriverStrip/tree/graysMatrixTest
> I added my environment changes as well (platformio.ini) so that you can
> see everything I might have screwed up...
> It is most likely something I missed on the C++ side of things rather
> than anything with the actual project... :-(
>
> —
> Reply to this email directly, view it on GitHub
> <#676 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ACCSD3YUNJNZH5F3TMVUPP32L5AN5AVCNFSM6AAAAABVATD666VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOJRGE4TCMA>
> .
> You are receiving this because you were mentioned.Message ID:
> <PlummersSoftwareLLC/NightDriverStrip/repo-discussions/676/comments/11911910
> @github.com>
>
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I have a bunch of 4' long WS2812B strips mounted on strips of wood that are mounted with 3d printed clips, allowing me to use them in different configurations. I would love to use them as a matrix as well (to create wider effects or to display text). For the life of me I cannot figure out if there is an actual simple way to define a matrix zigzagged led strips in the projects (I have an din and dout on the ends, so I would just ideally chain them and inject some power ever so often).
Help please!
Oh, I am running them on Seeed Studio esp32-s3 which was not too hard to do with this project, but have not added too many effects so far...
Beta Was this translation helpful? Give feedback.
All reactions