Skip to content
This repository was archived by the owner on Dec 14, 2025. It is now read-only.

Commit 5c76e01

Browse files
authored
feat: Add camera resolution configuration support (#79)
1 parent 0f0c7df commit 5c76e01

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

ESP/ini/dev_config.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ build_flags =
4646

4747
'-DOTA_PASSWORD=${ota.otapassword}' ; Set the OTA password
4848
'-DOTA_LOGIN=${ota.otalogin}'
49+
'-DCAM_RESOLUTION=${cam.resolution}'
4950

5051
-O2 ; optimize for speed
5152
-DASYNCWEBSERVER_REGEX ; enable regex in asyncwebserver

ESP/ini/user_config.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ otapassword = "12345678"
1818

1919
[development]
2020
serial_flush_enabled = 0
21+
22+
[cam]
23+
resolution = FRAMESIZE_240X240

ESP/lib/src/data/config/project_config.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "project_config.hpp"
2+
#include "sensor.h"
23

34
ProjectConfig::ProjectConfig(const std::string& name,
45
const std::string& mdnsName)
@@ -53,7 +54,7 @@ void ProjectConfig::initConfig() {
5354
this->config.camera = {
5455
.vflip = 0,
5556
.href = 0,
56-
.framesize = 4,
57+
.framesize = (uint8_t)CAM_RESOLUTION,
5758
.quality = 7,
5859
.brightness = 2,
5960
};
@@ -200,7 +201,7 @@ void ProjectConfig::load() {
200201
/* Camera Config */
201202
this->config.camera.vflip = getInt("vflip", 0);
202203
this->config.camera.href = getInt("href", 0);
203-
this->config.camera.framesize = getInt("framesize", 4);
204+
this->config.camera.framesize = getInt("framesize", (uint8_t)CAM_RESOLUTION);
204205
this->config.camera.quality = getInt("quality", 7);
205206
this->config.camera.brightness = getInt("brightness", 2);
206207

ESP/lib/src/io/camera/cameraHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void CameraHandler::setupCameraPinout() {
6363

6464
void CameraHandler::setupBasicResolution() {
6565
config.pixel_format = PIXFORMAT_JPEG;
66-
config.frame_size = FRAMESIZE_240X240;
66+
config.frame_size = CAM_RESOLUTION;
6767

6868
if (!psramFound()) {
6969
log_e("[Camera]: Did not find psram, setting lower image quality");

0 commit comments

Comments
 (0)