Conversation
Add a programmable LED-matrix source so the host can drive each of the 128 LEDs individually. This moves all pattern logic (rings, DPC, custom apertures) to the host — new patterns no longer require a firmware reflash. - ILLUMINATION_SOURCE_LED_ARRAY_PROGRAMMABLE (10): displays a host-painted framebuffer (led_matrix_user), kept separate from the live matrix so it survives the clear_matrix() strobe-off between acquisition frames. - SET_ILLUMINATION_LED_MATRIX_PIXEL (45): write one LED into the framebuffer (no show). CLEAR_ILLUMINATION_LED_MATRIX (46): zero the framebuffer. - Pixel scaling and R/G channel order match the built-in full/half patterns, so a host-painted color renders identically to the same built-in color. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirror the firmware protocol for the host-programmable LED matrix: - CMD_SET.SET_ILLUMINATION_LED_MATRIX_PIXEL (45), CMD_SET.CLEAR_ILLUMINATION_LED_MATRIX (46), ILLUMINATION_CODE.ILLUMINATION_SOURCE_LED_ARRAY_PROGRAMMABLE (10). - set_illumination_led_matrix_pixel / clear_illumination_led_matrix, and set_illumination_led_matrix_frame(frame) to push a full 128-LED frame (clear + non-black pixels), using the same R/G order and scaling as set_illumination_led_matrix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… rings Add a "Phase Contrast" tab that computes an annular LED-matrix illumination pattern in Python and drives it through the programmable source, so the ring can be tuned (and new patterns added) without a firmware reflash. - The ring is specified by inner/outer DIAMETER in pixels (LED pitches), with inner constrained <= outer. Ring type (full / 180-deg half), direction, and color are selectable; intensity comes from the channel's own live slider. - Settings are per imaging configuration: a selector lists the configurations that use the programmable source, each keeps its own ring, persisted to cache/phase_contrast_annulus_settings.json. get_frame(intensity, channel) reads the stored settings by name, so live view AND wellplate multipoint acquisition use the correct ring for whichever configuration is imaging (thread-safe: reads plain data, not Qt widgets). - live_controller routes the programmable source through the widget frame and includes source 10 in _is_led_matrix; gui_hcs adds the tab and auto-follows the active live configuration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The black lint gate failed on #624 for these two files. Formatting only, no behavior change. The two 128-entry LED coordinate tables are wrapped in `# fmt: off` / `# fmt: on` so they keep their 16-per-line layout instead of being exploded to one value per line. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JRAcmjXX4CEN9wXSnp6HzK
This was referenced Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Combines #623 (firmware) and #624 (host) into one PR so the feature lands atomically instead of as two PRs that each need the other to be useful. The three feature commits are cherry-picked unchanged from those branches (@hongquanli remains the author). One extra commit applies black to the two host files that failed the lint gate on #624; it is formatting only.
Make the LED matrix host-programmable per-pixel: patterns (rings, DPC, custom apertures) are computed on the host and painted into a framebuffer on the controller, so new patterns no longer require a firmware reflash. A new Phase Contrast tab computes an annular illumination pattern and drives it through the programmable source, with a separate ring per imaging configuration.
Firmware (
firmware/controller/src/)ILLUMINATION_SOURCE_LED_ARRAY_PROGRAMMABLE(10) — displays a host-painted 128-LED framebuffer (led_matrix_user). It's kept separate from the livematrixso it survives theclear_matrix()that strobe-off does between acquisition frames; turning the source on copies the framebuffer into the live matrix and shows it.SET_ILLUMINATION_LED_MATRIX_PIXEL(45) — write one LED into the framebuffer (no show).CLEAR_ILLUMINATION_LED_MATRIX(46) — zero the framebuffer./255*MAX_INTENSITYscaling and R/G channel order match the built-in full/half patterns, so a host-painted color renders identically to the same built-in color.Host protocol (
_def.py,microcontroller.py)SET_ILLUMINATION_LED_MATRIX_PIXEL(45),CLEAR_ILLUMINATION_LED_MATRIX(46),ILLUMINATION_SOURCE_LED_ARRAY_PROGRAMMABLE(10).set_illumination_led_matrix_pixel/clear_illumination_led_matrix, andset_illumination_led_matrix_frame(frame)to push a full 128-LED frame (clear + non-black pixels), using the same R/G order and scaling asset_illumination_led_matrix.GUI (
widgets.py,gui_hcs.py,live_controller.py)LedMatrixRingWidget) computes a 128-LED annulus frame and hands it to the live controller, which sends it per-pixel and selects the programmable source.cache/phase_contrast_annulus_settings.json.get_frame(intensity, channel_name)reads stored settings by name (plain data, not Qt widgets), so live view and wellplate multipoint acquisition both use the correct ring for whichever configuration is imaging — thread-safe from the acquisition worker.live_controllerroutes the programmable source through the widget frame and includes source 10 in_is_led_matrix;gui_hcsadds the tab and auto-follows the active live configuration.Required machine config (not in this PR)
The annulus imaging channel and its port mapping live in
machine_configs/+user_profiles/, which are gitignored (per-machine). To enable the feature on a device, add:machine_configs/illumination_channel_config.yaml— map a free controller port to source 10, and add the channel:user_profiles/<profile>/channel_configs/general.yaml— add the imaging channel (merges into every objective):Any imaging configuration whose
illumination_channelresolves to source 10 appears in the tab's selector and gets its own ring.Testing
pio run -e teensy41builds clean; flashed to a Teensy 4.1 and exercised from the host, painting a 128-LED annulus frame and displaying it in live view and acquisition.c05bef3a), including the firmwarecommands.cppthat feat(fw): TMC2240 stepper-driver support behind a per-axis driver seam (firmware 1.5) #644 also touched.black --checkpasses. CI-equivalent pytest run (--ignore=tests/control/test_HighContentScreeningGui.py): 1632 passed, 9 skipped, 1 xfailed. Merged firmware:pio run -e teensy41succeeds andpio test -e nativepasses 138/138.Supersedes
#623 and #624.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JRAcmjXX4CEN9wXSnp6HzK