Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flux_led/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,7 @@ def construct_device_config(
pixels_per_segment,
segments,
music_pixels_per_segment,
segments,
music_segments,
),
inner_pre_constructed=True,
)
Expand Down
19 changes: 19 additions & 0 deletions tests/test_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
PowerRestoreState,
PowerRestoreStates,
ProtocolLEDENET25Byte,
ProtocolLEDENETAddressableA2,
ProtocolLEDENETAddressableA3,
ProtocolLEDENETCCT,
ProtocolLEDENETCCTWrapped,
RemoteConfig,
Expand Down Expand Up @@ -1269,6 +1271,23 @@ def _updated_callback(*args, **kwargs):
)


def test_addressable_a3_device_config_forwards_music_segments():
"""A3 must forward the caller's music_segments, not substitute segments.

A3 wraps A2's device-config message. With pixels_per_segment above
MUSIC_PIXELS_PER_SEGMENT_MAX the music-sync override in A2 is skipped, so a
distinct music_segments value survives to the wire. The A2 inner message
therefore appears verbatim inside the A3 wrapper only when A3 forwards every
parameter unchanged.
"""
# segments=4, music_pixels_per_segment=100, music_segments=5 (distinct from
# segments). pixels_per_segment=300 (> 150) disables the music-sync merge.
args = (0, 0, 4, 300, 4, 100, 5)
inner = ProtocolLEDENETAddressableA2().construct_device_config(*args)
wrapped = ProtocolLEDENETAddressableA3().construct_device_config(*args)
assert bytes(inner) in bytes(wrapped)


@pytest.mark.asyncio
async def test_async_set_zones(mock_aio_protocol, caplog: pytest.LogCaptureFixture):
"""Test we can set set zone colors."""
Expand Down
Loading