Skip to content

fix: XLight/Cicero filter wheel integration#497

Merged
Alpaca233 merged 1 commit into
Cephla-Lab:masterfrom
Alpaca233:feature/xlight-filter-wheel-fix
Feb 26, 2026
Merged

fix: XLight/Cicero filter wheel integration#497
Alpaca233 merged 1 commit into
Cephla-Lab:masterfrom
Alpaca233:feature/xlight-filter-wheel-fix

Conversation

@Alpaca233
Copy link
Copy Markdown
Collaborator

@Alpaca233 Alpaca233 commented Feb 26, 2026

Summary

  • Use emission_filter_position directly from channel config instead of broken wavelength-to-position mapping
  • Only create emission/dichroic dropdown widgets when hardware supports them (fixes orphan widgets on Cicero)
  • Use sleep_time_for_wheel for serial communication delays (fixes timeout errors)
  • Add XLIGHT_EMISSION_FILTER_POSITIONS config (5 for Cicero, 8 for XLight V3)
  • Improve serial response mismatch logging

Test plan

  • Test with Cicero hardware - verify emission filter wheel works
  • Test with XLight V3 hardware - verify both emission and dichroic wheels work
  • Verify no orphan dropdowns appear in spinning disk widget

🤖 Generated with Claude Code

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CrestOptics X-Light / Cicero spinning-disk integration by aligning UI and live control behavior with the actual hardware capabilities and by making serial timing/logging more robust.

Changes:

  • Updates the spinning disk widget to only create/connect emission/dichroic wheel controls when the connected hardware reports those capabilities.
  • Switches LiveController emission filter control to use emission_filter_position from the active channel configuration (removing the old wavelength→position mapping).
  • Uses sleep_time_for_wheel for XLight wheel serial read delays and improves serial response mismatch logging; adds XLIGHT_EMISSION_FILTER_POSITIONS config.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
software/control/widgets.py Conditionally creates/connects emission/dichroic dropdowns based on XLight capability flags; uses configurable emission wheel position count.
software/control/serial_peripherals.py Improves serial mismatch logging; changes XLight wheel command read delays to use sleep_time_for_wheel; changes default for disable_emission_filter_wheel.
software/control/microscope.py Adjusts XLight instantiation formatting (no behavioral change beyond updated XLight defaults).
software/control/core/live_controller.py Uses currentConfiguration.emission_filter_position directly for XLight emission wheel selection.
software/control/_def.py Removes obsolete wavelength→position mapping and adds XLIGHT_EMISSION_FILTER_POSITIONS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 351 to 355

if validate:
current_pos = self.serial_connection.write_and_check(
"B" + position_to_write + "\r", "B" + position_to_read, read_delay=0.01
"B" + position_to_write + "\r", "B" + position_to_read, read_delay=self.sleep_time_for_wheel
)
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_emission_filter() still hard-codes valid positions to 1–8, but the UI now uses XLIGHT_EMISSION_FILTER_POSITIONS (and _def.py documents 5 positions for Cicero). This means a misconfigured emission_filter_position > XLIGHT_EMISSION_FILTER_POSITIONS will pass validation and be sent to hardware, likely causing timeouts/misbehavior on 5-position devices. Consider validating against XLIGHT_EMISSION_FILTER_POSITIONS (or a device-specific max detected at runtime) and updating the error message accordingly so invalid configs fail fast.

Copilot uses AI. Check for mistakes.
- Use emission_filter_position directly from channel config instead of
  broken wavelength-to-position mapping
- Only create emission/dichroic dropdown widgets when hardware supports them
- Use sleep_time_for_wheel for serial communication delays
- Add XLIGHT_EMISSION_FILTER_POSITIONS config (5 for Cicero, 8 for V3)
- Improve serial response mismatch logging

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Alpaca233 Alpaca233 force-pushed the feature/xlight-filter-wheel-fix branch from fe02c5f to ad8eb51 Compare February 26, 2026 08:33
@Alpaca233 Alpaca233 merged commit 08ef8c5 into Cephla-Lab:master Feb 26, 2026
0 of 2 checks passed
@Alpaca233 Alpaca233 deleted the feature/xlight-filter-wheel-fix branch February 27, 2026 19:31
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.

2 participants