working on webpage

main^2
Steffen 2 months ago
parent 4484af81fa
commit efa9e4796b

@ -286,6 +286,14 @@ void Configuration::SetValue(std::string name, std::string value) {
filter_ratio = atof(value.c_str()); filter_ratio = atof(value.c_str());
debug ("Filter Ration set to : %g", filter_ratio); debug ("Filter Ration set to : %g", filter_ratio);
} }
if (name.compare("auto_birghtness") == 0) {
auto_brightness = atol(value.c_str());
debug ("Auto Brightness set to : %ld", auto_brightness);
}
if (name.compare("auto_birghtness_target") == 0) {
auto_brightness_target = atof(value.c_str());
debug ("Filter Ration set to : %g", auto_brightness_target);
}
}; };
@ -303,7 +311,20 @@ std::string Configuration::GetValues() {
jpe.AddObject("name", "filter_ratio"); jpe.AddObject("name", "filter_ratio");
jpe.AddObject("value", filter_ratio); jpe.AddObject("value", filter_ratio);
jpe.AddObject("desc", "Ratio between new to old image (1.0 = new image)"); jpe.AddObject("desc", "Ratio between new to old image (1.0 = new image)");
je.SetAddArray("variables", jpe.ToString());
//
jpe.Clear();
jpe.AddObject("name", "auto_brightness");
jpe.AddObject("value", (int64_t) auto_brightness);
jpe.AddObject("desc", "Ctrl_ID for the brightness");
je.SetAddArray("variables", jpe.ToString());
//
jpe.Clear();
jpe.AddObject("name", "auto_brightness_target");
jpe.AddObject("value", auto_brightness_target);
jpe.AddObject("desc", "target value for auto brightness");
je.SetAddArray("variables", jpe.ToString()); je.SetAddArray("variables", jpe.ToString());
// //

@ -47,6 +47,8 @@ public:
std::string vdev_dumpfile; std::string vdev_dumpfile;
std::string vdev_dumppath; std::string vdev_dumppath;
unsigned int auto_brightness;
float auto_brightness_target;
float filter_ratio; float filter_ratio;
Configuration(); Configuration();

@ -43,6 +43,7 @@ static void *thread_webserver(void *ignored_argument) {
static void *thread_video(void *ignored_argument) { static void *thread_video(void *ignored_argument) {
int cycle = 0;
if (config.vdev_dumpfile.length() > 0) { if (config.vdev_dumpfile.length() > 0) {
vdev = new VideoDevice_Dump(); vdev = new VideoDevice_Dump();
@ -71,6 +72,7 @@ static void *thread_video(void *ignored_argument) {
vdev->Stop(); vdev->Stop();
vdev->Start(); vdev->Start();
} }
if ((cycle++ % 2) == 0) vdev->RefreshCtrls();
Lock(); Lock();
inputimage.CopyTo(&currentimage, config.web_width, config.web_height); inputimage.CopyTo(&currentimage, config.web_width, config.web_height);
if (inputfloatfilter.AddScaledImage(&inputfloat, config.filter_ratio) == 0) if (inputfloatfilter.AddScaledImage(&inputfloat, config.filter_ratio) == 0)

@ -42,3 +42,13 @@ int VideoDevice::UnLock() {
if (pthread_mutex_unlock(&mtx) == 0) return 1; if (pthread_mutex_unlock(&mtx) == 0) return 1;
else return 0; else return 0;
}; };
void VideoDevice::RefreshCtrls() {
std::list<VideoDevCtrl>::iterator i;
for (i = vidctrls.begin(); i != vidctrls.end(); i++) {
GetDevCtrl(i->id, &(i->value));
}
};

@ -88,6 +88,7 @@ class VideoDevice {
virtual int SetDevCtrl(unsigned int id, int value) { debug (""); return 0; }; virtual int SetDevCtrl(unsigned int id, int value) { debug (""); return 0; };
virtual int GetDevCtrl(unsigned int id, int *value) { debug (""); return 0; }; virtual int GetDevCtrl(unsigned int id, int *value) { debug (""); return 0; };
virtual std::list<VideoDevCtrl> GetDevCtrls() { return vidctrls; }; virtual std::list<VideoDevCtrl> GetDevCtrls() { return vidctrls; };
virtual void RefreshCtrls();
}; };
#include "videodevice_v4l2.h" #include "videodevice_v4l2.h"

@ -71,7 +71,7 @@ function refreshCtrls() {
ctrls.ctrls.forEach(function (elm, idx) { ctrls.ctrls.forEach(function (elm, idx) {
t += "<tr><td>"+elm.name+"</td><td>"+elm.min+"</td>"+ t += "<tr><td>"+elm.name+"</td><td>"+elm.min+"</td>"+
"<td>"+elm.max+"</td><td>" + "<td>"+elm.max+"</td><td>" +
"<input class=\"ctrlvalue\" dataid=\""+elm.id+"\" value=\""+elm.value+"\" size=\"6\"></td></tr>"; "<input class=\"ctrlvalue\" dataid=\""+elm.id+"\" value=\""+elm.value+"\" size=\"6\" inputmode=\"search\"></td></tr>";
datalist.innerHTML += "<option value=\""+elm.id + " " + elm.name+"\">"; datalist.innerHTML += "<option value=\""+elm.id + " " + elm.name+"\">";
}); });
t += "</tbody>"; t += "</tbody>";
@ -100,7 +100,7 @@ function refreshVariables() {
let t = "<thead><tr><th>Name</th><th>Value</th><th>Description</th></thead><tbody>"; let t = "<thead><tr><th>Name</th><th>Value</th><th>Description</th></thead><tbody>";
variables.variables.forEach(function (elm, idx) { variables.variables.forEach(function (elm, idx) {
t += "<tr><td>"+elm.name+"</td>"+ t += "<tr><td>"+elm.name+"</td>"+
"<td><input class=\"variablevalue\" dataid=\""+elm.name+"\" value=\""+elm.value+"\" size=\"6\"></td>"+ "<td><input class=\"variablevalue\" dataid=\""+elm.name+"\" value=\""+elm.value+"\" size=\"6\" inputmode=\"search\"></td>"+
"<td>"+elm.desc+"</td></tr>"; "<td>"+elm.desc+"</td></tr>";
}); });
t += "</tbody>"; t += "</tbody>";
@ -150,8 +150,18 @@ function setVariable(id, value) {
}); });
} }
let cyclecnt = 0;
function refresh() {
reloadImage();
setInterval(reloadImage, 500); if (((cyclecnt++) % 25) == 0) {
refreshCtrls();
refreshVariables();
}
}
setInterval(refresh, 500);
refreshCtrls(); refreshCtrls();
refreshVariables(); refreshVariables();

Loading…
Cancel
Save