Skip to content

feat: 0xB6 E1 22 color/segment set + solid-color reporting#544

Open
asxzy wants to merge 1 commit into
lightinglibs:masterfrom
asxzy:feat/0xb6-colors
Open

feat: 0xB6 E1 22 color/segment set + solid-color reporting#544
asxzy wants to merge 1 commit into
lightinglibs:masterfrom
asxzy:feat/0xb6-colors

Conversation

@asxzy

@asxzy asxzy commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

First of a stacked series splitting the large 0xB6 effects work (#540) into reviewable PRs. This PR adds only the E1 22 color/segment path and solid-color reporting for the 0xB6 (Surplife) extended-custom protocol. The extended custom effects (E1 21) and scribble (E1 23/E1 26) features land in follow-up PRs stacked on top of this one.

What's included

  • protocol.py
    • construct_levels_change rewritten as a uniform E1 22 fill so a plain color lands the device in preset 0x24 ("Colorful", effect=None) rather than an E1 21 Static Fill scene (hardware-verified).
    • Single white is combined by max (not sum) to avoid double-counting the mirrored warm/cool channel on this single-white-LED device.
    • Add _rgb_to_hsv_bytes / _rgb_to_hsv_bytes_rgbw helpers and construct_custom_segment_colors.
  • base_device.py
    • _named_effect reports preset 0x24 as a plain color (no effect).
    • Add _generate_custom_segment_colors with validation.
  • device.py / aiodevice.py
    • Add setCustomSegmentColors / async_set_custom_segment_colors.
  • tests
    • Sync + aio coverage for solid-color reporting, level-change framing (color, white, white-not-doubled), RGBW HSV conversion, segment-color construction/validation, and the unsupported-device guard.

const.py and pattern.py are untouched.

Verification

All gates pass locally:

  • pytest -q — 169 passed
  • ruff check flux_led/ tests/ — clean
  • ruff format --check flux_led/ tests/ — clean
  • mypy --python-version=3.13 flux_led/*.py — clean
  • mypy --python-version=3.10 flux_led/*.py — clean

Stack

This is PR 1 of 3 (colors -> extended effects -> scribble).

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
flux_led/base_device.py 94.11% 0 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
flux_led/aiodevice.py 96.31% <100.00%> (+0.03%) ⬆️
flux_led/device.py 76.53% <100.00%> (+0.48%) ⬆️
flux_led/protocol.py 99.19% <100.00%> (+0.02%) ⬆️
flux_led/base_device.py 96.33% <94.11%> (-0.06%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@asxzy asxzy force-pushed the feat/0xb6-colors branch 2 times, most recently from b12c417 to f1edd81 Compare July 2, 2026 19:01
@asxzy asxzy marked this pull request as ready for review July 2, 2026 19:03
Add the E1 22 uniform-fill path for solid colors on the 0xB6 (Surplife)
extended-custom protocol and custom per-segment colors:

- protocol: construct_levels_change rewritten as a uniform E1 22 fill so a
  plain color lands in preset 0x24 (Colorful, effect=None); single white is
  combined by max (not sum) to avoid double-counting the mirrored channel;
  add _rgb_to_hsv_bytes / _rgb_to_hsv_bytes_rgbw and
  construct_custom_segment_colors.
- base_device: _named_effect reports preset 0x24 as a plain color (no effect);
  add _generate_custom_segment_colors with validation.
- device/aiodevice: add setCustomSegmentColors / async_set_custom_segment_colors.
- tests: sync + aio coverage for the above.
@asxzy asxzy force-pushed the feat/0xb6-colors branch from f1edd81 to a3345c7 Compare July 2, 2026 19:04
@asxzy

asxzy commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@bdraco This one is ready for review. It adds one single command only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant