Use better name for framerate limit variables.

This commit is contained in:
15498th 2021-12-18 14:29:43 +03:00
parent 69888bd6d8
commit 721e825daa
7 changed files with 29 additions and 29 deletions

2
API.md
View File

@ -26,7 +26,7 @@ Call `/control?var=<key>&val=<val>` with a settings key and value to set camera
``` ```
lamp - Lamp value in percent; integer, 0 - 100 (-1 = disabled) lamp - Lamp value in percent; integer, 0 - 100 (-1 = disabled)
framesize - See below 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) quality - 10 to 63 (ov3660: 4 to 10)
contrast - -2 to 2 (ov3660: -3 to 3) contrast - -2 to 2 (ov3660: -3 to 3)
brightness - -2 to 2 (ov3660: -3 to 3) brightness - -2 to 2 (ov3660: -3 to 3)

View File

@ -52,7 +52,7 @@ extern int8_t streamCount;
extern unsigned long streamsServed; extern unsigned long streamsServed;
extern unsigned long imagesServed; extern unsigned long imagesServed;
extern int myRotation; extern int myRotation;
extern int framerateLimit; extern int minFrameTime;
extern int lampVal; extern int lampVal;
extern bool autoLamp; extern bool autoLamp;
extern bool filesystem; 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; int64_t frame_time = esp_timer_get_time() - last_frame;
frame_time /= 1000; 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); delay(frame_delay);
if (debugData) { 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, "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, "ae_level")) res = s->set_ae_level(s, val);
else if(!strcmp(variable, "rotate")) myRotation = 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)) { else if(!strcmp(variable, "autolamp") && (lampVal != -1)) {
autoLamp = val; autoLamp = val;
if (autoLamp) { if (autoLamp) {
@ -415,7 +415,7 @@ static esp_err_t status_handler(httpd_req_t *req){
*p++ = '{'; *p++ = '{';
p+=sprintf(p, "\"lamp\":%d,", lampVal); p+=sprintf(p, "\"lamp\":%d,", lampVal);
p+=sprintf(p, "\"autolamp\":%d,", autoLamp); 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, "\"framesize\":%u,", s->status.framesize);
p+=sprintf(p, "\"quality\":%u,", s->status.quality); p+=sprintf(p, "\"quality\":%u,", s->status.quality);
p+=sprintf(p, "\"brightness\":%d,", s->status.brightness); p+=sprintf(p, "\"brightness\":%d,", s->status.brightness);

View File

@ -148,10 +148,10 @@ char myVer[] PROGMEM = __DATE__ " @ " __TIME__;
int myRotation = CAM_ROTATION; int myRotation = CAM_ROTATION;
// minimal frame duration in ms, effectively 1/maxFPS // minimal frame duration in ms, effectively 1/maxFPS
#if !defined(FRAMERATE_LIMIT) #if !defined(MIN_FRAME_TIME)
#define FRAMERATE_LIMIT 0 #define MIN_FRAME_TIME 0
#endif #endif
int framerateLimit = FRAMERATE_LIMIT; int minFrameTime = MIN_FRAME_TIME;
// Illumination LAMP and status LED // Illumination LAMP and status LED
#if defined(LAMP_DISABLE) #if defined(LAMP_DISABLE)

View File

@ -237,9 +237,9 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
<label class="slider" for="colorbar"></label> <label class="slider" for="colorbar"></label>
</div> </div>
</div> </div>
<div class="input-group" id="framerate_limit-group"> <div class="input-group" id="min_frame_time-group">
<label for="framerate_limit">FPS Limit</label> <label for="min_frame_time">FPS Limit</label>
<select id="framerate_limit" class="default-action"> <select id="min_frame_time" class="default-action">
<option value="3333">0.3</option> <option value="3333">0.3</option>
<option value="2000">0.5</option> <option value="2000">0.5</option>
<option value="1000">1</option> <option value="1000">1</option>
@ -310,7 +310,7 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
const savePrefsButton = document.getElementById('save_prefs') const savePrefsButton = document.getElementById('save_prefs')
const clearPrefsButton = document.getElementById('clear_prefs') const clearPrefsButton = document.getElementById('clear_prefs')
const rebootButton = document.getElementById('reboot') const rebootButton = document.getElementById('reboot')
const framerateLimit = document.getElementById('framerate_limit') const minFrameTime = document.getElementById('min_frame_time')
const hide = el => { const hide = el => {
el.classList.add('hidden') el.classList.add('hidden')
@ -374,8 +374,8 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
} else if(el.id === "rotate"){ } else if(el.id === "rotate"){
rotate.value = value; rotate.value = value;
applyRotation(); applyRotation();
} else if(el.id === "framerate_limit"){ } else if(el.id === "min_frame_time"){
framerate_limit.value = value; min_frame_time.value = value;
} else if(el.id === "stream_url"){ } else if(el.id === "stream_url"){
streamURL = value; streamURL = value;
viewerURL = value + 'view'; viewerURL = value + 'view';
@ -579,8 +579,8 @@ const uint8_t index_ov2640_html[] = R"=====(<!doctype html>
updateConfig(framesize) updateConfig(framesize)
} }
framerateLimit.onchange = () => { minFrameTime.onchange = () => {
updateConfig(framerateLimit) updateConfig(minFrameTime)
} }
swapButton.onclick = () => { swapButton.onclick = () => {

View File

@ -251,9 +251,9 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
<label class="slider" for="colorbar"></label> <label class="slider" for="colorbar"></label>
</div> </div>
</div> </div>
<div class="input-group" id="framerate_limit-group"> <div class="input-group" id="min_frame_time-group">
<label for="framerate_limit">FPS Limit</label> <label for="min_frame_time">FPS Limit</label>
<select id="framerate_limit" class="default-action"> <select id="min_frame_time" class="default-action">
<option value="3333">0.3</option> <option value="3333">0.3</option>
<option value="2000">0.5</option> <option value="2000">0.5</option>
<option value="1000">1</option> <option value="1000">1</option>
@ -324,7 +324,7 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
const savePrefsButton = document.getElementById('save_prefs') const savePrefsButton = document.getElementById('save_prefs')
const clearPrefsButton = document.getElementById('clear_prefs') const clearPrefsButton = document.getElementById('clear_prefs')
const rebootButton = document.getElementById('reboot') const rebootButton = document.getElementById('reboot')
const framerateLimit = document.getElementById('framerate_limit') const minFrameTime = document.getElementById('min_frame_time')
const hide = el => { const hide = el => {
el.classList.add('hidden') el.classList.add('hidden')
@ -386,8 +386,8 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
} else if(el.id === "rotate"){ } else if(el.id === "rotate"){
rotate.value = value; rotate.value = value;
applyRotation(); applyRotation();
} else if(el.id === "framerate_limit"){ } else if(el.id === "min_frame_time"){
framerate_limit.value = value; min_frame_time.value = value;
} else if(el.id === "stream_url"){ } else if(el.id === "stream_url"){
streamURL = value; streamURL = value;
viewerURL = value + 'view'; viewerURL = value + 'view';
@ -588,8 +588,8 @@ const uint8_t index_ov3660_html[] = R"=====(<!doctype html>
updateConfig(framesize) updateConfig(framesize)
} }
framerateLimit.onchange = () => { minFrameTime.onchange = () => {
updateConfig(framerateLimit) updateConfig(minFrameTime)
} }
swapButton.onclick = () => { swapButton.onclick = () => {

View File

@ -144,8 +144,8 @@ struct station stationList[] = {{"ssid1", "pass1", true},
// #define CAM_ROTATION 0 // #define CAM_ROTATION 0
// Minimal frame duration in ms, used to limit max FPS // Minimal frame duration in ms, used to limit max FPS
// max_fps = 1000/framerate_limit // max_fps = 1000/min_frame_time
// #define FRAMERATE_LIMIT 500 // #define MIN_FRAME_TIME 500
/* /*
* Additional Features * Additional Features

View File

@ -7,7 +7,7 @@ extern void flashLED(int flashtime);
extern int myRotation; // Rotation extern int myRotation; // Rotation
extern int lampVal; // The current Lamp value extern int lampVal; // The current Lamp value
extern int autoLamp; // Automatic lamp mode extern int autoLamp; // Automatic lamp mode
extern int framerateLimit; // Minimal frame duration extern int minFrameTime; // Minimal frame duration
/* /*
* Useful utility when debugging... * Useful utility when debugging...
@ -91,7 +91,7 @@ void loadPrefs(fs::FS &fs){
// process all the settings // process all the settings
lampVal = jsonExtract(prefs, "lamp").toInt(); lampVal = jsonExtract(prefs, "lamp").toInt();
autoLamp = jsonExtract(prefs, "autolamp").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_framesize(s, (framesize_t)jsonExtract(prefs, "framesize").toInt());
s->set_quality(s, jsonExtract(prefs, "quality").toInt()); s->set_quality(s, jsonExtract(prefs, "quality").toInt());
s->set_brightness(s, jsonExtract(prefs, "brightness").toInt()); s->set_brightness(s, jsonExtract(prefs, "brightness").toInt());
@ -138,7 +138,7 @@ void savePrefs(fs::FS &fs){
*p++ = '{'; *p++ = '{';
p+=sprintf(p, "\"lamp\":%i,", lampVal); p+=sprintf(p, "\"lamp\":%i,", lampVal);
p+=sprintf(p, "\"autolamp\":%u,", autoLamp); 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, "\"framesize\":%u,", s->status.framesize);
p+=sprintf(p, "\"quality\":%u,", s->status.quality); p+=sprintf(p, "\"quality\":%u,", s->status.quality);
p+=sprintf(p, "\"brightness\":%d,", s->status.brightness); p+=sprintf(p, "\"brightness\":%d,", s->status.brightness);