Millennia eV: status snapshot + preserve init error#98
Merged
Conversation
Two small gaps on the eV driver that pushed work into downstream callers:
* doInitializeDevice caught the failure and raised a bare
PhysicalDevice.UnableToInitialize(), discarding the underlying
serial error. Callers could no longer tell a busy port ("[Errno 16]
Resource busy") from a missing one. Now re-raises
UnableToInitialize(error) from error so the cause is preserved.
* MillenniaEv25Device did not override doGetStatusUserInfo(), so the
base returned None and PhysicalDevice.startBackgroundStatusUpdates()
posted empty status notifications for the eV. Added an override
returning {power, isLaserOn, isShutterOpen} — a one-call snapshot for
background monitoring and for GUI polling.
Adds a debug-device test for the status snapshot.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K6LVhfM3d9CcJdkuSMMqag
dccote
added a commit
to DCC-Lab/MilleniaUI
that referenced
this pull request
Jun 27, 2026
…ved init error Builds on DCC-Lab/PyHardwareLibrary#98: * _poll_once now takes a single snapshot via device.doGetStatusUserInfo() instead of three separate isLaserOn/isShutterOpen/power queries, with a fallback to the individual queries for libraries without the eV status hook. * Connecting no longer does a pre-flight probe_port(): it just opens the device, and the new _connection_message() reads the now-preserved serial error off the exception chain to explain busy / missing / permission. A one-shot probe remains only as a fallback for older library versions and to gate auto-reconnect attempts. Shared the serial-error keyword classification (serial_reason) and added exception_chain_text. Behaviour verified headlessly against both the current installed library (fallback path) and the updated library (primary path). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K6LVhfM3d9CcJdkuSMMqag
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.
Two small gaps on the
MillenniaEv25Devicedriver that currently push logic into downstream callers (found while building a GUI on top of it).1. Preserve the underlying init error
doInitializeDevicecaught any failure and raised a barePhysicalDevice.UnableToInitialize(), discarding the originalserial.SerialException. A caller could no longer distinguish a busy port ([Errno 16] Resource busy, e.g. the port held by another app) from a missing one — the GUI had to re-open the port itself just to classify the error. Now:so the cause is preserved through the exception chain.
2. Implement
doGetStatusUserInfo()for the eVThe framework already ships background monitoring (
startBackgroundStatusUpdates()→PhysicalDeviceNotification.statusviaNotificationCenter), butMillenniaEv25Devicedidn't overridedoGetStatusUserInfo(), so the base returnedNoneand the monitoring loop posted empty status for this device. Added an override returning a one-call snapshot:{"power": ..., "isLaserOn": ..., "isShutterOpen": ...}usable both by the background loop and by GUI polling.
Tests
Adds
testStatusUserInfoSnapshotsPowerOnOffAndShutterto the debug-device suite; allTestDebugMillenniaEv25Devicetests pass. No API breakage — both changes are additive/behaviour-preserving on success.🤖 Generated with Claude Code