Skip to content

Conversation

@hongquanli
Copy link
Contributor

This pull request improves the robustness of the illumination control logic in live_controller.py by ensuring that illumination functions handle cases where the current configuration is not set, and by correctly sequencing illumination shutdown during mode changes. These updates help prevent errors and ensure that the correct illumination source is turned off when switching microscope modes.

Improvements to illumination control logic:

  • Added checks for self.currentConfiguration being None in both turn_on_illumination and turn_off_illumination to prevent errors when no configuration is set. [1] [2]
  • Modified the order of operations in set_microscope_mode to turn off illumination before updating self.currentConfiguration, ensuring the correct illumination source is deactivated when changing modes.

Copy link
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

This pull request fixes a critical bug in the illumination control logic where switching microscope modes would turn off the wrong illumination source. The fix ensures that the correct illumination channel is deactivated during mode transitions and adds defensive checks to prevent errors when no configuration is set.

Key changes:

  • Reordered operations in set_microscope_mode to turn off illumination before updating the configuration reference, ensuring the MCU's illumination_source points to the correct channel
  • Added None checks in turn_on_illumination and turn_off_illumination to handle cases where no configuration is set

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

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