Skip to content

feat: Add global reset mode for Toupcam and Hamamatsu cameras#504

Open
hongquanli wants to merge 6 commits intomasterfrom
worktree-floating-painting-liskov
Open

feat: Add global reset mode for Toupcam and Hamamatsu cameras#504
hongquanli wants to merge 6 commits intomasterfrom
worktree-floating-painting-liskov

Conversation

@hongquanli
Copy link
Contributor

Summary

  • Add use_global_reset_mode config option to CameraConfig for enabling global shutter mode
  • Implement supports_global_reset_mode() and set_global_reset_mode(enabled) on AbstractCamera with safe defaults (returns False / logs warning) so all 5+ camera drivers work without changes
  • Override in Toupcam (checks TOUPCAM_FLAG_GLOBALSHUTTER, sets TOUPCAM_OPTION_GLOBAL_RESET_MODE, zeroes strobe delay) and Hamamatsu (sets DCAM_IDPROP.SHUTTER_MODE, queries SDK for strobe values)
  • Add GUI checkbox in Settings > Advanced > Hardware Configuration (requires restart)
  • Load/save setting from INI config file ([GENERAL] use_global_reset_mode)

Test plan

  • Existing tests pass (1114 passed, 0 new failures)
  • Test with Toupcam hardware: enable global reset, verify strobe delay is 0
  • Test with Hamamatsu hardware: enable global reset, verify SDK reports correct strobe values (check debug logs)
  • Test with camera that doesn't support global reset: verify warning is logged and rolling shutter continues
  • Verify Settings checkbox persists across app restarts

🤖 Generated with Claude Code

hongquanli and others added 6 commits February 28, 2026 19:22
Add use_global_reset_mode config option to CameraConfig that enables
global shutter mode on supported cameras. For Toupcam, this sets
TOUPCAM_OPTION_GLOBAL_RESET_MODE and returns zero strobe delay. For
Hamamatsu, this sets DCAM SHUTTER_MODE to GLOBAL with debug logging
for strobe time verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add GUI checkbox in Settings > Advanced > Hardware Configuration to
toggle global reset mode. The setting is saved to the INI config and
loaded on startup, requiring app restart to take effect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…vers

Extract global reset logic into a public method on both camera drivers
so it can be called at runtime without requiring app restart. The init
code now delegates to this method. Toupcam recalculates strobe timing
after toggling; Hamamatsu recalculates exposure time to pick up new
SDK-reported strobe values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add default implementations of supports_global_reset_mode() and
set_global_reset_mode() to AbstractCamera. Default returns False /
logs warning, so cameras that don't support it need no changes.
Toupcam checks the GLOBALSHUTTER hardware flag; Hamamatsu queries
the SHUTTER_MODE property from the DCAM SDK.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
trigger_delay_us is not necessarily 0 in global reset mode (e.g.
Hamamatsu has ~3x row time delay). Only strobe_time_us (rolling
readout delay) should be zeroed. The trigger_delay_us calculation
is kept but may need refinement after checking Toupcam global reset
docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
INTERNAL_LINEINTERVAL is a sensor property that doesn't change with
shutter mode. In global reset mode, the rolling readout delay
(line_interval * height) doesn't apply since all rows expose
simultaneously. Only TRIGGERDELAY is used for strobe timing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant