Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
Loading...
Searching...
No Matches
camera.h
1
9#pragma once
10
11#include "esp_camera.h"
12#include "pins.h" // Camera bus GPIOs (pins::CAM_*)
13
14typedef struct {
15 void* buffer;
16 size_t length;
17 size_t width;
18 size_t height;
20
28class Camera
29{
30private:
31 camera_config_t _config;
32
33public:
47 {
48 this->_config.ledc_channel = LEDC_CHANNEL_0;
49 this->_config.ledc_timer = LEDC_TIMER_0;
50 this->_config.pin_d0 = pins::CAM_Y2;
51 this->_config.pin_d1 = pins::CAM_Y3;
52 this->_config.pin_d2 = pins::CAM_Y4;
53 this->_config.pin_d3 = pins::CAM_Y5;
54 this->_config.pin_d4 = pins::CAM_Y6;
55 this->_config.pin_d5 = pins::CAM_Y7;
56 this->_config.pin_d6 = pins::CAM_Y8;
57 this->_config.pin_d7 = pins::CAM_Y9;
58 this->_config.pin_xclk = pins::CAM_XCLK;
59 this->_config.pin_pclk = pins::CAM_PCLK;
60 this->_config.pin_vsync = pins::CAM_VSYNC;
61 this->_config.pin_href = pins::CAM_HREF;
62 this->_config.pin_sccb_sda = pins::CAM_SIOD;
63 this->_config.pin_sccb_scl = pins::CAM_SIOC;
64 this->_config.pin_pwdn = pins::CAM_PWDN;
65 this->_config.pin_reset = pins::CAM_RESET;
66
67 this->_config.xclk_freq_hz = 12000000; // not 20 MHz: it cripples WiFi (docs/engineering-notes.md section 3)
68 this->_config.pixel_format = PIXFORMAT_JPEG; // the /stream WebSocket sends JPEG frames as they are
69 this->_config.frame_size = FRAMESIZE_QVGA; // 320x240
70 // 0-63, lower = bigger files. 18 keeps heavy-scene frames small enough for the detection decode budget and
71 // WiFi; 12 made close-up scenes 2.5-4x bigger (measured 2026-10-13).
72 this->_config.jpeg_quality = 18;
73 this->_config.fb_count = 2; // the driver fills one buffer while the camera task copies the other
74 this->_config.fb_location = CAMERA_FB_IN_PSRAM;
75 this->_config.grab_mode = CAMERA_GRAB_LATEST;
76 }
77
83 bool begin();
85};
Camera setup and sensor tuning.
Definition camera.h:29
Camera()
Constructor: Pre-configures the sensor for optimal CV performance.
Definition camera.h:46
bool begin()
Initializes the hardware and mounts the sensor.
Definition camera.cpp:8
Single source of truth for every GPIO the turret uses.
Definition camera.h:14