feat: Add camera resolution configuration support (#79)

This commit is contained in:
m-RNA 2025-01-12 21:29:05 +08:00 committed by GitHub
parent 0f0c7df2fc
commit 5c76e01c5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 3 deletions

View File

@ -46,6 +46,7 @@ build_flags =
'-DOTA_PASSWORD=${ota.otapassword}' ; Set the OTA password '-DOTA_PASSWORD=${ota.otapassword}' ; Set the OTA password
'-DOTA_LOGIN=${ota.otalogin}' '-DOTA_LOGIN=${ota.otalogin}'
'-DCAM_RESOLUTION=${cam.resolution}'
-O2 ; optimize for speed -O2 ; optimize for speed
-DASYNCWEBSERVER_REGEX ; enable regex in asyncwebserver -DASYNCWEBSERVER_REGEX ; enable regex in asyncwebserver

View File

@ -18,3 +18,6 @@ otapassword = "12345678"
[development] [development]
serial_flush_enabled = 0 serial_flush_enabled = 0
[cam]
resolution = FRAMESIZE_240X240

View File

@ -1,4 +1,5 @@
#include "project_config.hpp" #include "project_config.hpp"
#include "sensor.h"
ProjectConfig::ProjectConfig(const std::string& name, ProjectConfig::ProjectConfig(const std::string& name,
const std::string& mdnsName) const std::string& mdnsName)
@ -53,7 +54,7 @@ void ProjectConfig::initConfig() {
this->config.camera = { this->config.camera = {
.vflip = 0, .vflip = 0,
.href = 0, .href = 0,
.framesize = 4, .framesize = (uint8_t)CAM_RESOLUTION,
.quality = 7, .quality = 7,
.brightness = 2, .brightness = 2,
}; };
@ -200,7 +201,7 @@ void ProjectConfig::load() {
/* Camera Config */ /* Camera Config */
this->config.camera.vflip = getInt("vflip", 0); this->config.camera.vflip = getInt("vflip", 0);
this->config.camera.href = getInt("href", 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.quality = getInt("quality", 7);
this->config.camera.brightness = getInt("brightness", 2); this->config.camera.brightness = getInt("brightness", 2);

View File

@ -63,7 +63,7 @@ void CameraHandler::setupCameraPinout() {
void CameraHandler::setupBasicResolution() { void CameraHandler::setupBasicResolution() {
config.pixel_format = PIXFORMAT_JPEG; config.pixel_format = PIXFORMAT_JPEG;
config.frame_size = FRAMESIZE_240X240; config.frame_size = CAM_RESOLUTION;
if (!psramFound()) { if (!psramFound()) {
log_e("[Camera]: Did not find psram, setting lower image quality"); log_e("[Camera]: Did not find psram, setting lower image quality");