Add Coherent FieldMaster GS power meter driver#101
Merged
Conversation
Problem: The lab's Coherent FieldMaster GS laser power/energy meter connects over RS-232 through a generic FTDI adaptor and had no driver. The meter has several non-obvious operational constraints (it only answers RS-232 from its Home/Trend screen, and its message terminator is a front-panel Menu setting) that make it easy to get wrong. Solution: Add FieldMasterDevice, a PowerMeterDevice subclass driven through the library's SerialPort primitives, plus a hardware-free DebugFieldMasterDevice and a test file (debug tests always run; hardware tests skipTest when the meter is absent or not on its Home screen). Protocol verified against real hardware: 9600 8N1, no handshaking (3-wire), configurable terminator routed through the port's terminator, pw?/en?/wv?/v commands. Wavelength is exposed in nanometres (family convention) and converted to metres on the wire. The FieldMaster GS manual is added under hardwarelibrary/manuals/ and the change is recorded in CHANGELOG.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem: The FieldMaster's message terminator (LF/CR/CR-LF) is a front-panel Menu setting. Hardcoding it meant a unit whose Menu differed from the driver's assumption would silently fail to initialize even though it was connected and on its Home screen. Solution: doInitializeDevice now probes for the terminator. It tries the configured terminator first (default LF), then the remaining candidates, clearing the meter's line buffer between attempts, and keeps the first one that draws a reply on the port. Only when none replies does it raise the Home-screen hint. Verified on hardware: a deliberately wrong default falls through to the working terminator and still reads power. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Adds a driver for the Coherent FieldMaster GS laser power/energy meter, which connects over RS-232 through a generic FTDI adaptor. Verified end-to-end against real hardware (reads ~4.6 W from an LM-10 thermopile head).
FieldMasterDevice—PowerMeterDevicesubclass driven through the library'sSerialPortprimitives.DebugFieldMasterDevice— hardware-free stub (classIdVendor=0xFFFF,classIdProduct=0xFFF1).tests/testFieldMasterDevice.py— 6 debug tests (always run) + 2 hardware tests (skipTestwhen the meter is absent / not on its Home screen).hardwarelibrary/manuals/.CHANGELOG.mdentry under Unreleased.Protocol (verified)
pw?(power, W),en?(energy, J),wv?/wv <m>(wavelength),v(version).Two operational constraints worth knowing
doInitializeDeviceprobes on connect and raises with that hint. (Do not send ith/q— they navigate it off Home and wedge the serial firmware until a power cycle.)terminator=(defaultb'\n'); it is applied toport.terminator, which both reads and writes use, so they stay in sync with the meter's Menu.Usage
Test plan
pytest hardwarelibrary/tests/testFieldMasterDevice.py→ 6 passed, 2 skipped (no/absent hardware)🤖 Generated with Claude Code