From 6e1195c94c4f7865470b02614213268fc1e8aa5e Mon Sep 17 00:00:00 2001 From: yair Date: Sun, 16 Nov 2025 06:27:51 +0200 Subject: [PATCH] refine: improve exposure control precision and validation - Lower minimum exposure from 1.0ms to 0.015ms in launch-ids.py validation - Add exposure range validation (0.015-30000ms) to camera_control.py - Update help text to display exposure range for better user guidance - Adjust camera config: swap binning/subsampling values in nightcolor preset - Add comment explaining subsampling vs binning behavior Enhances exposure control granularity and provides clearer validation feedback while optimizing camera configuration for low-light scenarios. --- ...ole-presacler64_autoexp-binningx2_nightcolor2ms.ini | 5 +++-- scripts/camera_control.py | 10 ++++++++-- scripts/launch-ids.py | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ini/whole-presacler64_autoexp-binningx2_nightcolor2ms.ini b/ini/whole-presacler64_autoexp-binningx2_nightcolor2ms.ini index ab41d70..4abaf50 100644 --- a/ini/whole-presacler64_autoexp-binningx2_nightcolor2ms.ini +++ b/ini/whole-presacler64_autoexp-binningx2_nightcolor2ms.ini @@ -20,8 +20,9 @@ Start X absolute=0 Start Y absolute=0 Width=1224 Height=1026 -Binning=3 -Subsampling=0 +Binning=0 +# subsempling doesnt make image brighter. like binning +Subsampling=3 [Scaler] diff --git a/scripts/camera_control.py b/scripts/camera_control.py index 0381623..be22490 100644 --- a/scripts/camera_control.py +++ b/scripts/camera_control.py @@ -11,7 +11,7 @@ Usage: uv run scripts/camera_control.py # Get all camera settings (default) uv run scripts/camera_control.py get-all # Get all camera settings uv run scripts/camera_control.py exposure # Get current exposure - uv run scripts/camera_control.py exposure 10 # Set exposure to 10ms + uv run scripts/camera_control.py exposure 10 # Set exposure to 10ms (range: 0.015-30000ms) uv run scripts/camera_control.py framerate # Get current framerate uv run scripts/camera_control.py framerate 30 # Set framerate to 30fps uv run scripts/camera_control.py gain # Get current gain @@ -107,7 +107,7 @@ Examples: %(prog)s # Get all camera settings (default) %(prog)s get-all # Get all camera settings %(prog)s exposure # Get current exposure - %(prog)s exposure 10 # Set exposure to 10ms + %(prog)s exposure 10 # Set exposure to 10ms (range: 0.015-30000ms) %(prog)s framerate # Get current framerate %(prog)s framerate 30 # Set framerate to 30fps %(prog)s gain # Get current gain @@ -175,6 +175,12 @@ Examples: # Set exposure try: exposure_value = float(args.value) + if exposure_value < 0.015: + print(f"Error: Exposure must be at least 0.015ms (requested: {exposure_value}ms)") + sys.exit(1) + if exposure_value > 30000: + print(f"Error: Exposure must be at most 30000ms (requested: {exposure_value}ms)") + sys.exit(1) success = simple_command(f"SET_EXPOSURE {exposure_value}", f"Setting exposure to {exposure_value}ms", host=args.host, port=args.port, timeout=args.timeout) diff --git a/scripts/launch-ids.py b/scripts/launch-ids.py index 1f27ee7..6b708be 100644 --- a/scripts/launch-ids.py +++ b/scripts/launch-ids.py @@ -237,7 +237,7 @@ class ControlServer: try: value = float(parts[1]) - if value < 1.0 or value > 30000: + if value < 0.015 or value > 30000: return "ERROR OUT_OF_RANGE: Exposure must be 0.015-30000 milliseconds" self.src.set_property("exposure", value)