# Night Mode Configuration

# Light sensor thresholds
light_sensor:
  threshold_lux: 50              # Lux threshold for auto night mode
  hysteresis: 5                  # Hysteresis to prevent flickering (lux)
  smoothing_window: 5            # Number of samples to smooth over
  
  # Sensor sources (priority order)
  sources:
    - realsense_ir               # RealSense IR intensity
    - phone_ambient              # Phone ambient light sensor
    - camera_brightness          # Fallback: camera frame brightness

# Night mode parameters
night_mode:
  enabled: true
  motor_speed_percent: 50        # Reduce motor speed to 50%
  disable_tts: true              # Disable speaker TTS (face only)
  led_brightness_percent: 5      # Minimum LED brightness
  face_brightness_percent: 30    # Reduce face display brightness
  ir_tracking_only: true         # Use IR-based tracking only
  
  # Stealth LED pattern
  stealth_led:
    color: [0, 20, 80]           # Dim blue RGB
    pattern: "slow_dim"          # Slow breathing pattern
    speed: 0.3                   # Very slow animation (cycles/sec)
    enabled: true

# Manual overrides
overrides:
  voice_control: true            # Allow voice commands to toggle mode
  gamepad_control: true          # Allow gamepad button to toggle mode
  gamepad_button: "y"            # Gamepad button for toggle (x, y, a, b)

# Face control
face:
  display_only_in_night: true    # Show face in night mode instead of speaker
  brightness_reduction: 0.3      # Scale brightness to 30%
  contrast_boost: true           # Increase contrast for visibility
  
# Motor control
motors:
  night_mode_speed_reduction: 0.5  # 50% of normal speed
  acceleration_limit: 1.0        # Smooth acceleration in night mode
  deceleration_limit: 0.8        # Conservative braking

# TTS control
tts:
  disabled_in_night: true
  fallback_to_face: true         # Show text on face instead
  volume_in_night: 0             # Muted in night mode

# Tracking parameters
tracking:
  ir_only: true                  # Use IR cameras for tracking
  disable_rgb: true              # Don't use RGB cameras
  ir_sensitivity: 0.8            # IR detection sensitivity
  tracking_confidence: 0.6       # Minimum tracking confidence

# Detection ranges
detection:
  detection_range: 5.0           # Meters
  tracking_range: 3.0            # Meters (closer in IR mode)
  ir_range_boost: 1.2            # Boost range with IR (x1.2)

# Publishing
publications:
  night_mode_state: "/saltybot/night_mode"
  motor_override: "/saltybot/motor_speed_override"
  tts_override: "/saltybot/tts_disable"
  face_control: "/saltybot/face_control"
  led_override: "/saltybot/led_brightness_override"

# Subscriptions
subscriptions:
  light_level: "/saltybot/light_level"
  realsense_ir: "/camera/ir/image_raw"
  phone_sensor: "/phone/ambient_light"
  voice_command: "/saltybot/voice/command"
  gamepad_input: "/saltybot/gamepad/input"

# Transition timing
transitions:
  fade_duration: 1.0             # Seconds to fade between modes
  motor_ramp_time: 2.0           # Seconds to ramp motor speed
  led_fade_time: 0.5             # Seconds to fade LED brightness
