mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
cleanup
This commit is contained in:
@@ -126,33 +126,64 @@ bool ClassFlowTakeImage::ReadParameter(FILE *pfile, string &aktparamgraph)
|
||||
else if ((toUpper(splitted[0]) == "CAMGAINCEILING") && (splitted.size() > 1))
|
||||
{
|
||||
std::string _ImageGainceiling = toUpper(splitted[1]);
|
||||
if (_ImageGainceiling == "X4")
|
||||
|
||||
if (isStringNumeric(_ImageGainceiling))
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_4X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X8")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_8X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X16")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_16X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X32")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_32X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X64")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_64X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X128")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_128X;
|
||||
int _ImageGainceiling_ = std::stoi(_ImageGainceiling);
|
||||
switch (_ImageGainceiling_)
|
||||
{
|
||||
case 1:
|
||||
CFstatus.ImageGainceiling = GAINCEILING_4X;
|
||||
break;
|
||||
case 2:
|
||||
CFstatus.ImageGainceiling = GAINCEILING_8X;
|
||||
break;
|
||||
case 3:
|
||||
CFstatus.ImageGainceiling = GAINCEILING_16X;
|
||||
break;
|
||||
case 4:
|
||||
CFstatus.ImageGainceiling = GAINCEILING_32X;
|
||||
break;
|
||||
case 5:
|
||||
CFstatus.ImageGainceiling = GAINCEILING_64X;
|
||||
break;
|
||||
case 6:
|
||||
CFstatus.ImageGainceiling = GAINCEILING_128X;
|
||||
break;
|
||||
default:
|
||||
CFstatus.ImageGainceiling = GAINCEILING_2X;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_2X;
|
||||
if (_ImageGainceiling == "X4")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_4X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X8")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_8X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X16")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_16X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X32")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_32X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X64")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_64X;
|
||||
}
|
||||
else if (_ImageGainceiling == "X128")
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_128X;
|
||||
}
|
||||
else
|
||||
{
|
||||
CCstatus.ImageGainceiling = GAINCEILING_2X;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,58 +247,76 @@ bool ClassFlowTakeImage::ReadParameter(FILE *pfile, string &aktparamgraph)
|
||||
else if ((toUpper(splitted[0]) == "CAMSPECIALEFFECT") && (splitted.size() > 1))
|
||||
{
|
||||
std::string _ImageSpecialEffect = toUpper(splitted[1]);
|
||||
if (_ImageSpecialEffect == "NEGATIVE")
|
||||
|
||||
if (isStringNumeric(_ImageSpecialEffect))
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 1;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "GRAYSCALE")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 2;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "RED")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 3;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "GREEN")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 4;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "BLUE")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 5;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "RETRO")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 6;
|
||||
int _ImageSpecialEffect_ = std::stoi(_ImageSpecialEffect);
|
||||
CFstatus.ImageSpecialEffect = clipInt(_ImageSpecialEffect_, 6, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 0;
|
||||
if (_ImageSpecialEffect == "NEGATIVE")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 1;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "GRAYSCALE")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 2;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "RED")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 3;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "GREEN")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 4;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "BLUE")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 5;
|
||||
}
|
||||
else if (_ImageSpecialEffect == "RETRO")
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
CCstatus.ImageSpecialEffect = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ((toUpper(splitted[0]) == "CAMWBMODE") && (splitted.size() > 1))
|
||||
{
|
||||
std::string _ImageWbMode = toUpper(splitted[1]);
|
||||
if (_ImageWbMode == "SUNNY")
|
||||
|
||||
if (isStringNumeric(_ImageWbMode))
|
||||
{
|
||||
CCstatus.ImageWbMode = 1;
|
||||
}
|
||||
else if (_ImageWbMode == "CLOUDY")
|
||||
{
|
||||
CCstatus.ImageWbMode = 2;
|
||||
}
|
||||
else if (_ImageWbMode == "OFFICE")
|
||||
{
|
||||
CCstatus.ImageWbMode = 3;
|
||||
}
|
||||
else if (_ImageWbMode == "HOME")
|
||||
{
|
||||
CCstatus.ImageWbMode = 4;
|
||||
int _ImageWbMode_ = std::stoi(_ImageWbMode);
|
||||
CFstatus.ImageWbMode = clipInt(_ImageWbMode_, 4, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCstatus.ImageWbMode = 0;
|
||||
if (_ImageWbMode == "SUNNY")
|
||||
{
|
||||
CCstatus.ImageWbMode = 1;
|
||||
}
|
||||
else if (_ImageWbMode == "CLOUDY")
|
||||
{
|
||||
CCstatus.ImageWbMode = 2;
|
||||
}
|
||||
else if (_ImageWbMode == "OFFICE")
|
||||
{
|
||||
CCstatus.ImageWbMode = 3;
|
||||
}
|
||||
else if (_ImageWbMode == "HOME")
|
||||
{
|
||||
CCstatus.ImageWbMode = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
CCstatus.ImageWbMode = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -790,11 +790,11 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
||||
|
||||
ESP_LOGD(TAG, "handler_editflow uri: %s", req->uri);
|
||||
|
||||
char _query[200];
|
||||
char _query[512];
|
||||
char _valuechar[30];
|
||||
std::string _task;
|
||||
|
||||
if (httpd_req_get_url_query_str(req, _query, 200) == ESP_OK)
|
||||
if (httpd_req_get_url_query_str(req, _query, 512) == ESP_OK)
|
||||
{
|
||||
if (httpd_query_key_value(_query, "task", _valuechar, 30) == ESP_OK)
|
||||
{
|
||||
@@ -997,6 +997,30 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
||||
CFstatus.ImageGainceiling = GAINCEILING_2X;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_aecgc == "X4") {
|
||||
CFstatus.ImageGainceiling = GAINCEILING_4X;
|
||||
}
|
||||
else if (_aecgc == "X8") {
|
||||
CFstatus.ImageGainceiling = GAINCEILING_8X;
|
||||
}
|
||||
else if (_aecgc == "X16") {
|
||||
CFstatus.ImageGainceiling = GAINCEILING_16X;
|
||||
}
|
||||
else if (_aecgc == "X32") {
|
||||
CFstatus.ImageGainceiling = GAINCEILING_32X;
|
||||
}
|
||||
else if (_aecgc == "X64") {
|
||||
CFstatus.ImageGainceiling = GAINCEILING_64X;
|
||||
}
|
||||
else if (_aecgc == "X128") {
|
||||
CFstatus.ImageGainceiling = GAINCEILING_128X;
|
||||
}
|
||||
else {
|
||||
CFstatus.ImageGainceiling = GAINCEILING_2X;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (httpd_query_key_value(_query, "qual", _valuechar, 30) == ESP_OK)
|
||||
@@ -1070,6 +1094,30 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
||||
int _spe_ = std::stoi(_valuechar);
|
||||
CFstatus.ImageSpecialEffect = clipInt(_spe_, 6, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_spe == "negative") {
|
||||
CFstatus.ImageSpecialEffect = 1;
|
||||
}
|
||||
else if (_spe == "grayscale") {
|
||||
CFstatus.ImageSpecialEffect = 2;
|
||||
}
|
||||
else if (_spe == "red") {
|
||||
CFstatus.ImageSpecialEffect = 3;
|
||||
}
|
||||
else if (_spe == "green") {
|
||||
CFstatus.ImageSpecialEffect = 4;
|
||||
}
|
||||
else if (_spe == "blue") {
|
||||
CFstatus.ImageSpecialEffect = 5;
|
||||
}
|
||||
else if (_spe == "retro") {
|
||||
CFstatus.ImageSpecialEffect = 6;
|
||||
}
|
||||
else {
|
||||
CFstatus.ImageSpecialEffect = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (httpd_query_key_value(_query, "wbm", _valuechar, 30) == ESP_OK)
|
||||
@@ -1080,6 +1128,24 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
||||
int _wbm_ = std::stoi(_valuechar);
|
||||
CFstatus.ImageWbMode = clipInt(_wbm_, 4, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_wbm == "sunny") {
|
||||
CFstatus.ImageWbMode = 1;
|
||||
}
|
||||
else if (_wbm == "cloudy") {
|
||||
CFstatus.ImageWbMode = 2;
|
||||
}
|
||||
else if (_wbm == "office") {
|
||||
CFstatus.ImageWbMode = 3;
|
||||
}
|
||||
else if (_wbm == "home") {
|
||||
CFstatus.ImageWbMode = 4;
|
||||
}
|
||||
else {
|
||||
CFstatus.ImageWbMode = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (httpd_query_key_value(_query, "awb", _valuechar, 30) == ESP_OK)
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
<tr>
|
||||
<td style="padding-top: 10px">x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()"></td>
|
||||
<td style="padding-top: 10px">dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchanged()"></td>
|
||||
<td rowspan="2" style="padding-top: 10px;"><input class="button" type="button" value="Update Marker" onclick="CutOutReference()"></td>
|
||||
<td rowspan="2" style="padding-top: 10px;"><button style="color:black;" type="button" class="button" id="updatemarker" onclick="CutOutReference()">Update Marker</button></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@@ -143,7 +143,7 @@
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;">Selected Image Area:</td>
|
||||
<td style="vertical-align: bottom;">Resulting Marker:</td>
|
||||
<td><input class="button" type="button" id="enhancecontrast" value="Enhance Image Contrast" onclick="EnhanceContrast()"></td>
|
||||
<td><button style="color:black;" type="button" class="button" id="enhancecontrast" onclick="EnhanceContrast()">Enhance Image Contrast</button></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@@ -155,7 +155,7 @@
|
||||
<td style="vertical-align:bottom;"><b>Reference Image:</b></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<input style="font-weight:bold;" class="button" type="submit" name="saveroi" id="savemarker" onclick="SaveToConfig()" value="Save New Marker">
|
||||
<button style="font-weight:bold; color:black;" type="submit" class="button" id="savemarker" onclick="SaveToConfig()">Save New Marker</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -185,7 +185,7 @@ var canvas = document.getElementById('canvas'),
|
||||
|
||||
function doReboot() {
|
||||
if (confirm("Are you sure you want to reboot? Did you save your changes?")) {
|
||||
var stringota = getDomainname() + "/reboot";
|
||||
var stringota = domainname + "/reboot";
|
||||
window.location = stringota;
|
||||
window.location.href = stringota;
|
||||
window.location.assign(stringota);
|
||||
@@ -208,34 +208,60 @@ function ChangeSelection(){
|
||||
}
|
||||
}
|
||||
|
||||
function SaveToConfig(){
|
||||
function SaveToConfig() {
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlaytext").innerHTML = "Save Alignment Marker...";
|
||||
|
||||
if (confirm("Are you sure you want to save the new alignment marker configuration?")) {
|
||||
WriteConfigININew();
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
if (neueref1 == 1 && neueref2 == 1) {
|
||||
UpdateConfigReferences(domainname);
|
||||
}
|
||||
async function task() {
|
||||
while (true) {
|
||||
WriteConfigININew();
|
||||
|
||||
else if (neueref1 == 1) {
|
||||
var anzneueref = 1;
|
||||
UpdateConfigReference(anzneueref, domainname);
|
||||
}
|
||||
if (neueref1 == 1 && neueref2 == 1) {
|
||||
UpdateConfigReferences(domainname);
|
||||
}
|
||||
else if (neueref1 == 1) {
|
||||
var anzneueref = 1;
|
||||
UpdateConfigReference(anzneueref, domainname);
|
||||
}
|
||||
else if (neueref2 == 1) {
|
||||
var anzneueref = 2;
|
||||
UpdateConfigReference(anzneueref, domainname);
|
||||
}
|
||||
|
||||
else if (neueref2 == 1) {
|
||||
var anzneueref = 2;
|
||||
UpdateConfigReference(anzneueref, domainname);
|
||||
}
|
||||
SaveConfigToServer(domainname);
|
||||
|
||||
//UpdateConfigReference(domainname)
|
||||
SaveConfigToServer(domainname);
|
||||
document.getElementById("savemarker").disabled = true;
|
||||
document.getElementById("enhancecontrast").disabled = true;
|
||||
document.getElementById("updatemarker").disabled = false;
|
||||
// document.getElementById("savemarker").disabled = true;
|
||||
// document.getElementById("enhancecontrast").disabled = true;
|
||||
|
||||
firework.launch('Alignment marker saved. They will get applied after next reboot', 'success', 5000);
|
||||
EnDisableItem(false, "savemarker", true);
|
||||
EnDisableItem(false, "enhancecontrast", true);
|
||||
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Alignment marker saved. They will get applied after next reboot', 'success', 5000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
// Delay so the overlay gets shown
|
||||
task();
|
||||
}, 1);
|
||||
}
|
||||
else {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function EnhanceContrast(){
|
||||
function EnhanceContrast() {
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlaytext").innerHTML = "Enhancing Image Contrast...";
|
||||
|
||||
refInfo[aktindex]["name"] = document.getElementById("name").value;
|
||||
refInfo[aktindex]["x"] = document.getElementById("refx").value;
|
||||
refInfo[aktindex]["y"] = document.getElementById("refy").value;
|
||||
@@ -243,9 +269,7 @@ function EnhanceContrast(){
|
||||
refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
|
||||
|
||||
var enhanceCon = true;
|
||||
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlaytext").innerHTML = "Enhancing Image Contrast...";
|
||||
var durchlaufe = 0;
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
@@ -253,11 +277,18 @@ function EnhanceContrast(){
|
||||
|
||||
async function task() {
|
||||
while (true) {
|
||||
if (durchlaufe > 10) {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Enhancing Image Contrast aborted, timeout!', 'danger', 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
var ret = MakeRefImageZW(refInfo[aktindex], enhanceCon, domainname);
|
||||
|
||||
if (ret) {
|
||||
UpdateReference();
|
||||
//document.getElementById("enhancecontrast").disabled = true;
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
|
||||
if (aktindex == 0) {
|
||||
neueref1 = 1;
|
||||
}
|
||||
@@ -269,6 +300,8 @@ function EnhanceContrast(){
|
||||
else {
|
||||
// Get status
|
||||
var xhttp = new XMLHttpRequest();
|
||||
durchlaufe = durchlaufe + 1;
|
||||
|
||||
try {
|
||||
xhttp.open("GET", domainname + "/statusflow", false);
|
||||
xhttp.send();
|
||||
@@ -282,7 +315,8 @@ function EnhanceContrast(){
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() { // Delay so the overlay gets shown
|
||||
setTimeout(function() {
|
||||
// Delay so the overlay gets shown
|
||||
task();
|
||||
}, 1);
|
||||
}
|
||||
@@ -393,7 +427,13 @@ function LoadReference(){
|
||||
|
||||
function init() {
|
||||
openDescription();
|
||||
domainname = getDomainname();
|
||||
|
||||
document.getElementById("updatemarker").disabled = false;
|
||||
// document.getElementById("savemarker").disabled = true;
|
||||
// document.getElementById("enhancecontrast").disabled = true;
|
||||
|
||||
EnDisableItem(false, "savemarker", true);
|
||||
EnDisableItem(false, "enhancecontrast", true);
|
||||
|
||||
if (!loadConfig(domainname)) {
|
||||
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
|
||||
@@ -404,18 +444,13 @@ function init() {
|
||||
param = getConfigParameters();
|
||||
cofcat = getConfigCategory();
|
||||
|
||||
document.getElementById("savemarker").disabled = true;
|
||||
document.getElementById("enhancecontrast").disabled = true;
|
||||
|
||||
canvas.addEventListener('mousedown', mouseDown, false);
|
||||
canvas.addEventListener('mouseup', mouseUp, false);
|
||||
canvas.addEventListener('mousemove', mouseMove, false);
|
||||
loadCanvas(domainname + "/fileserver/config/reference.jpg");
|
||||
|
||||
//CopyReferenceToImgTmp(domainname);
|
||||
refInfo = GetReferencesInfo();
|
||||
|
||||
//UpdateReference();
|
||||
LoadReference();
|
||||
drawImage();
|
||||
draw();
|
||||
@@ -432,15 +467,16 @@ function drawImage(){
|
||||
}
|
||||
|
||||
function CutOutReference(){
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlaytext").innerHTML = "Updating marker...";
|
||||
|
||||
refInfo[aktindex]["x"] = document.getElementById("refx").value;
|
||||
refInfo[aktindex]["y"] = document.getElementById("refy").value;
|
||||
refInfo[aktindex]["dx"] = document.getElementById("refdx").value;
|
||||
refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
|
||||
|
||||
var enhanceCon = false;
|
||||
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlaytext").innerHTML = "Updating marker...";
|
||||
var durchlaufe = 0;
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
@@ -448,12 +484,24 @@ function CutOutReference(){
|
||||
|
||||
async function task() {
|
||||
while (true) {
|
||||
if (durchlaufe > 10) {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Updating marker aborted, timeout!', 'danger', 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
var ret = MakeRefImageZW(refInfo[aktindex], enhanceCon, domainname);
|
||||
|
||||
if (ret) {
|
||||
UpdateReference();
|
||||
document.getElementById("enhancecontrast").disabled = false;
|
||||
document.getElementById("savemarker").disabled = false;
|
||||
|
||||
document.getElementById("updatemarker").disabled = false;
|
||||
// document.getElementById("savemarker").disabled = false;
|
||||
// document.getElementById("enhancecontrast").disabled = false;
|
||||
|
||||
EnDisableItem(true, "savemarker", true);
|
||||
EnDisableItem(true, "enhancecontrast", true);
|
||||
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
|
||||
if (aktindex == 0) {
|
||||
@@ -467,6 +515,8 @@ function CutOutReference(){
|
||||
else {
|
||||
// Get status
|
||||
var xhttp = new XMLHttpRequest();
|
||||
durchlaufe = durchlaufe + 1;
|
||||
|
||||
try {
|
||||
xhttp.open("GET", domainname + "/statusflow", false);
|
||||
xhttp.send();
|
||||
@@ -480,7 +530,8 @@ function CutOutReference(){
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() { // Delay so the overlay gets shown
|
||||
setTimeout(function() {
|
||||
// Delay so the overlay gets shown
|
||||
task();
|
||||
}, 1);
|
||||
}
|
||||
@@ -536,6 +587,21 @@ function mouseDown(e) {
|
||||
drag = true;
|
||||
}
|
||||
|
||||
function EnDisableItem(_status, _name, _optional) {
|
||||
_color = "rgb(122, 122, 122)";
|
||||
|
||||
if (_status) {
|
||||
_color = "black";
|
||||
}
|
||||
|
||||
if (_optional) {
|
||||
document.getElementById(_name).disabled = !_status;
|
||||
document.getElementById(_name).style.color = _color;
|
||||
}
|
||||
|
||||
document.getElementById(_name).style.color = _color;
|
||||
}
|
||||
|
||||
function mouseUp() {
|
||||
drag = false;
|
||||
|
||||
|
||||
@@ -2108,8 +2108,6 @@ function cameraParameterChanged() {
|
||||
}
|
||||
|
||||
function LoadConfigNeu() {
|
||||
domainname = getDomainname();
|
||||
|
||||
if (!loadConfig(domainname)) {
|
||||
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
|
||||
return;
|
||||
@@ -2622,8 +2620,6 @@ function saveTextAsFile() {
|
||||
}
|
||||
|
||||
function camSettingsSet(){
|
||||
var domainname = getDomainname();
|
||||
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlaytext").innerHTML = "Save Cam Settings...";
|
||||
|
||||
@@ -2765,29 +2761,27 @@ function camSettingsSet(){
|
||||
var _zoomy_temp = document.getElementById("TakeImage_CamZoomOffsetY_value1").value;
|
||||
var _zooms_temp = document.getElementById("TakeImage_CamZoomSize_value1").value;
|
||||
|
||||
// bei einmal Alles senden kommt es zu problemen!!!!!!!!!!!!!!!!!!!!
|
||||
var url_1 = domainname + "/editflow?task=cam_settings";
|
||||
url_1 = url_1 + "&waitb=" + _waitb_temp + "&aecgc=" + _aecgc_temp + "&qual=" + _qual_temp;
|
||||
url_1 = url_1 + "&bri=" + _bri_temp + "&con=" + _con_temp + "&sat=" + _sat_temp + "&shp=" + _shp_temp + "&ashp=" + _ashp_temp;
|
||||
url_1 = url_1 + "&spe=" + _spe_temp + "&wbm=" + _wbm_temp + "&awb=" + _awb_temp + "&awbg=" + _awbg_temp;
|
||||
url_1 = url_1 + "&aec=" + _aec_temp + "&aec2=" + _aec2_temp + "&ael=" + _ael_temp + "&aecv=" + _aecv_temp;
|
||||
|
||||
var url_2 = domainname + "/editflow?task=cam_settings";
|
||||
url_2 = url_2 + "&agc=" + _agc_temp + "&agcg=" + _agcg_temp + "&bpc=" + _bpc_temp + "&wpc=" + _wpc_temp;
|
||||
url_2 = url_2 + "&rgma=" + _rgma_temp + "&lenc=" + _lenc_temp + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp;
|
||||
url_2 = url_2 + "&dcw=" + _dcw_temp + "&den=" + _denoise_temp + "&ledi=" + _ledi_temp;
|
||||
|
||||
if (_zoom_temp != '0') {
|
||||
url_2 = url_2 + "&zoom=" + _zoom_temp + "&zooms=" + _zooms_temp;
|
||||
url_2 = url_2 + "&zoomx=" + _zoomx_temp + "&zoomy=" + _zoomy_temp;
|
||||
}
|
||||
else {
|
||||
url_2 = url_2 + "&zoom=0" + "&zooms=0" + "&zoomx=0" + "&zoomy=0";
|
||||
}
|
||||
var url = domainname + "/editflow?task=cam_settings";
|
||||
|
||||
if (domainname.length > 0){
|
||||
url_1 = url_1 + "&host=" + domainname;
|
||||
url_2 = url_2 + "&host=" + domainname;
|
||||
url = url + "&host=" + domainname;
|
||||
}
|
||||
|
||||
url = url + "&waitb=" + _waitb_temp + "&aecgc=" + _aecgc_temp + "&qual=" + _qual_temp;
|
||||
url = url + "&bri=" + _bri_temp + "&con=" + _con_temp + "&sat=" + _sat_temp + "&shp=" + _shp_temp + "&ashp=" + _ashp_temp;
|
||||
url = url + "&spe=" + _spe_temp + "&wbm=" + _wbm_temp + "&awb=" + _awb_temp + "&awbg=" + _awbg_temp;
|
||||
url = url + "&aec=" + _aec_temp + "&aec2=" + _aec2_temp + "&ael=" + _ael_temp + "&aecv=" + _aecv_temp;
|
||||
|
||||
url = url + "&agc=" + _agc_temp + "&agcg=" + _agcg_temp + "&bpc=" + _bpc_temp + "&wpc=" + _wpc_temp;
|
||||
url = url + "&rgma=" + _rgma_temp + "&lenc=" + _lenc_temp + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp;
|
||||
url = url + "&dcw=" + _dcw_temp + "&den=" + _denoise_temp + "&ledi=" + _ledi_temp;
|
||||
|
||||
if (_zoom_temp != '0') {
|
||||
url = url + "&zoom=" + _zoom_temp + "&zooms=" + _zooms_temp;
|
||||
url = url + "&zoomx=" + _zoomx_temp + "&zoomy=" + _zoomy_temp;
|
||||
}
|
||||
else {
|
||||
url = url + "&zoom=0" + "&zooms=0" + "&zoomx=0" + "&zoomy=0";
|
||||
}
|
||||
|
||||
var durchlaufe = 0;
|
||||
@@ -2798,24 +2792,22 @@ function camSettingsSet(){
|
||||
|
||||
async function task() {
|
||||
while (true) {
|
||||
var xhttp1 = new XMLHttpRequest();
|
||||
var xhttp2 = new XMLHttpRequest();
|
||||
var xhttp = new XMLHttpRequest();
|
||||
|
||||
if (durchlaufe > 10) {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Save Cam Settings aborted, timeout!', 'success', 5000);
|
||||
firework.launch('Save Cam Settings aborted, timeout!', 'danger', 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
xhttp1.open("GET", url_1, false);
|
||||
xhttp1.send();
|
||||
xhttp2.open("GET", url_2, false);
|
||||
xhttp2.send();
|
||||
xhttp.open("GET", url, false);
|
||||
xhttp.send();
|
||||
} catch (error){}
|
||||
|
||||
if ((xhttp1.responseText == "CamSettingsSet") && (xhttp2.responseText == "CamSettingsSet")) {
|
||||
if (xhttp.responseText == "CamSettingsSet") {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Cam Settings saved', 'success', 2000);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -2836,14 +2828,15 @@ function camSettingsSet(){
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() { // Delay so the overlay gets shown
|
||||
setTimeout(function() {
|
||||
// Delay so the overlay gets shown
|
||||
task();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function doReboot() {
|
||||
if (confirm("Are you sure you want to reboot?")) {
|
||||
var stringota = getDomainname() + "/reboot";
|
||||
var stringota = domainname + "/reboot";
|
||||
window.location = stringota;
|
||||
window.location.href = stringota;
|
||||
window.location.assign(stringota);
|
||||
@@ -2861,7 +2854,7 @@ function FormatDecimalValue(_param, _cat, _name) {
|
||||
|
||||
function editConfigRaw() {
|
||||
if (confirm("Proceed to switch to raw edit mode? Unsaved changes will get lost")) {
|
||||
var stringota = getDomainname() + "/edit_config_raw.html?v=$COMMIT_HASH";
|
||||
var stringota = domainname + "/edit_config_raw.html?v=$COMMIT_HASH";
|
||||
window.location = stringota;
|
||||
window.location.href = stringota;
|
||||
window.location.assign(stringota);
|
||||
|
||||
@@ -391,6 +391,7 @@
|
||||
|
||||
<script language="JavaScript">
|
||||
var canvas = document.getElementById('canvas'),
|
||||
domainname = getDomainname(),
|
||||
context = canvas.getContext('2d'),
|
||||
imageObj = new Image(),
|
||||
isActReference = false,
|
||||
@@ -399,7 +400,7 @@
|
||||
|
||||
function doReboot() {
|
||||
if (confirm("Are you sure you want to reboot? Did you save the config?")) {
|
||||
var stringota = getDomainname() + "/reboot";
|
||||
var stringota = domainname + "/reboot";
|
||||
window.location = stringota;
|
||||
window.location.href = stringota;
|
||||
window.location.assign(stringota);
|
||||
@@ -437,8 +438,6 @@
|
||||
|
||||
// Create New Reference, Update Image
|
||||
function doTakeReference(){
|
||||
var domainname = getDomainname();
|
||||
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlaytext").innerHTML = "Taking new image...";
|
||||
|
||||
@@ -554,6 +553,11 @@
|
||||
var _effect_temp = document.getElementById("TakeImage_CamSpecialEffect_value1").selectedIndex;
|
||||
|
||||
var url = domainname + "/editflow?task=test_take";
|
||||
|
||||
if (domainname.length > 0) {
|
||||
url = url + "&host=" + domainname;
|
||||
}
|
||||
|
||||
url = url + "&bri=" + _bri_temp + "&con=" + _con_temp + "&sat=" + _sat_temp + "&shp=" + _shp_temp;
|
||||
url = url + "&ashp=" + _ashp_temp + "&ledi=" + _ledi_temp + "&spe=" + _effect_temp + "&zoom=" + _zoom_temp;
|
||||
|
||||
@@ -567,10 +571,6 @@
|
||||
url = url + "&aec=" + _aec_temp + "&ael=" + _ael_temp + "&aec2=" + _aec2_temp;
|
||||
url = url + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp;
|
||||
|
||||
if (domainname.length > 0){
|
||||
url = url + "&host=" + domainname;
|
||||
}
|
||||
|
||||
var durchlaufe = 0;
|
||||
|
||||
function sleep(ms) {
|
||||
@@ -581,9 +581,9 @@
|
||||
while (true) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
|
||||
if (durchlaufe > 15) {
|
||||
if (durchlaufe > 10) {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Image capture aborted, timeout!', 'warning', 5000);
|
||||
firework.launch('Image capture aborted, timeout!', 'danger', 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -597,6 +597,9 @@
|
||||
loadCanvas(_url, true);
|
||||
isActReference = false;
|
||||
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Image capture completed, please wait until it loads...', 'success', 5000);
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -617,14 +620,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() { // Delay so the overlay gets shown
|
||||
setTimeout(function() {
|
||||
// Delay so the overlay gets shown
|
||||
task();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function camSettingsSet(){
|
||||
var domainname = getDomainname();
|
||||
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
document.getElementById("overlaytext").innerHTML = "Save Cam Settings...";
|
||||
|
||||
@@ -691,6 +693,11 @@
|
||||
var _effect_temp = document.getElementById("TakeImage_CamSpecialEffect_value1").selectedIndex;
|
||||
|
||||
var url = domainname + "/editflow?task=cam_settings";
|
||||
|
||||
if (domainname.length > 0) {
|
||||
url = url + "&host=" + domainname;
|
||||
}
|
||||
|
||||
url = url + "&bri=" + _bri_temp + "&con=" + _con_temp + "&sat=" + _sat_temp + "&shp=" + _shp_temp;
|
||||
url = url + "&ashp=" + _ashp_temp + "&ledi=" + _ledi_temp + "&spe=" + _effect_temp + "&zoom=" + _zoom_temp;
|
||||
|
||||
@@ -704,10 +711,6 @@
|
||||
url = url + "&aec=" + _aec_temp + "&ael=" + _ael_temp + "&aec2=" + _aec2_temp;
|
||||
url = url + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp;
|
||||
|
||||
if (domainname.length > 0){
|
||||
url = url + "&host=" + domainname;
|
||||
}
|
||||
|
||||
var durchlaufe = 0;
|
||||
|
||||
function sleep(ms) {
|
||||
@@ -718,9 +721,9 @@
|
||||
while (true) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
|
||||
if (durchlaufe > 15) {
|
||||
if (durchlaufe > 10) {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Save Cam Settings aborted, timeout!', 'warning', 5000);
|
||||
firework.launch('Save Cam Settings aborted, timeout!', 'danger', 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -731,6 +734,7 @@
|
||||
|
||||
if (xhttp.responseText == "CamSettingsSet") {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
firework.launch('Cam Settings saved', 'success', 2000);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -745,19 +749,20 @@
|
||||
catch (error){}
|
||||
|
||||
document.getElementById("overlaytext").innerHTML = "Device is busy, plase waiting...<br><br>Current step: " + _xhttp.responseText;
|
||||
console.log("Device is busy, waiting 5s then checking again...");
|
||||
console.log("Device is busy, waiting 2s then checking again...");
|
||||
await sleep(2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() { // Delay so the overlay gets shown
|
||||
setTimeout(function() {
|
||||
// Delay so the overlay gets shown
|
||||
task();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
function showReference(){
|
||||
url = getDomainname() + "/fileserver/config/reference.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);
|
||||
url = domainname + "/fileserver/config/reference.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);
|
||||
loadCanvas(url, false);
|
||||
isActReference = true;
|
||||
|
||||
@@ -830,8 +835,6 @@
|
||||
}
|
||||
|
||||
function SaveReference(){
|
||||
var domainname = getDomainname();
|
||||
|
||||
param["Alignment"]["InitialRotate"].value1 = (Number(document.getElementById("PreRotateAngle_value1").value) +
|
||||
Number(document.getElementById("FineRotate_value1").value)).toFixed(1);
|
||||
|
||||
@@ -873,7 +876,6 @@
|
||||
|
||||
function init() {
|
||||
openDescription();
|
||||
domainname = getDomainname();
|
||||
|
||||
if (!loadConfig(domainname)) {
|
||||
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
|
||||
|
||||
Reference in New Issue
Block a user