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.
This commit is contained in:
yair 2025-11-16 06:27:51 +02:00
parent 969d716283
commit 6e1195c94c
3 changed files with 12 additions and 5 deletions

View File

@ -20,8 +20,9 @@ Start X absolute=0
Start Y absolute=0 Start Y absolute=0
Width=1224 Width=1224
Height=1026 Height=1026
Binning=3 Binning=0
Subsampling=0 # subsempling doesnt make image brighter. like binning
Subsampling=3
[Scaler] [Scaler]

View File

@ -11,7 +11,7 @@ Usage:
uv run scripts/camera_control.py # Get all camera settings (default) 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 get-all # Get all camera settings
uv run scripts/camera_control.py exposure # Get current exposure 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 # Get current framerate
uv run scripts/camera_control.py framerate 30 # Set framerate to 30fps uv run scripts/camera_control.py framerate 30 # Set framerate to 30fps
uv run scripts/camera_control.py gain # Get current gain 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 camera settings (default)
%(prog)s get-all # Get all camera settings %(prog)s get-all # Get all camera settings
%(prog)s exposure # Get current exposure %(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 # Get current framerate
%(prog)s framerate 30 # Set framerate to 30fps %(prog)s framerate 30 # Set framerate to 30fps
%(prog)s gain # Get current gain %(prog)s gain # Get current gain
@ -175,6 +175,12 @@ Examples:
# Set exposure # Set exposure
try: try:
exposure_value = float(args.value) 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}", success = simple_command(f"SET_EXPOSURE {exposure_value}",
f"Setting exposure to {exposure_value}ms", f"Setting exposure to {exposure_value}ms",
host=args.host, port=args.port, timeout=args.timeout) host=args.host, port=args.port, timeout=args.timeout)

View File

@ -237,7 +237,7 @@ class ControlServer:
try: try:
value = float(parts[1]) 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" return "ERROR OUT_OF_RANGE: Exposure must be 0.015-30000 milliseconds"
self.src.set_property("exposure", value) self.src.set_property("exposure", value)