190 lines
7.7 KiB
C
190 lines
7.7 KiB
C
/**
|
|
* Claude's Eyes - Configuration Header
|
|
*
|
|
* Hardware: Waveshare ESP32-S3-Touch-LCD-2 + Freenove 4WD Car Kit
|
|
*
|
|
* WICHTIG: Die GPIO-Pins für Motoren/Servos/Sensoren müssen noch
|
|
* verifiziert werden, sobald die Hardware da ist!
|
|
*/
|
|
|
|
#ifndef CONFIG_H
|
|
#define CONFIG_H
|
|
|
|
// ============================================================================
|
|
// WiFi Configuration
|
|
// ============================================================================
|
|
#define WIFI_SSID "DEIN_WLAN_NAME"
|
|
#define WIFI_PASSWORD "DEIN_WLAN_PASSWORT"
|
|
|
|
// API Security
|
|
#define API_KEY "claudes_eyes_secret_2025"
|
|
|
|
// Webserver Port
|
|
#define WEBSERVER_PORT 80
|
|
|
|
// ============================================================================
|
|
// Camera Configuration (OV5640 on Waveshare ESP32-S3-Touch-LCD-2)
|
|
// ============================================================================
|
|
// 24-Pin Camera Interface on Waveshare board
|
|
#define CAMERA_PIN_PWDN -1 // Power down not used
|
|
#define CAMERA_PIN_RESET -1 // Reset not used
|
|
#define CAMERA_PIN_XCLK 15 // External clock
|
|
#define CAMERA_PIN_SIOD 4 // I2C SDA (SCCB)
|
|
#define CAMERA_PIN_SIOC 5 // I2C SCL (SCCB)
|
|
|
|
#define CAMERA_PIN_D7 16 // Data pins
|
|
#define CAMERA_PIN_D6 17
|
|
#define CAMERA_PIN_D5 18
|
|
#define CAMERA_PIN_D4 12 // Note: Might conflict with TFT_RST
|
|
#define CAMERA_PIN_D3 10 // Note: Might conflict with TFT_CS
|
|
#define CAMERA_PIN_D2 8
|
|
#define CAMERA_PIN_D1 9
|
|
#define CAMERA_PIN_D0 11 // Note: Might conflict with TFT_DC
|
|
|
|
#define CAMERA_PIN_VSYNC 6 // Vertical sync
|
|
#define CAMERA_PIN_HREF 7 // Horizontal reference
|
|
#define CAMERA_PIN_PCLK 13 // Pixel clock
|
|
|
|
// Camera settings
|
|
#define CAMERA_XCLK_FREQ 20000000 // 20MHz external clock
|
|
#define DEFAULT_JPEG_QUALITY 12 // 10-63, lower = better quality
|
|
#define DEFAULT_FRAME_SIZE FRAMESIZE_VGA // 640x480
|
|
|
|
// ============================================================================
|
|
// Motor Configuration (Freenove 4WD Car Kit)
|
|
// ============================================================================
|
|
// ACHTUNG: Diese Pins müssen noch mit dem Freenove Shield abgeglichen werden!
|
|
// Der Freenove Shield verwendet wahrscheinlich TB6612 oder L298N Motortreiber
|
|
|
|
// Motor A (linke Seite - 2 Motoren parallel)
|
|
#define MOTOR_A_IN1 39 // Direction pin 1
|
|
#define MOTOR_A_IN2 40 // Direction pin 2
|
|
#define MOTOR_A_PWM 41 // Speed control (PWM)
|
|
|
|
// Motor B (rechte Seite - 2 Motoren parallel)
|
|
#define MOTOR_B_IN1 42 // Direction pin 1
|
|
#define MOTOR_B_IN2 2 // Direction pin 2
|
|
#define MOTOR_B_PWM 1 // Speed control (PWM)
|
|
|
|
// PWM Configuration
|
|
#define MOTOR_PWM_FREQ 5000 // 5kHz PWM frequency
|
|
#define MOTOR_PWM_RESOLUTION 8 // 8-bit resolution (0-255)
|
|
#define MOTOR_PWM_CHANNEL_A 0 // LEDC channel for motor A
|
|
#define MOTOR_PWM_CHANNEL_B 1 // LEDC channel for motor B
|
|
|
|
// Speed limits
|
|
#define MOTOR_MAX_SPEED 255 // Maximum PWM value
|
|
#define MOTOR_MIN_SPEED 50 // Minimum PWM to overcome friction
|
|
#define DEFAULT_SPEED 150 // Default driving speed
|
|
|
|
// ============================================================================
|
|
// Servo Configuration (Pan/Tilt for Camera)
|
|
// ============================================================================
|
|
// Servos vom Freenove Kit
|
|
#define SERVO_PAN_PIN 38 // Horizontal rotation
|
|
#define SERVO_TILT_PIN 37 // Vertical rotation
|
|
|
|
// Servo limits (in degrees)
|
|
#define SERVO_PAN_MIN 0
|
|
#define SERVO_PAN_MAX 180
|
|
#define SERVO_PAN_CENTER 90
|
|
|
|
#define SERVO_TILT_MIN 30 // Don't go too far down
|
|
#define SERVO_TILT_MAX 150 // Don't go too far up
|
|
#define SERVO_TILT_CENTER 90
|
|
|
|
// Servo movement speed (degrees per step for smooth movement)
|
|
#define SERVO_STEP_DELAY_MS 15 // Delay between steps
|
|
#define SERVO_STEP_SIZE 2 // Degrees per step
|
|
|
|
// ============================================================================
|
|
// Ultrasonic Sensor (HC-SR04)
|
|
// ============================================================================
|
|
#define ULTRASONIC_TRIGGER_PIN 21
|
|
#define ULTRASONIC_ECHO_PIN 47
|
|
|
|
// Distance thresholds (in cm)
|
|
#define OBSTACLE_DANGER_DISTANCE 15 // Stop immediately
|
|
#define OBSTACLE_WARNING_DISTANCE 30 // Slow down
|
|
#define ULTRASONIC_MAX_DISTANCE 400 // Maximum measurable distance
|
|
|
|
// ============================================================================
|
|
// Display Configuration (Built-in on Waveshare)
|
|
// ============================================================================
|
|
// ST7789 240x320 display - pins defined in platformio.ini via TFT_eSPI
|
|
#define DISPLAY_WIDTH 240
|
|
#define DISPLAY_HEIGHT 320
|
|
#define DISPLAY_ROTATION 0 // 0, 1, 2, or 3
|
|
|
|
// Backlight
|
|
#define DISPLAY_BL_PIN 45
|
|
#define DISPLAY_BL_PWM_CHANNEL 2
|
|
|
|
// Colors (RGB565)
|
|
#define COLOR_BACKGROUND 0x0000 // Black
|
|
#define COLOR_TEXT 0xFFFF // White
|
|
#define COLOR_ACCENT 0x07FF // Cyan
|
|
#define COLOR_WARNING 0xFD20 // Orange
|
|
#define COLOR_DANGER 0xF800 // Red
|
|
#define COLOR_SUCCESS 0x07E0 // Green
|
|
|
|
// ============================================================================
|
|
// Touch Configuration (CST816S on Waveshare)
|
|
// ============================================================================
|
|
#define TOUCH_SDA_PIN 48
|
|
#define TOUCH_SCL_PIN 8
|
|
#define TOUCH_INT_PIN 3
|
|
#define TOUCH_RST_PIN -1 // Not connected
|
|
|
|
// ============================================================================
|
|
// IMU Configuration (QMI8658 on Waveshare)
|
|
// ============================================================================
|
|
#define IMU_SDA_PIN 48 // Shared with touch
|
|
#define IMU_SCL_PIN 8 // Shared with touch
|
|
#define IMU_INT1_PIN -1 // Not used
|
|
#define IMU_INT2_PIN -1 // Not used
|
|
|
|
// ============================================================================
|
|
// LED Matrix (Optional - from Freenove Kit)
|
|
// ============================================================================
|
|
#define LED_MATRIX_DIN_PIN 35
|
|
#define LED_MATRIX_CLK_PIN 36
|
|
#define LED_MATRIX_CS_PIN 0
|
|
|
|
// ============================================================================
|
|
// RGB LEDs (Optional - from Freenove Kit)
|
|
// ============================================================================
|
|
#define RGB_LED_PIN 48 // WS2812 data pin
|
|
#define RGB_LED_COUNT 4 // Number of LEDs
|
|
|
|
// ============================================================================
|
|
// System Configuration
|
|
// ============================================================================
|
|
// Task intervals (in milliseconds)
|
|
#define SENSOR_UPDATE_INTERVAL 100 // Read sensors every 100ms
|
|
#define DISPLAY_UPDATE_INTERVAL 250 // Update display 4x per second
|
|
#define STATUS_BROADCAST_INTERVAL 1000 // Broadcast status every second
|
|
|
|
// Safety
|
|
#define COMMAND_TIMEOUT_MS 5000 // Stop if no command for 5 seconds
|
|
#define MAX_CONTINUOUS_DRIVE_MS 30000 // Max 30 seconds continuous driving
|
|
|
|
// Debug
|
|
#define DEBUG_SERIAL true // Enable serial debug output
|
|
#define DEBUG_BAUD_RATE 115200
|
|
|
|
// ============================================================================
|
|
// Feature Toggles
|
|
// ============================================================================
|
|
#define ENABLE_CAMERA true
|
|
#define ENABLE_MOTORS true
|
|
#define ENABLE_SERVOS true
|
|
#define ENABLE_ULTRASONIC true
|
|
#define ENABLE_IMU true
|
|
#define ENABLE_DISPLAY true
|
|
#define ENABLE_TOUCH true
|
|
#define ENABLE_LED_MATRIX false // Disabled by default
|
|
#define ENABLE_RGB_LEDS false // Disabled by default
|
|
|
|
#endif // CONFIG_H
|