This commit is contained in:
jomjol
2020-09-07 11:31:50 +02:00
parent 341e9f1593
commit f81f0fa58b
6 changed files with 22 additions and 65 deletions

View File

@@ -25,12 +25,14 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
------ ------
**General remark:** beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
##### 1.1.1 (2020-09-07)
##### 1.1.2 (2020-09-07)
* Improved update page for the web server (`/html` can be updated via a zip-file, which is provided in `/firmware/html.zip`) * Improved update page for the web server (`/html` can be updated via a zip-file, which is provided in `/firmware/html.zip`)
**Attention: beside the `firmware.bin`, also the content of `/html` needs to be updated!** * Improved Chrome support
##### 1.1.0 (2020-09-06) ##### 1.1.0 (2020-09-06)

Binary file not shown.

View File

@@ -75,7 +75,7 @@
<img id="img_ref" src = "/img_tmp/ref_zw.jpg"> <img id="img_ref" src = "/img_tmp/ref_zw.jpg">
</td> </td>
<td> <td>
<input type="button" value="Enhance Contrast" onclick="EnhanceContrast()"> <input type="button" id="enhancecontrast" value="Enhance Contrast" onclick="EnhanceContrast()">
</td> </td>
</tr> </tr>
</table> </table>
@@ -119,7 +119,6 @@ function SaveToConfig(){
refInfo["dx"] = document.getElementById("refdx").value; refInfo["dx"] = document.getElementById("refdx").value;
refInfo["dy"] = document.getElementById("refdy").value; refInfo["dy"] = document.getElementById("refdy").value;
UpdateConfig(refInfo, aktindex, enhanceCon, basepath); UpdateConfig(refInfo, aktindex, enhanceCon, basepath);
// location.reload();
} }
function EnhanceContrast(){ function EnhanceContrast(){
@@ -159,6 +158,7 @@ function UpdateReference(){
document.getElementById("refy").value = refInfo["y"]; document.getElementById("refy").value = refInfo["y"];
rect.startX = document.getElementById("refx").value; rect.startX = document.getElementById("refx").value;
rect.startY = document.getElementById("refy").value; rect.startY = document.getElementById("refy").value;
document.getElementById("enhancecontrast").disabled = true;
draw(); draw();
} }
@@ -177,58 +177,6 @@ function dataURLtoBlob(dataurl) {
return new Blob([u8arr], {type:mime}); return new Blob([u8arr], {type:mime});
} }
function SaveReference()
{
if (confirm("Are you sure you want to update \"reference.jpg\"?")) {
var xhttp = new XMLHttpRequest();
/* first delete the old firmware */
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
/* keine Reaktion, damit sich das Dokument nicht ändert */
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
location.reload()
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
location.reload()
}
}
};
xhttp.open("POST", basepath + "/delete/config/reference.jpg", false);
xhttp.send();
/* ----------------------------- */
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
alert("Update \"reference.jpg\" successfull!\n\nTo make it active you need to reboot.")
document.reload();
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
location.reload()
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
location.reload()
}
}
};
upload_path = basepath + "/upload/config/reference.jpg";
var canvas = document.getElementById("canvas");
var JPEG_QUALITY=0.5;
var dataUrl = canvas.toDataURL('image/jpeg', JPEG_QUALITY);
var rtn = dataURLtoBlob(dataUrl);
xhttp.open("POST", upload_path, true);
xhttp.send(rtn);
}
}
function loadCanvas(dataURL) { function loadCanvas(dataURL) {
var canvas = document.getElementById('canvas'); var canvas = document.getElementById('canvas');
@@ -289,6 +237,7 @@ function dataURLtoBlob(dataurl) {
document.getElementById("img_ref_org").src = url; document.getElementById("img_ref_org").src = url;
var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now(); var url = basepath + "/fileserver" + "/img_tmp/ref_zw_org.jpg?" + Date.now();
document.getElementById("img_ref").src = url; document.getElementById("img_ref").src = url;
document.getElementById("enhancecontrast").disabled = false;
draw(); draw();
} }

View File

@@ -152,8 +152,7 @@ function ChangeSelection(){
function SaveToConfig(){ function SaveToConfig(){
SaveROIToConfig(ROIInfo, "[Analog]", basepath); SaveROIToConfig(ROIInfo, "[Analog]", basepath);
UpdatePage();
location.reload();
} }
@@ -218,6 +217,7 @@ function ParseIni(_basepath) {
canvas.width = this.width; canvas.width = this.width;
canvas.height = this.height; canvas.height = this.height;
drawImage(); drawImage();
draw();
}; };
imageObj.src = dataURL; imageObj.src = dataURL;

View File

@@ -152,9 +152,6 @@ function ChangeSelection(){
function SaveToConfig(){ function SaveToConfig(){
SaveROIToConfig(ROIInfo, "[Digits]", basepath); SaveROIToConfig(ROIInfo, "[Digits]", basepath);
// location.reload();
// parent.window.location.reload(true);
// window.location = location.href + '?session=' + Math.floor((Math.random() * 1000000) + 1);
UpdatePage(); UpdatePage();
} }
@@ -220,6 +217,7 @@ function ParseIni(_basepath) {
canvas.width = this.width; canvas.width = this.width;
canvas.height = this.height; canvas.height = this.height;
drawImage(); drawImage();
draw();
}; };
imageObj.src = dataURL; imageObj.src = dataURL;
@@ -249,6 +247,7 @@ function ParseIni(_basepath) {
loadCanvas(basepath + "/fileserver/config/reference.jpg"); loadCanvas(basepath + "/fileserver/config/reference.jpg");
ParseIni(basepath); ParseIni(basepath);
drawImage(); drawImage();
draw();
} }
function drawImage(){ function drawImage(){
var canvas = document.getElementById('canvas'); var canvas = document.getElementById('canvas');

View File

@@ -49,7 +49,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="button" value="Update Reference Image" onclick="SaveReference()"> <input type="button" id="updatereferenceimage" value="Update Reference Image" onclick="SaveReference()">
</td> </td>
</tr> </tr>
</table> </table>
@@ -70,6 +70,7 @@
document.getElementById("prerotateangle").value = getPreRotate(); document.getElementById("prerotateangle").value = getPreRotate();
document.getElementById("finerotate").disabled = false; document.getElementById("finerotate").disabled = false;
document.getElementById("prerotateangle").disabled = false; document.getElementById("prerotateangle").disabled = false;
document.getElementById("updatereferenceimage").disabled = false;
// document.getElementById("ButtonRotate").disabled = false; // document.getElementById("ButtonRotate").disabled = false;
loadCanvas(url); loadCanvas(url);
drawRotated(); drawRotated();
@@ -81,6 +82,7 @@
document.getElementById("prerotateangle").value = 0; document.getElementById("prerotateangle").value = 0;
document.getElementById("finerotate").disabled = true; document.getElementById("finerotate").disabled = true;
document.getElementById("prerotateangle").disabled = true; document.getElementById("prerotateangle").disabled = true;
document.getElementById("updatereferenceimage").disabled = true;
// document.getElementById("ButtonRotate").disabled = true; // document.getElementById("ButtonRotate").disabled = true;
loadCanvas(url); loadCanvas(url);
ParseConfig(); ParseConfig();
@@ -101,8 +103,10 @@
setPreRotate(document.getElementById("prerotateangle").value); setPreRotate(document.getElementById("prerotateangle").value);
UpdateConfigFile(basepath); UpdateConfigFile(basepath);
var canvas = document.getElementById("canvas"); var canvas = document.getElementById("canvas");
drawRotated(false);
SaveCanvasToImage(canvas, "/config/reference.jpg", true, basepath); SaveCanvasToImage(canvas, "/config/reference.jpg", true, basepath);
showReference(); showReference();
UpdatePage();
} }
} }
@@ -140,7 +144,7 @@
showReference(); showReference();
} }
function drawRotated(){ function drawRotated(_grid = true){
finerot= parseFloat(document.getElementById("finerotate").value); finerot= parseFloat(document.getElementById("finerotate").value);
prerot = parseFloat(document.getElementById("prerotateangle").value); prerot = parseFloat(document.getElementById("prerotateangle").value);
if (finerot == 1) { if (finerot == 1) {
@@ -164,9 +168,12 @@
context.rotate(degrees*Math.PI/180); context.rotate(degrees*Math.PI/180);
context.drawImage(imageObj,-imageObj.width/2,-imageObj.height/2); context.drawImage(imageObj,-imageObj.width/2,-imageObj.height/2);
context.restore(); context.restore();
if (_grid == true){
drawGrid(); drawGrid();
} }
}
function drawGrid(){ function drawGrid(){
var canvas = document.getElementById('canvas'); var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');