-
Notifications
You must be signed in to change notification settings - Fork 50
feat: Add hardware trigger mode setting to Settings > Advanced #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
fd2decf
6d0ab9d
8ec8c60
3e14022
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |||||
| from control.microcontroller import Microcontroller | ||||||
| from squid.abc import CameraAcquisitionMode, AbstractCamera | ||||||
|
|
||||||
| import control._def | ||||||
| from control._def import * | ||||||
|
||||||
| from control._def import * | |
| from control._def import TriggerMode |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1346,6 +1346,28 @@ def _create_advanced_tab(self): | |||||||||||||||||||||
| self.illumination_factor.setValue(self._get_config_float("GENERAL", "illumination_intensity_factor", 0.6)) | ||||||||||||||||||||||
| hw_layout.addRow("Illumination Intensity Factor:", self.illumination_factor) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| self.hw_trigger_mode_combo = QComboBox() | ||||||||||||||||||||||
| for member in HardwareTriggerMode: | ||||||||||||||||||||||
| self.hw_trigger_mode_combo.addItem(member.name.title(), member.value) | ||||||||||||||||||||||
| self.hw_trigger_mode_combo.setToolTip( | ||||||||||||||||||||||
| "Edge: Fixed pulse width (TRIGGER_PULSE_LENGTH_us)\n" "Level: Variable pulse width (illumination_on_time)" | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| try: | ||||||||||||||||||||||
| hw_trigger_value = HardwareTriggerMode(self._get_config_int("GENERAL", "hardware_trigger_mode", 0)) | ||||||||||||||||||||||
| except ValueError: | ||||||||||||||||||||||
|
Comment on lines
+1356
to
+1357
|
||||||||||||||||||||||
| hw_trigger_value = HardwareTriggerMode(self._get_config_int("GENERAL", "hardware_trigger_mode", 0)) | |
| except ValueError: | |
| hw_trigger_value = HardwareTriggerMode( | |
| self._get_config_int("GENERAL", "hardware_trigger_mode", 0) | |
| ) | |
| except (ValueError, TypeError): | |
| logger.warning( | |
| "Invalid 'hardware_trigger_mode' value in config; defaulting to EDGE.", | |
| exc_info=True, | |
| ) |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
control._def.HARDWARE_TRIGGER_MODE is updated before the config file write succeeds. If saving fails (caught later), the app's runtime trigger mode will still change even though the user was told the settings could not be saved. Consider moving this runtime update into _apply_live_settings() (which runs after a successful write) or otherwise only mutating _def after the file save completes.
| control._def.HARDWARE_TRIGGER_MODE = HardwareTriggerMode(self.hw_trigger_mode_combo.currentIndex()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern as in
live_controller.py: this file importscontrol._deffor runtime access but also keepsfrom control._def import *, which pulls a staleHARDWARE_TRIGGER_MODEinto the local namespace. Consider switching away from the wildcard import (or otherwise preventing accidental use of the local binding) to avoid reintroducing the original bug later.