Skip to content

Commit

Permalink
feat: Add camera resolution configuration support (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-RNA authored Jan 12, 2025
1 parent 0f0c7df commit 5c76e01
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions ESP/ini/dev_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ build_flags =

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

-O2 ; optimize for speed
-DASYNCWEBSERVER_REGEX ; enable regex in asyncwebserver
Expand Down
3 changes: 3 additions & 0 deletions ESP/ini/user_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ otapassword = "12345678"

[development]
serial_flush_enabled = 0

[cam]
resolution = FRAMESIZE_240X240
5 changes: 3 additions & 2 deletions ESP/lib/src/data/config/project_config.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "project_config.hpp"
#include "sensor.h"

ProjectConfig::ProjectConfig(const std::string& name,
const std::string& mdnsName)
Expand Down Expand Up @@ -53,7 +54,7 @@ void ProjectConfig::initConfig() {
this->config.camera = {
.vflip = 0,
.href = 0,
.framesize = 4,
.framesize = (uint8_t)CAM_RESOLUTION,
.quality = 7,
.brightness = 2,
};
Expand Down Expand Up @@ -200,7 +201,7 @@ void ProjectConfig::load() {
/* Camera Config */
this->config.camera.vflip = getInt("vflip", 0);
this->config.camera.href = getInt("href", 0);
this->config.camera.framesize = getInt("framesize", 4);
this->config.camera.framesize = getInt("framesize", (uint8_t)CAM_RESOLUTION);
this->config.camera.quality = getInt("quality", 7);
this->config.camera.brightness = getInt("brightness", 2);

Expand Down
2 changes: 1 addition & 1 deletion ESP/lib/src/io/camera/cameraHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void CameraHandler::setupCameraPinout() {

void CameraHandler::setupBasicResolution() {
config.pixel_format = PIXFORMAT_JPEG;
config.frame_size = FRAMESIZE_240X240;
config.frame_size = CAM_RESOLUTION;

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

0 comments on commit 5c76e01

Please sign in to comment.