Use ASCOM Gain Value mode only; fix NINA "Index was out of range" on connect (#8) - #9
Merged
Merged
Conversation
…connect Fujicom 3.0.0 exposed both ICameraV3 gain modes at once: Gain returned the ISO value while Gains also returned the list of fixed ISO values. Clients such as NINA treat a populated Gains list as authoritative, map it to indices, and read Gains[device.Gain] -> Gains[800], which throws ArgumentOutOfRangeException inside the client during connection (#8). Earlier releases avoided this only because their XSDK_CapSensitivity P/Invoke had the wrong signature, failed, and left Gains empty. - Gains now throws PropertyNotImplementedException; Gain is the ISO number bounded by GainMin/GainMax (Gain Value mode). - Gain set maps in-range values that fall between the camera's fixed ISO steps onto the nearest supported ISO instead of passing them to the SDK. - Add FujifilmCapabilities.NearestSensitivity with tests, plus a regression guard that the driver exposes exactly one gain mode. - Bump version to 3.0.1; add release notes and README clarification. Fixes #8 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5cJ7xcdK2my6cUFBhwPCi
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
Fixes #8 —
Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')when NINA connects to an X-T4 / X-H2S with Fujicom 3.0.0.Root cause. 3.0.0 exposed both ICameraV3 gain modes at once:
Gainreturned the ISO value (e.g. 800) whileGainsalso returned the 24-entry list of fixed ISO values. NINA treats a populatedGainslist as authoritative, maps it to indices, and readsGains[device.Gain]→Gains[800], which throws inside NINA during connection. The exception is NINA's (.NET 8(Parameter 'index')formatting), not the driver's, which is why the driver logs show a clean connect followed by a disconnect.2.x only avoided this because its
XSDK_CapSensitivityP/Invoke had a bogus extraint lDRparameter: the call failed, the ISO list stayed empty, and clients silently fell back to value mode. Correcting that signature in 3.0.0 exposed the latent contract violation.Fix. The driver now uses a single mode, ASCOM Gain Value:
Gain= ISO number,GainMin/GainMax= SDK-discovered range,GainsthrowsPropertyNotImplementedException.Gainset maps in-range values that fall between the camera's fixed ISO steps onto the nearest supported ISO (FujifilmCapabilities.NearestSensitivity) instead of passing an unsupported value to the SDK.GAIN; value mode givesGAIN=800, matching what 2.x users effectively had.Also: version → 3.0.1, release notes, README clarification, new core tests (nearest-ISO mapping + a regression guard that the COM-facing driver exposes exactly one gain mode).
Validation
dotnet run --project tests/Fujicom.Core.Tests).Fuji/Fuji.csprojcompiles on Linux with the same msbuild invocation CI uses.build/verify-sdk-interop.pypasses (25 XAPI exports, 7 LibRaw exports, 5 contracts).🤖 Generated with Claude Code
https://claude.ai/code/session_01S5cJ7xcdK2my6cUFBhwPCi