PanelLayout
Source:
PanelLayout.h
PanelLayout¶
src/light/layouts/PanelLayout.h:34Inherits:
LayoutBase
Layout of a single 2D LED panel.
Author: MoonLight, https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Layouts/L_MoonLight.h
Public Attributes¶
lengthType panelWidth = 16
: Geometry (verbatim MoonLight defaults): a 16×16 panel.
lengthType panelHeight = 16
uint8_t wiringOrder = 0
: Which axis is the outer loop: row-major by default, or column-major.
bool incX = true
: Per-axis direction: set walks that coordinate up, clear walks it down.
bool incY = true
: Whether y counts up.
bool snake = true
: Snake the inner loop on odd outer steps, which is one exposed toggle in 2D.
Public Methods¶
virtual inline void defineControls() override
: The controls a user sets on the card.
virtual inline const char * tags() const override
: The catalog tags this layout carries.
virtual inline Dim dimensions() const override
: How many axes this layout places lights on.
virtual inline nrOfLightsType lightCount() const override
: How many lights the current settings place.
virtual inline void placeLights(const CoordSink & sink) const override
: Emit every light's coordinate, in wiring order.
More info¶
A serpentine 2D LED matrix (panel), emitting each light's (x, y, 0) coordinate in physical wiring order. The general matrix layout: GridLayout is the simple row-major/serpentine case; this adds a configurable axis order (walk X-major or Y-major), a per-axis increment direction, and a snake toggle.
Prior art: MoonLight PanelLayout (Node "Panel", tags 🚥), which drives the panel off a Wiring{size, count, inc[], snake[]} helper and an iterate() walk. We reproduce the geometry (axis-order table, snake-on-odd-outer serpentine) and the control set, but drop MoonLight's pin/wiring plumbing (the Wiring struct's pin count, nextPin()), a MoonLight layout emits coordinates only. The driver owns pins. tags 💫 marks the MoonLight lineage.
The MoonLight Wiring/iterate implementation is not in the ported source (only the Panel usage site is), so the iteration is reconstructed from that usage plus the control labels/defaults. The reconstructed logic is marked // RECONSTRUCTED and cross-checks against GridLayout's serpentine on the defaults.
The wiring walk is reconstructed¶
MoonLight's iterate helper is not in the ported source, so the semantics here come from how the panel used it, plus the control labels and defaults.
The outer loop walks its axis across that axis's extent, and the direction is the per-axis increment flag, which matches the axis-named labels the cube uses too. The outer loop never snakes, its parent index being a constant and so always even. The inner loop reverses when the snake toggle is on and the emitted outer index is odd.
MoonLight's exact snake-array indexing, whether keyed by physical axis or by loop slot, is not recoverable from what was ported. Both that reading and the default comment about snaking on one axis yield the same geometry, the standard boustrophedon panel, so this is the faithful behavior.
On the defaults this emits one row ascending, the next descending, identical to a grid's serpentine.