Skip to content

DeviceAdapters: Add 3Z light source controller support#954

Open
TheSilencerPang wants to merge 3 commits into
micro-manager:mainfrom
TheSilencerPang:3z_light_source
Open

DeviceAdapters: Add 3Z light source controller support#954
TheSilencerPang wants to merge 3 commits into
micro-manager:mainfrom
TheSilencerPang:3z_light_source

Conversation

@TheSilencerPang

@TheSilencerPang TheSilencerPang commented Jun 2, 2026

Copy link
Copy Markdown

Description

This PR adds support for the 3Z light source (model: 3Z_Optics) to Micro-Manager 2.0.

Features supported

  • Intensity control
  • On/Off control
  • Multiple channels or presets

Hardware

  • Manufacturer: 3Z / 3ZOptics Co.,Ltd
  • Model: 3Z_Optics
  • Communication: USB / Serial / etc.

Testing

  • Tested on Windows 11 + Micro-Manager 2.0 (build 2026-06-02T06:25:50.278Z)
  • Successfully loads in Hardware Configuration Wizard
  • All basic functions tested and working

Additional information

  • Device adapter folder: DeviceAdapters/3Z_Optics
  • DLL: mmgr_dal_3Z_Optics.dll

Note to reviewers:
I have followed the existing device adapter style. Please let me know if any changes are needed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Windows device adapter module to support a 3Z Optics light source controller in the Micro-Manager DeviceAdapters collection, wiring it into the Visual Studio solution so it builds as a standard mmgr_dal_* adapter.

Changes:

  • Added a new 3Z_Optics device adapter project (VC++ project + filters) and registered it in micromanager.sln.
  • Implemented a Modbus/serial-based shutter device with per-channel on/off + intensity properties, plus a polling thread for status refresh.
  • Added adapter-specific configuration loading logic (via a models.json search) to determine channel list and brightness range.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
micromanager.sln Adds the new 3Z_Optics device adapter project to the solution and build configurations.
DeviceAdapters/3Z_Optics/3Z_Optics.vcxproj New VS project for building mmgr_dal_3Z_Optics (adapter build settings/configurations).
DeviceAdapters/3Z_Optics/3Z_Optics.vcxproj.filters VS filters for organizing the adapter source/header in Solution Explorer.
DeviceAdapters/3Z_Optics/3Z_Optics.h Declares the shutter controller, Modbus I/O helpers, and polling thread.
DeviceAdapters/3Z_Optics/3Z_Optics.cpp Implements module exports, Modbus protocol, device properties/actions, and polling behavior.

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

Comment thread micromanager.sln
Comment thread DeviceAdapters/3Z_Optics/3Z_Optics.cpp
Comment thread DeviceAdapters/3Z_Optics/3Z_Optics.cpp
Comment thread DeviceAdapters/3Z_Optics/3Z_Optics.cpp
Comment thread DeviceAdapters/3Z_Optics/3Z_Optics.cpp
Comment thread DeviceAdapters/3Z_Optics/3Z_Optics.cpp
Comment on lines +487 to +491
// 1. Try current working directory
possiblePaths.push_back("models.json");
possiblePaths.push_back("3z/models.json");

// 2. Try user Documents folder using Windows API

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The purpose of introducing models.json is to facilitate the addition of more device models in the future. This allows for model-specific optimizations to enhance the user experience in umanager, such as the display of channel labels for light sources. Even without this file, basic functionalities can still be utilized.

Comment thread DeviceAdapters/3Z_Optics/3Z_Optics.cpp
Comment thread DeviceAdapters/3Z_Optics/3Z_Optics.vcxproj
Comment thread DeviceAdapters/3Z_Optics/3Z_Optics.vcxproj Outdated
@nicost

nicost commented Jun 4, 2026

Copy link
Copy Markdown
Member

Looks very good! Could you have a look at the CoPilot comments and apply fixes as you see fit? I or @marktsuchida will then merge. Also, can you add a page describing the light source on https://micro-manager.org?

- Added MMThreadGuard to all property action handlers
- Protected ReadDeviceStateByMode, ReadCurrentDeviceState, etc.
- Fixed potential data race between polling thread and core thread
@TheSilencerPang

Copy link
Copy Markdown
Author

The newly submitted code has been optimized based on the comments from CoPilot.

@marktsuchida

Copy link
Copy Markdown
Member

Thank you for the updates. I'll merge this soon after some minor changes to the Visual Studio project files.

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.

4 participants