Merge branch 'pr/952' into rolling

This commit is contained in:
jomjol
2022-08-31 19:58:04 +02:00
9 changed files with 148 additions and 27 deletions

View File

@@ -116,18 +116,19 @@ th, td {
<tr>
<td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()" tabindex=2></td>
<td>dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()" tabindex=4></td>
<td rowspan="2"><label for="lockAR"> Lock aspect ratio: </label><input type="checkbox" id="lockAR" name="lockAR" value="1" onclick="changelockAR()" checked tabindex=6></td>
<td rowspan="1"><label for="lockAR"> Lock aspect ratio: </label><input type="checkbox" id="lockAR" name="lockAR" value="1" onclick="changelockAR()" checked tabindex=6></td>
</tr>
<tr>
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()" tabindex=3></td>
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()" tabindex=5></td>
<td rowspan="1"><label for="CCW"> Counter-Clockwise Rotation: </label><input type="checkbox" id="CCW" name="CCW" value="0" onclick="changeCCW()" unchecked tabindex=7></td>
</tr>
</table>
</div>
<table>
<tr>
<td><input class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini" tabindex=7></td>
<td><input class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini" tabindex=8></td>
</tr>
<tr>
<td><button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate saved config</button></td>
@@ -216,9 +217,9 @@ function newROI(){
var _roinew = prompt("Please enter name of new ROI", "name");
if (ROIInfo.length > 0)
erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"]);
erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"], ROIInfo[aktindex]["CCW"]=="true");
else
erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, 30, 30);
erg = CreateROI(_number, "analog", sel.selectedIndex, _roinew, 1, 1, 30, 30, false);
if (erg != "")
alert(erg);
@@ -246,6 +247,17 @@ function changelockAR(){
lockAR = document.getElementById("lockAR").checked;
}
function changeCCW(){
var sel = document.getElementById("Numbers_value1");
var _number = sel.options[sel.selectedIndex].text;
ROIInfo = getROIInfo("analog", _number);
aktindex = parseInt(document.getElementById("index").value);
ROIInfo[aktindex]["CCW"] = document.getElementById("CCW").checked;
UpdateROIs();
}
function ChangeSelection(){
aktindex = parseInt(document.getElementById("index").value);
// lockAR = true;
@@ -261,7 +273,7 @@ function SaveToConfig(){
}
function UpdateROIs(){
function UpdateROIs(_sel){
document.getElementById("Category_Analog_enabled").checked = true;
var sel = document.getElementById("Numbers_value1");
var _number = sel.options[sel.selectedIndex].text;
@@ -332,6 +344,8 @@ function UpdateROIs(){
document.getElementById("refy").value = ROIInfo[aktindex]["y"];
document.getElementById("refdx").value = ROIInfo[aktindex]["dx"];
document.getElementById("refdy").value = ROIInfo[aktindex]["dy"];
document.getElementById("CCW").checked = ROIInfo[aktindex]["CCW"] == "true";
rect.startX = ROIInfo[aktindex]["x"];
rect.startY = ROIInfo[aktindex]["y"];
rect.w = ROIInfo[aktindex]["dx"];

View File

@@ -209,9 +209,9 @@ function newROI() {
var _roinew = prompt("Please enter name of new ROI", "name");
if (ROIInfo.length > 0)
erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"]);
erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, ROIInfo[aktindex]["dx"], ROIInfo[aktindex]["dy"], 0);
else
erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, 30, 51);
erg = CreateROI(_number, "digit", sel.selectedIndex, _roinew, 1, 1, 30, 51, 0);
if (erg != "")
alert(erg);

View File

@@ -236,9 +236,9 @@ function ParseConfigParamAll(_aktline, _catname){
let [isCom, input] = isCommented(_input);
var linesplit = ZerlegeZeile(input);
ParamExtractValueAll(param, linesplit, _catname, _aktline, isCom);
if (!isCom && (linesplit.length == 5) && (_catname == 'Digits'))
if (!isCom && (linesplit.length == 6) && (_catname == 'Digits'))
ExtractROIs(input, "digit");
if (!isCom && (linesplit.length == 5) && (_catname == 'Analog'))
if (!isCom && (linesplit.length == 6) && (_catname == 'Analog'))
ExtractROIs(input, "analog");
if (!isCom && (linesplit.length == 3) && (_catname == 'Alignment'))
{
@@ -398,6 +398,7 @@ function WriteConfigININew()
text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["y"];
text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["dx"];
text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["dy"];
text = text + " " + NUMBERS[_roi]["digit"][_roiddet]["CCW"];
config_split.push(text);
}
}
@@ -416,6 +417,7 @@ function WriteConfigININew()
text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["y"];
text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["dx"];
text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["dy"];
text = text + " " + NUMBERS[_roi]["analog"][_roiddet]["CCW"];
config_split.push(text);
}
}
@@ -484,6 +486,7 @@ function ExtractROIs(_aktline, _type){
abc["dx"] = linesplit[3];
abc["dy"] = linesplit[4];
abc["ar"] = parseFloat(linesplit[3]) / parseFloat(linesplit[4]);
abc["CCW"] = linesplit[5];
}
@@ -712,7 +715,7 @@ function DeleteNUMBER(_delte){
return "";
}
function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy){
function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy, _CCW){
_indexnumber = -1;
for (j = 0; j < NUMBERS.length; ++j)
if (NUMBERS[j]["name"] == _number)
@@ -735,6 +738,7 @@ function CreateROI(_number, _type, _pos, _roinew, _x, _y, _dx, _dy){
_ret["dx"] = _dx;
_ret["dy"] = _dy;
_ret["ar"] = _dx / _dy;
_ret["CCW"] = _CCW;
NUMBERS[_indexnumber][_type].splice(_pos+1, 0, _ret);

View File

@@ -20,7 +20,7 @@
<table class="tg">
<tr>
<td class="tg-1" rowspan="9"><div id="img"></div></td>
<td class="tg-1" rowspan="9" style="vertical-align: top"><div id="img"></div></td>
<th class="th">Value:</th>
</tr>
<tr>
@@ -57,6 +57,8 @@
<td class="tg-3">
<div id="timestamp" ></div>
<div id="statusflow" ></div>
<div id="cputemp" ></div>
<div id="rssi" ></div>
</td>
</tr>
</table>
@@ -83,6 +85,8 @@ function addZero(i) {
$('#img').html('<img src="/img_tmp/alg_roi.jpg" style="max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
loadStatus();
loadCPUTemp();
loadRSSI();
refresh();
});
@@ -94,10 +98,10 @@ function refresh() {
var h = addZero(d.getHours());
var m = addZero(d.getMinutes());
var s = addZero(d.getSeconds());
// reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp
$('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'"max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
loadStatus();
init();
refresh();
}, 300000);
@@ -120,6 +124,32 @@ function refresh() {
xhttp.send();
}
function loadCPUTemp() {
url = basepath + '/cputemp.html';
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var _rsp = xhttp.responseText;
$('#cputemp').html(_rsp);
}
}
xhttp.open("GET", url, true);
xhttp.send();
}
function loadRSSI() {
url = basepath + '/rssi.html';
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var _rsp = xhttp.responseText;
$('#rssi').html(_rsp);
}
}
xhttp.open("GET", url, true);
xhttp.send();
}
function loadValue(_type, _div, _style) {
url = basepath + '/wasserzaehler.html?all=true&type=' + _type;
var xhttp = new XMLHttpRequest();
@@ -167,6 +197,8 @@ function refresh() {
loadValue("prevalue", "prevalue");
loadValue("error", "error", "font-size:8px");
loadStatus();
loadCPUTemp();
loadRSSI();
}
init();