From 721e825daaaca67c274fd185ad1daf2862b09f39 Mon Sep 17 00:00:00 2001 From: 15498th Date: Sat, 18 Dec 2021 14:29:43 +0300 Subject: [PATCH] Use better name for framerate limit variables. --- API.md | 2 +- app_httpd.cpp | 8 ++++---- esp32-cam-webserver.ino | 6 +++--- index_ov2640.h | 16 ++++++++-------- index_ov3660.h | 16 ++++++++-------- myconfig.sample.h | 4 ++-- storage.cpp | 6 +++--- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/API.md b/API.md index 9a434f2..f7d1640 100644 --- a/API.md +++ b/API.md @@ -26,7 +26,7 @@ Call `/control?var=&val=` with a settings key and value to set camera ``` lamp - Lamp value in percent; integer, 0 - 100 (-1 = disabled) framesize - See below -framerate_limit - Minimal frame duration in ms, used to limit max FPS. Must be positive integer +min_frame_time - Minimal frame duration in ms, used to limit max FPS. Must be positive integer quality - 10 to 63 (ov3660: 4 to 10) contrast - -2 to 2 (ov3660: -3 to 3) brightness - -2 to 2 (ov3660: -3 to 3) diff --git a/app_httpd.cpp b/app_httpd.cpp index 8280983..2026c4b 100644 --- a/app_httpd.cpp +++ b/app_httpd.cpp @@ -52,7 +52,7 @@ extern int8_t streamCount; extern unsigned long streamsServed; extern unsigned long imagesServed; extern int myRotation; -extern int framerateLimit; +extern int minFrameTime; extern int lampVal; extern bool autoLamp; extern bool filesystem; @@ -276,7 +276,7 @@ static esp_err_t stream_handler(httpd_req_t *req){ } int64_t frame_time = esp_timer_get_time() - last_frame; frame_time /= 1000; - int32_t frame_delay = (framerateLimit > frame_time) ? framerateLimit - frame_time : 0; + int32_t frame_delay = (minFrameTime > frame_time) ? minFrameTime - frame_time : 0; delay(frame_delay); if (debugData) { @@ -359,7 +359,7 @@ static esp_err_t cmd_handler(httpd_req_t *req){ else if(!strcmp(variable, "wb_mode")) res = s->set_wb_mode(s, val); else if(!strcmp(variable, "ae_level")) res = s->set_ae_level(s, val); else if(!strcmp(variable, "rotate")) myRotation = val; - else if(!strcmp(variable, "framerate_limit")) framerateLimit = val; + else if(!strcmp(variable, "min_frame_time")) minFrameTime = val; else if(!strcmp(variable, "autolamp") && (lampVal != -1)) { autoLamp = val; if (autoLamp) { @@ -415,7 +415,7 @@ static esp_err_t status_handler(httpd_req_t *req){ *p++ = '{'; p+=sprintf(p, "\"lamp\":%d,", lampVal); p+=sprintf(p, "\"autolamp\":%d,", autoLamp); - p+=sprintf(p, "\"framerate_limit\":%d,", framerateLimit); + p+=sprintf(p, "\"min_frame_time\":%d,", minFrameTime); p+=sprintf(p, "\"framesize\":%u,", s->status.framesize); p+=sprintf(p, "\"quality\":%u,", s->status.quality); p+=sprintf(p, "\"brightness\":%d,", s->status.brightness); diff --git a/esp32-cam-webserver.ino b/esp32-cam-webserver.ino index 50a5dc2..06a0eb8 100644 --- a/esp32-cam-webserver.ino +++ b/esp32-cam-webserver.ino @@ -148,10 +148,10 @@ char myVer[] PROGMEM = __DATE__ " @ " __TIME__; int myRotation = CAM_ROTATION; // minimal frame duration in ms, effectively 1/maxFPS -#if !defined(FRAMERATE_LIMIT) - #define FRAMERATE_LIMIT 0 +#if !defined(MIN_FRAME_TIME) + #define MIN_FRAME_TIME 0 #endif -int framerateLimit = FRAMERATE_LIMIT; +int minFrameTime = MIN_FRAME_TIME; // Illumination LAMP and status LED #if defined(LAMP_DISABLE) diff --git a/index_ov2640.h b/index_ov2640.h index 49a4980..1195f70 100644 --- a/index_ov2640.h +++ b/index_ov2640.h @@ -237,9 +237,9 @@ const uint8_t index_ov2640_html[] = R"=====( -
- - @@ -310,7 +310,7 @@ const uint8_t index_ov2640_html[] = R"=====( const savePrefsButton = document.getElementById('save_prefs') const clearPrefsButton = document.getElementById('clear_prefs') const rebootButton = document.getElementById('reboot') - const framerateLimit = document.getElementById('framerate_limit') + const minFrameTime = document.getElementById('min_frame_time') const hide = el => { el.classList.add('hidden') @@ -374,8 +374,8 @@ const uint8_t index_ov2640_html[] = R"=====( } else if(el.id === "rotate"){ rotate.value = value; applyRotation(); - } else if(el.id === "framerate_limit"){ - framerate_limit.value = value; + } else if(el.id === "min_frame_time"){ + min_frame_time.value = value; } else if(el.id === "stream_url"){ streamURL = value; viewerURL = value + 'view'; @@ -579,8 +579,8 @@ const uint8_t index_ov2640_html[] = R"=====( updateConfig(framesize) } - framerateLimit.onchange = () => { - updateConfig(framerateLimit) + minFrameTime.onchange = () => { + updateConfig(minFrameTime) } swapButton.onclick = () => { diff --git a/index_ov3660.h b/index_ov3660.h index ef33baa..e28ceaa 100644 --- a/index_ov3660.h +++ b/index_ov3660.h @@ -251,9 +251,9 @@ const uint8_t index_ov3660_html[] = R"=====(
-
- - @@ -324,7 +324,7 @@ const uint8_t index_ov3660_html[] = R"=====( const savePrefsButton = document.getElementById('save_prefs') const clearPrefsButton = document.getElementById('clear_prefs') const rebootButton = document.getElementById('reboot') - const framerateLimit = document.getElementById('framerate_limit') + const minFrameTime = document.getElementById('min_frame_time') const hide = el => { el.classList.add('hidden') @@ -386,8 +386,8 @@ const uint8_t index_ov3660_html[] = R"=====( } else if(el.id === "rotate"){ rotate.value = value; applyRotation(); - } else if(el.id === "framerate_limit"){ - framerate_limit.value = value; + } else if(el.id === "min_frame_time"){ + min_frame_time.value = value; } else if(el.id === "stream_url"){ streamURL = value; viewerURL = value + 'view'; @@ -588,8 +588,8 @@ const uint8_t index_ov3660_html[] = R"=====( updateConfig(framesize) } - framerateLimit.onchange = () => { - updateConfig(framerateLimit) + minFrameTime.onchange = () => { + updateConfig(minFrameTime) } swapButton.onclick = () => { diff --git a/myconfig.sample.h b/myconfig.sample.h index f40dcdb..5958b62 100644 --- a/myconfig.sample.h +++ b/myconfig.sample.h @@ -144,8 +144,8 @@ struct station stationList[] = {{"ssid1", "pass1", true}, // #define CAM_ROTATION 0 // Minimal frame duration in ms, used to limit max FPS -// max_fps = 1000/framerate_limit -// #define FRAMERATE_LIMIT 500 +// max_fps = 1000/min_frame_time +// #define MIN_FRAME_TIME 500 /* * Additional Features diff --git a/storage.cpp b/storage.cpp index c463c97..1e202f1 100644 --- a/storage.cpp +++ b/storage.cpp @@ -7,7 +7,7 @@ extern void flashLED(int flashtime); extern int myRotation; // Rotation extern int lampVal; // The current Lamp value extern int autoLamp; // Automatic lamp mode -extern int framerateLimit; // Minimal frame duration +extern int minFrameTime; // Minimal frame duration /* * Useful utility when debugging... @@ -91,7 +91,7 @@ void loadPrefs(fs::FS &fs){ // process all the settings lampVal = jsonExtract(prefs, "lamp").toInt(); autoLamp = jsonExtract(prefs, "autolamp").toInt(); - framerateLimit = jsonExtract(prefs, "framerate_limit").toInt(); + minFrameTime = jsonExtract(prefs, "min_frame_time").toInt(); s->set_framesize(s, (framesize_t)jsonExtract(prefs, "framesize").toInt()); s->set_quality(s, jsonExtract(prefs, "quality").toInt()); s->set_brightness(s, jsonExtract(prefs, "brightness").toInt()); @@ -138,7 +138,7 @@ void savePrefs(fs::FS &fs){ *p++ = '{'; p+=sprintf(p, "\"lamp\":%i,", lampVal); p+=sprintf(p, "\"autolamp\":%u,", autoLamp); - p+=sprintf(p, "\"framerate_limit\":%d,", framerateLimit); + p+=sprintf(p, "\"min_frame_time\":%d,", minFrameTime); p+=sprintf(p, "\"framesize\":%u,", s->status.framesize); p+=sprintf(p, "\"quality\":%u,", s->status.quality); p+=sprintf(p, "\"brightness\":%d,", s->status.brightness);