This commit is contained in:
michael
2024-09-23 15:44:30 +02:00
parent 20a04b888f
commit 085c47b651
5 changed files with 341 additions and 165 deletions

View File

@@ -126,33 +126,64 @@ bool ClassFlowTakeImage::ReadParameter(FILE *pfile, string &aktparamgraph)
else if ((toUpper(splitted[0]) == "CAMGAINCEILING") && (splitted.size() > 1)) else if ((toUpper(splitted[0]) == "CAMGAINCEILING") && (splitted.size() > 1))
{ {
std::string _ImageGainceiling = toUpper(splitted[1]); std::string _ImageGainceiling = toUpper(splitted[1]);
if (_ImageGainceiling == "X4")
if (isStringNumeric(_ImageGainceiling))
{ {
CCstatus.ImageGainceiling = GAINCEILING_4X; int _ImageGainceiling_ = std::stoi(_ImageGainceiling);
} switch (_ImageGainceiling_)
else if (_ImageGainceiling == "X8") {
{ case 1:
CCstatus.ImageGainceiling = GAINCEILING_8X; CFstatus.ImageGainceiling = GAINCEILING_4X;
} break;
else if (_ImageGainceiling == "X16") case 2:
{ CFstatus.ImageGainceiling = GAINCEILING_8X;
CCstatus.ImageGainceiling = GAINCEILING_16X; break;
} case 3:
else if (_ImageGainceiling == "X32") CFstatus.ImageGainceiling = GAINCEILING_16X;
{ break;
CCstatus.ImageGainceiling = GAINCEILING_32X; case 4:
} CFstatus.ImageGainceiling = GAINCEILING_32X;
else if (_ImageGainceiling == "X64") break;
{ case 5:
CCstatus.ImageGainceiling = GAINCEILING_64X; CFstatus.ImageGainceiling = GAINCEILING_64X;
} break;
else if (_ImageGainceiling == "X128") case 6:
{ CFstatus.ImageGainceiling = GAINCEILING_128X;
CCstatus.ImageGainceiling = GAINCEILING_128X; break;
default:
CFstatus.ImageGainceiling = GAINCEILING_2X;
}
} }
else 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)) else if ((toUpper(splitted[0]) == "CAMSPECIALEFFECT") && (splitted.size() > 1))
{ {
std::string _ImageSpecialEffect = toUpper(splitted[1]); std::string _ImageSpecialEffect = toUpper(splitted[1]);
if (_ImageSpecialEffect == "NEGATIVE")
if (isStringNumeric(_ImageSpecialEffect))
{ {
CCstatus.ImageSpecialEffect = 1; int _ImageSpecialEffect_ = std::stoi(_ImageSpecialEffect);
} CFstatus.ImageSpecialEffect = clipInt(_ImageSpecialEffect_, 6, 0);
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 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)) else if ((toUpper(splitted[0]) == "CAMWBMODE") && (splitted.size() > 1))
{ {
std::string _ImageWbMode = toUpper(splitted[1]); std::string _ImageWbMode = toUpper(splitted[1]);
if (_ImageWbMode == "SUNNY")
if (isStringNumeric(_ImageWbMode))
{ {
CCstatus.ImageWbMode = 1; int _ImageWbMode_ = std::stoi(_ImageWbMode);
} CFstatus.ImageWbMode = clipInt(_ImageWbMode_, 4, 0);
else if (_ImageWbMode == "CLOUDY")
{
CCstatus.ImageWbMode = 2;
}
else if (_ImageWbMode == "OFFICE")
{
CCstatus.ImageWbMode = 3;
}
else if (_ImageWbMode == "HOME")
{
CCstatus.ImageWbMode = 4;
} }
else 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;
}
} }
} }

View File

@@ -790,11 +790,11 @@ esp_err_t handler_editflow(httpd_req_t *req)
ESP_LOGD(TAG, "handler_editflow uri: %s", req->uri); ESP_LOGD(TAG, "handler_editflow uri: %s", req->uri);
char _query[200]; char _query[512];
char _valuechar[30]; char _valuechar[30];
std::string _task; 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) 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; 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) 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); int _spe_ = std::stoi(_valuechar);
CFstatus.ImageSpecialEffect = clipInt(_spe_, 6, 0); 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) 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); int _wbm_ = std::stoi(_valuechar);
CFstatus.ImageWbMode = clipInt(_wbm_, 4, 0); 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) if (httpd_query_key_value(_query, "awb", _valuechar, 30) == ESP_OK)

View File

