Premise
I’m working on a fork of usermod-v2-word-clock
to support a 16x16 matrix array, which allows minute-grained times. I’m planning on an implementation that may also use a few other usermods—some of which are memory intensive—and I’m concerned I’m going to be butting up against the line.
Background:
I have a number of 1D and 2D arrays to hold “masks” of LEDs which should be active.
During the loop()
, I initialize a 256-element array of pixels for the panel to 0
s for the overlay mask, and then (through various conditionals/switches) loop through that array, setting an element to 1
if the corresponding pixel is allowed to be lit by whatever effect is running, and leaving it at 0
if it should be blacked out.
Finally, during handleOverlayDraw()
, I loop through the mask array, and for every element still 0
, I black out that pixel of the strip.
My questions:
- Is this the most efficient way of handling masks of “valid” pixels?
- Is setting the color to
RGBW32(0,0,0,0)
the right way to “turn off” pixels inhandleOverlayDraw()
? - Would bitwise operations to manage the “mask” be more efficient, since I’m really only dealing with “on” or “off” for those pixels?
- If so, how would I use a bitmask in
handleOverlayDraw()
? - Is there a better/cleaner/more readable way to manage this? Like an array of
strip
s or something like that?
When it’s all done, I plan to submit a PR that supports arbitrary matrix sizes, and include instructions on creating masks for each word (either in the form I’m currently using, or possibly using bitmasks or some other technique I could be spacing out on.