@@ -132,7 +132,7 @@
<tr> <tr>
<td style="padding-top: 10px">x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()"></td> <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 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>
<tr> <tr>
@@ -143,7 +143,7 @@
<tr> <tr>
<td style="vertical-align: bottom;">Selected Image Area:</td> <td style="vertical-align: bottom;">Selected Image Area:</td>
<td style="vertical-align: bottom;">Resulting Marker:</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>
<tr> <tr>
@@ -155,7 +155,7 @@
<td style="vertical-align:bottom;"><b>Reference Image:</b></td> <td style="vertical-align:bottom;"><b>Reference Image:</b></td>
<td></td> <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> </td>
</tr> </tr>
@@ -185,7 +185,7 @@ var canvas = document.getElementById('canvas'),
function doReboot() { function doReboot() {
if (confirm("Are you sure you want to reboot? Did you save your changes?")) { 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 = stringota;
window.location.href = stringota; window.location.href = stringota;
window.location.assign(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?")) { 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));
}
async function task() {
while (true) {
WriteConfigININew();
if (neueref1 == 1 && neueref2 == 1) { if (neueref1 == 1 && neueref2 == 1) {
UpdateConfigReferences(domainname); UpdateConfigReferences(domainname);
} }
else if (neueref1 == 1) {
else if (neueref1 == 1) { var anzneueref = 1;
var anzneueref = 1; UpdateConfigReference(anzneueref, domainname);
UpdateConfigReference(anzneueref, domainname); }
} else if (neueref2 == 1) {
var anzneueref = 2;
else if (neueref2 == 1) { UpdateConfigReference(anzneueref, domainname);
var anzneueref = 2; }
UpdateConfigReference(anzneueref, domainname);
} SaveConfigToServer(domainname);
//UpdateConfigReference(domainname) document.getElementById("updatemarker").disabled = false;
SaveConfigToServer(domainname); // document.getElementById("savemarker").disabled = true;
document.getElementById("savemarker").disabled = true; // document.getElementById("enhancecontrast").disabled = true;
document.getElementById("enhancecontrast").disabled = true;
EnDisableItem(false, "savemarker", true);
firework.launch('Alignment marker saved. They will get applied after next reboot', 'success', 5000); 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]["name"] = document.getElementById("name").value;
refInfo[aktindex]["x"] = document.getElementById("refx").value; refInfo[aktindex]["x"] = document.getElementById("refx").value;
refInfo[aktindex]["y"] = document.getElementById("refy").value; refInfo[aktindex]["y"] = document.getElementById("refy").value;
@@ -243,9 +269,7 @@ function EnhanceContrast(){
refInfo[aktindex]["dy"] = document.getElementById("refdy").value; refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
var enhanceCon = true; var enhanceCon = true;
var durchlaufe = 0;
document.getElementById("overlay").style.display = "block";
document.getElementById("overlaytext").innerHTML = "Enhancing Image Contrast...";
function sleep(ms) { function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
@@ -253,11 +277,18 @@ function EnhanceContrast(){
async function task() { async function task() {
while (true) { 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); var ret = MakeRefImageZW(refInfo[aktindex], enhanceCon, domainname);
if (ret) { if (ret) {
UpdateReference(); UpdateReference();
//document.getElementById("enhancecontrast").disabled = true;
document.getElementById("overlay").style.display = "none"; document.getElementById("overlay").style.display = "none";
if (aktindex == 0) { if (aktindex == 0) {
neueref1 = 1; neueref1 = 1;
} }
@@ -269,6 +300,8 @@ function EnhanceContrast(){
else { else {
// Get status // Get status
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
durchlaufe = durchlaufe + 1;
try { try {
xhttp.open("GET", domainname + "/statusflow", false); xhttp.open("GET", domainname + "/statusflow", false);
xhttp.send(); 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(); task();
}, 1); }, 1);
} }
@@ -393,8 +427,14 @@ function LoadReference(){
function init() { function init() {
openDescription(); 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)) { if (!loadConfig(domainname)) {
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000); firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
return; return;
@@ -404,18 +444,13 @@ function init() {
param = getConfigParameters(); param = getConfigParameters();
cofcat = getConfigCategory(); cofcat = getConfigCategory();
document.getElementById("savemarker").disabled = true;
document.getElementById("enhancecontrast").disabled = true;
canvas.addEventListener('mousedown', mouseDown, false); canvas.addEventListener('mousedown', mouseDown, false);
canvas.addEventListener('mouseup', mouseUp, false); canvas.addEventListener('mouseup', mouseUp, false);
canvas.addEventListener('mousemove', mouseMove, false); canvas.addEventListener('mousemove', mouseMove, false);
loadCanvas(domainname + "/fileserver/config/reference.jpg"); loadCanvas(domainname + "/fileserver/config/reference.jpg");
//CopyReferenceToImgTmp(domainname);
refInfo = GetReferencesInfo(); refInfo = GetReferencesInfo();
//UpdateReference();
LoadReference(); LoadReference();
drawImage(); drawImage();
draw(); draw();
@@ -432,15 +467,16 @@ function drawImage(){
} }
function CutOutReference(){ function CutOutReference(){
document.getElementById("overlay").style.display = "block";
document.getElementById("overlaytext").innerHTML = "Updating marker...";
refInfo[aktindex]["x"] = document.getElementById("refx").value; refInfo[aktindex]["x"] = document.getElementById("refx").value;
refInfo[aktindex]["y"] = document.getElementById("refy").value; refInfo[aktindex]["y"] = document.getElementById("refy").value;
refInfo[aktindex]["dx"] = document.getElementById("refdx").value; refInfo[aktindex]["dx"] = document.getElementById("refdx").value;
refInfo[aktindex]["dy"] = document.getElementById("refdy").value; refInfo[aktindex]["dy"] = document.getElementById("refdy").value;
var enhanceCon = false; var enhanceCon = false;
var durchlaufe = 0;
document.getElementById("overlay").style.display = "block";
document.getElementById("overlaytext").innerHTML = "Updating marker...";
function sleep(ms) { function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
@@ -448,12 +484,24 @@ function CutOutReference(){
async function task() { async function task() {
while (true) { 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); var ret = MakeRefImageZW(refInfo[aktindex], enhanceCon, domainname);
if (ret) { if (ret) {
UpdateReference(); 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"; document.getElementById("overlay").style.display = "none";
if (aktindex == 0) { if (aktindex == 0) {
@@ -467,6 +515,8 @@ function CutOutReference(){
else { else {
// Get status // Get status
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
durchlaufe = durchlaufe + 1;
try { try {
xhttp.open("GET", domainname + "/statusflow", false); xhttp.open("GET", domainname + "/statusflow", false);
xhttp.send(); 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(); task();
}, 1); }, 1);
} }
@@ -536,6 +587,21 @@ function mouseDown(e) {
drag = true; 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() { function mouseUp() {
drag = false; drag = false;

View File

@@ -2108,8 +2108,6 @@ function cameraParameterChanged() {
} }
function LoadConfigNeu() { function LoadConfigNeu() {
domainname = getDomainname();
if (!loadConfig(domainname)) { if (!loadConfig(domainname)) {
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000); firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
return; return;
@@ -2622,8 +2620,6 @@ function saveTextAsFile() {
} }
function camSettingsSet(){ function camSettingsSet(){
var domainname = getDomainname();
document.getElementById("overlay").style.display = "block"; document.getElementById("overlay").style.display = "block";
document.getElementById("overlaytext").innerHTML = "Save Cam Settings..."; document.getElementById("overlaytext").innerHTML = "Save Cam Settings...";
@@ -2765,29 +2761,27 @@ function camSettingsSet(){
var _zoomy_temp = document.getElementById("TakeImage_CamZoomOffsetY_value1").value; var _zoomy_temp = document.getElementById("TakeImage_CamZoomOffsetY_value1").value;
var _zooms_temp = document.getElementById("TakeImage_CamZoomSize_value1").value; var _zooms_temp = document.getElementById("TakeImage_CamZoomSize_value1").value;
// bei einmal Alles senden kommt es zu problemen!!!!!!!!!!!!!!!!!!!! var url = domainname + "/editflow?task=cam_settings";
var url_1 = domainname + "/editflow?task=cam_settings";
url_1 = url_1 + "&waitb=" + _waitb_temp + "&aecgc=" + _aecgc_temp + "&qual=" + _qual_temp; if (domainname.length > 0){
url_1 = url_1 + "&bri=" + _bri_temp + "&con=" + _con_temp + "&sat=" + _sat_temp + "&shp=" + _shp_temp + "&ashp=" + _ashp_temp; url = url + "&host=" + domainname;
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;
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;
var url_2 = domainname + "/editflow?task=cam_settings"; url = url + "&agc=" + _agc_temp + "&agcg=" + _agcg_temp + "&bpc=" + _bpc_temp + "&wpc=" + _wpc_temp;
url_2 = url_2 + "&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_2 = url_2 + "&rgma=" + _rgma_temp + "&lenc=" + _lenc_temp + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp; url = url + "&dcw=" + _dcw_temp + "&den=" + _denoise_temp + "&ledi=" + _ledi_temp;
url_2 = url_2 + "&dcw=" + _dcw_temp + "&den=" + _denoise_temp + "&ledi=" + _ledi_temp;
if (_zoom_temp != '0') { if (_zoom_temp != '0') {
url_2 = url_2 + "&zoom=" + _zoom_temp + "&zooms=" + _zooms_temp; url = url + "&zoom=" + _zoom_temp + "&zooms=" + _zooms_temp;
url_2 = url_2 + "&zoomx=" + _zoomx_temp + "&zoomy=" + _zoomy_temp; url = url + "&zoomx=" + _zoomx_temp + "&zoomy=" + _zoomy_temp;
} }
else { else {
url_2 = url_2 + "&zoom=0" + "&zooms=0" + "&zoomx=0" + "&zoomy=0"; url = url + "&zoom=0" + "&zooms=0" + "&zoomx=0" + "&zoomy=0";
}
if (domainname.length > 0){
url_1 = url_1 + "&host=" + domainname;
url_2 = url_2 + "&host=" + domainname;
} }
var durchlaufe = 0; var durchlaufe = 0;
@@ -2798,24 +2792,22 @@ function camSettingsSet(){
async function task() { async function task() {
while (true) { while (true) {
var xhttp1 = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
var xhttp2 = new XMLHttpRequest();
if (durchlaufe > 10) { if (durchlaufe > 10) {
document.getElementById("overlay").style.display = "none"; 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; return;
} }
try { try {
xhttp1.open("GET", url_1, false); xhttp.open("GET", url, false);
xhttp1.send(); xhttp.send();
xhttp2.open("GET", url_2, false);
xhttp2.send();
} catch (error){} } catch (error){}
if ((xhttp1.responseText == "CamSettingsSet") && (xhttp2.responseText == "CamSettingsSet")) { if (xhttp.responseText == "CamSettingsSet") {
document.getElementById("overlay").style.display = "none"; document.getElementById("overlay").style.display = "none";
firework.launch('Cam Settings saved', 'success', 2000);
return; return;
} }
else { else {
@@ -2836,14 +2828,15 @@ function camSettingsSet(){
} }
} }
setTimeout(function() { // Delay so the overlay gets shown setTimeout(function() {
// Delay so the overlay gets shown
task(); task();
}, 1); }, 1);
} }
function doReboot() { function doReboot() {
if (confirm("Are you sure you want to reboot?")) { if (confirm("Are you sure you want to reboot?")) {
var stringota = getDomainname() + "/reboot"; var stringota = domainname + "/reboot";
window.location = stringota; window.location = stringota;
window.location.href = stringota; window.location.href = stringota;
window.location.assign(stringota); window.location.assign(stringota);
@@ -2861,7 +2854,7 @@ function FormatDecimalValue(_param, _cat, _name) {
function editConfigRaw() { function editConfigRaw() {
if (confirm("Proceed to switch to raw edit mode? Unsaved changes will get lost")) { 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 = stringota;
window.location.href = stringota; window.location.href = stringota;
window.location.assign(stringota); window.location.assign(stringota);

View File

@@ -391,6 +391,7 @@
<script language="JavaScript"> <script language="JavaScript">
var canvas = document.getElementById('canvas'), var canvas = document.getElementById('canvas'),
domainname = getDomainname(),
context = canvas.getContext('2d'), context = canvas.getContext('2d'),
imageObj = new Image(), imageObj = new Image(),
isActReference = false, isActReference = false,
@@ -399,7 +400,7 @@
function doReboot() { function doReboot() {
if (confirm("Are you sure you want to reboot? Did you save the config?")) { 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 = stringota;
window.location.href = stringota; window.location.href = stringota;
window.location.assign(stringota); window.location.assign(stringota);
@@ -437,8 +438,6 @@
// Create New Reference, Update Image // Create New Reference, Update Image
function doTakeReference(){ function doTakeReference(){
var domainname = getDomainname();
document.getElementById("overlay").style.display = "block"; document.getElementById("overlay").style.display = "block";
document.getElementById("overlaytext").innerHTML = "Taking new image..."; document.getElementById("overlaytext").innerHTML = "Taking new image...";
@@ -554,6 +553,11 @@
var _effect_temp = document.getElementById("TakeImage_CamSpecialEffect_value1").selectedIndex; var _effect_temp = document.getElementById("TakeImage_CamSpecialEffect_value1").selectedIndex;
var url = domainname + "/editflow?task=test_take"; 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 + "&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; url = url + "&ashp=" + _ashp_temp + "&ledi=" + _ledi_temp + "&spe=" + _effect_temp + "&zoom=" + _zoom_temp;
@@ -566,10 +570,6 @@
url = url + "&aec=" + _aec_temp + "&ael=" + _ael_temp + "&aec2=" + _aec2_temp; url = url + "&aec=" + _aec_temp + "&ael=" + _ael_temp + "&aec2=" + _aec2_temp;
url = url + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp; url = url + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp;
if (domainname.length > 0){
url = url + "&host=" + domainname;
}
var durchlaufe = 0; var durchlaufe = 0;
@@ -581,9 +581,9 @@
while (true) { while (true) {
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
if (durchlaufe > 15) { if (durchlaufe > 10) {
document.getElementById("overlay").style.display = "none"; document.getElementById("overlay").style.display = "none";
firework.launch('Image capture aborted, timeout!', 'warning', 5000); firework.launch('Image capture aborted, timeout!', 'danger', 5000);
return; return;
} }
@@ -596,6 +596,9 @@
var _url = domainname + "/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1); var _url = domainname + "/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);
loadCanvas(_url, true); loadCanvas(_url, true);
isActReference = false; isActReference = false;
document.getElementById("overlay").style.display = "none";
firework.launch('Image capture completed, please wait until it loads...', 'success', 5000);
return; return;
} }
@@ -617,14 +620,13 @@
} }
} }
setTimeout(function() { // Delay so the overlay gets shown setTimeout(function() {
// Delay so the overlay gets shown
task(); task();
}, 1); }, 1);
} }
function camSettingsSet(){ function camSettingsSet(){
var domainname = getDomainname();
document.getElementById("overlay").style.display = "block"; document.getElementById("overlay").style.display = "block";
document.getElementById("overlaytext").innerHTML = "Save Cam Settings..."; document.getElementById("overlaytext").innerHTML = "Save Cam Settings...";
@@ -690,7 +692,12 @@
var _ael_temp = document.getElementById("TakeImage_CamAeLevel_value1").value; var _ael_temp = document.getElementById("TakeImage_CamAeLevel_value1").value;
var _effect_temp = document.getElementById("TakeImage_CamSpecialEffect_value1").selectedIndex; var _effect_temp = document.getElementById("TakeImage_CamSpecialEffect_value1").selectedIndex;
var url = domainname + "/editflow?task=cam_settings"; 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 + "&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; url = url + "&ashp=" + _ashp_temp + "&ledi=" + _ledi_temp + "&spe=" + _effect_temp + "&zoom=" + _zoom_temp;
@@ -703,10 +710,6 @@
url = url + "&aec=" + _aec_temp + "&ael=" + _ael_temp + "&aec2=" + _aec2_temp; url = url + "&aec=" + _aec_temp + "&ael=" + _ael_temp + "&aec2=" + _aec2_temp;
url = url + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp; url = url + "&mirror=" + _mirror_temp + "&flip=" + _flip_temp;
if (domainname.length > 0){
url = url + "&host=" + domainname;
}
var durchlaufe = 0; var durchlaufe = 0;
@@ -718,9 +721,9 @@
while (true) { while (true) {
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
if (durchlaufe > 15) { if (durchlaufe > 10) {
document.getElementById("overlay").style.display = "none"; 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; return;
} }
@@ -731,6 +734,7 @@
if (xhttp.responseText == "CamSettingsSet") { if (xhttp.responseText == "CamSettingsSet") {
document.getElementById("overlay").style.display = "none"; document.getElementById("overlay").style.display = "none";
firework.launch('Cam Settings saved', 'success', 2000);
return; return;
} }
else { else {
@@ -745,19 +749,20 @@
catch (error){} catch (error){}
document.getElementById("overlaytext").innerHTML = "Device is busy, plase waiting...<br><br>Current step: " + _xhttp.responseText; 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); await sleep(2000);
} }
} }
} }
setTimeout(function() { // Delay so the overlay gets shown setTimeout(function() {
// Delay so the overlay gets shown
task(); task();
}, 1); }, 1);
} }
function showReference(){ 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); loadCanvas(url, false);
isActReference = true; isActReference = true;
@@ -830,8 +835,6 @@
} }
function SaveReference(){ function SaveReference(){
var domainname = getDomainname();
param["Alignment"]["InitialRotate"].value1 = (Number(document.getElementById("PreRotateAngle_value1").value) + param["Alignment"]["InitialRotate"].value1 = (Number(document.getElementById("PreRotateAngle_value1").value) +
Number(document.getElementById("FineRotate_value1").value)).toFixed(1); Number(document.getElementById("FineRotate_value1").value)).toFixed(1);
@@ -873,7 +876,6 @@
function init() { function init() {
openDescription(); openDescription();
domainname = getDomainname();
if (!loadConfig(domainname)) { if (!loadConfig(domainname)) {
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000); firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);