Rolling 20220206

This commit is contained in:
jomjol
2022-02-06 19:50:47 +01:00
parent 641cc860d8
commit 11c33f81dd
25 changed files with 455 additions and 388 deletions

View File

@@ -291,7 +291,8 @@ textarea {
<class id="Digits_Model_text" style="color:black;">Model</class>
</td>
<td>
<input type="text" id="Digits_Model_value1">
<select id="Digits_Model_value1">
</select>
</td>
<td style="font-size: 80%;">
Path to CNN model file for image recognition
@@ -347,7 +348,10 @@ textarea {
<tr>
<td width="20px" style="padding-left: 40px;"> </td>
<td width="200px"> <class id="Analog_Model_text" style="color:black;">Model</class> </td>
<td> <input type="text" id="Analog_Model_value1"> </td>
<td>
<select id="Analog_Model_value1">
</select>
</td>
<td style="font-size: 80%;"> Path to CNN model file for image recognition</td>
</tr>
<tr>
@@ -466,7 +470,7 @@ textarea {
<tr>
<td style="padding-left: 40px;" colspan="4">
<br>
<b>Postprocessing Individual Paramters:
<b>Postprocessing Individual Parameters:
<select id="Numbers_value1" onchange="numberChanged()">
<option value="0" selected>default</option>
<option value="1" >NT</option>
@@ -1727,12 +1731,12 @@ function UpdateInput() {
WriteParameter(param, category, "Alignment", "SearchFieldY", false);
WriteParameter(param, category, "Alignment", "AlignmentAlgo", true);
WriteParameter(param, category, "Digits", "Model", false);
// WriteParameter(param, category, "Digits", "Model", false);
WriteParameter(param, category, "Digits", "LogImageLocation", true);
WriteParameter(param, category, "Digits", "LogfileRetentionInDays", true);
WriteParameter(param, category, "Digits", "ModelInputSize", false);
WriteParameter(param, category, "Analog", "Model", false);
// WriteParameter(param, category, "Analog", "Model", false);
WriteParameter(param, category, "Analog", "LogImageLocation", true);
WriteParameter(param, category, "Analog", "LogfileRetentionInDays", true);
// WriteParameter(param, category, "Analog", "ExtendedResolution", true);
@@ -1770,6 +1774,34 @@ function UpdateInput() {
WriteParameter(param, category, "System", "TimeZone", true);
WriteParameter(param, category, "System", "Hostname", true);
WriteParameter(param, category, "System", "TimeServer", true);
WriteModelFiles();
}
function WriteModelFiles()
{
list_tflite = getTFLITEList();
var _index1 = document.getElementById("Digits_Model_value1");
var _index2 = document.getElementById("Analog_Model_value1");
while (_index1.length)
_index1.remove(0);
while (_index2.length)
_index2.remove(0);
for (var i = 0; i < list_tflite.length; ++i){
var option1 = document.createElement("option");
var option2 = document.createElement("option");
option1.text = list_tflite[i];
option1.value = list_tflite[i];
option2.text = list_tflite[i];
option2.value = list_tflite[i];
_index1.add(option1);
_index2.add(option2);
}
WriteParameter(param, category, "Analog", "Model", false);
WriteParameter(param, category, "Digits", "Model", false);
}
function ReadParameterAll()

View File

@@ -13,7 +13,7 @@ function getbasepath(){
{
// host = "http://192.168.2.219"; // jomjol interner test
// host = "http://192.168.178.46"; // jomjol interner test
host = "http://192.168.178.62"; // jomjol interner Real
host = "http://192.168.178.60"; // jomjol interner Real
// host = "http://192.168.43.191";
// host = "."; // jomjol interner localhost

View File

@@ -112,7 +112,7 @@ li.dropdown {
var basepath = "http://192.168.178.22";
function LoadHostname() {
function LoadHostname() {
_basepath = getbasepath();

View File

@@ -8,7 +8,7 @@
<style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em;}
h3 {font-size: 1.2em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
input[type=number] {
@@ -114,6 +114,36 @@ input[type=number] {
</td>
</tr>
</table>
<h2>4. Upload neural network definition (tfl/tflite file)</h2>
<table class="fixed" border="0">
<tr>
<td>
<table border="0">
<tr>
<td>
<label for="newfiletfl">Select the tfl/tflite file</label>
</td>
<td colspan="2">
<input id="newfiletfl" type="file" onchange="setpathtfl()" style="width:100%;">
</td>
</tr>
<tr>
<td>
<label for="filepathtfl">Set path on server</label>
</td>
<td>
<input id="filepathtfl" type="text" style="width:100%;" readonly>
</td>
<td>
<button id="uploadtfl" type="button" onclick="uploadtfl()" disabled>Upload</button>
</td>
</tr>
</table>
</td>
</tr>
The file must be activated in the config.ini file.
</table>
<script type="text/javascript" src="./gethost.js"></script>
@@ -126,6 +156,7 @@ function init(){
document.getElementById("uploadhtml").disabled = true;
document.getElementById("doUpdate").disabled = true;
document.getElementById("doUpdatehtml").disabled = true;
document.getElementById("uploadtfl").disabled = true;
}
function doUpdate() {
@@ -203,6 +234,17 @@ function setpathhtml() {
}
function setpathtfl() {
var nameneu = document.getElementById("newfiletfl").value;
nameneu = nameneu.split(/[\\\/]/).pop();
var fileserverpraefix = "/config/" + nameneu;
document.getElementById("filepathtfl").value = fileserverpraefix;
document.getElementById("uploadtfl").disabled = false;
}
function upload() {
var xhttp = new XMLHttpRequest();
@@ -342,6 +384,74 @@ function uploadhtml() {
}
function uploadtfl() {
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!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
/* ----------------------------- */
var filePath = document.getElementById("filepathtfl").value;
var upload_path = "/upload/" + filePath;
var fileInput = document.getElementById("newfiletfl").files;
/* Max size of an individual file. Make sure this
* value is same as that set in file_server.c */
var MAX_FILE_SIZE = 2000*1024;
var MAX_FILE_SIZE_STR = "2000KB";
if (fileInput.length == 0) {
alert("No file selected!");
} else if (filePath.length == 0) {
alert("File path on server is not set!");
} else if (filePath.indexOf(' ') >= 0) {
alert("File path on server cannot have spaces!");
} else if (filePath[filePath.length-1] == '/') {
alert("File name not specified after path!");
} else if (fileInput[0].size > 2000*1024) {
alert("File size must be less than 2000KB!");
} else {
document.getElementById("newfiletfl").disabled = true;
document.getElementById("filepathtfl").disabled = true;
document.getElementById("uploadtfl").disabled = true;
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
alert("Upload successfull!")
document.getElementById("newfiletfl").disabled = false;
document.getElementById("filepathtfl").disabled = false;
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
var file = fileInput[0];
xhttp.open("POST", upload_path, true);
xhttp.send(file);
}
}
init();
</script>

View File

@@ -1,339 +0,0 @@
<html>
<head>
<link rel="icon" href="data:,">
<title>jomjol - AI on the edge</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript">
//<![CDATA[
//]]>
</script>
</head>
<body>
<button id="testupdownload" type="button" onclick="testupdownload()">UpDownload</button>
<h3>It is strongly recommended to update firmware and content of /html directory on SD-card at the same time!</h3>
<h2>1. Firmware Update</h2>
<table class="fixed" border="0">
<tr>
<td>
<table border="0">
<tr>
<td>
<label for="newfile">Select the firmware file</label>
</td>
<td colspan="2">
<input id="newfile" type="file" onchange="setpath()" style="width:100%;">
</td>
</tr>
<tr>
<td>
<label for="filepath">Set path on server</label>
</td>
<td>
<input id="filepath" type="text" style="width:100%;" readonly>
</td>
<td>
<button id="upload" type="button" onclick="upload()">Upload</button>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<button id="doUpdate" type="button" onclick="doUpdate()">Flash the firmware</button> (Takes about 60s)
</td>
</tr>
</table>
<h2>2. Update /html directory</h2>
<table class="fixed" border="0">
<tr>
<td>
<table border="0">
<tr>
<td>
<label for="newfilehtml">Select the zipped /html content</label>
</td>
<td colspan="2">
<input id="newfilehtml" type="file" onchange="setpathhtml()" style="width:100%;">
</td>
</tr>
<tr>
<td>
<label for="filepathhtml">Set path on server</label>
</td>
<td>
<input id="filepathhtml" type="text" style="width:100%;" readonly>
</td>
<td>
<button id="uploadhtml" type="button" onclick="uploadhtml()">Upload</button>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<button id="doUpdatehtml" type="button" onclick="doUpdatehtml()">Update "/html" directory</button>
</td>
</tr>
</table>
<h2>3. Reboot</h2>
<table class="fixed" border="0">
<tr>
<td>
<button id="reboot" type="button" onclick="doReboot()">Reboot to activate updates</button>
</td>
</tr>
</table>
<script type="text/javascript" src="./gethost.js"></script>
<script language="JavaScript">
function testupdownload(){
var xhr = new XMLHttpRequest();
xhr.open("get", "https://github.com/jomjol/AI-on-the-edge-device/raw/master/firmware/html.zip", true);
xhr.onload = function () {
xhr.close();
var xhr2 = new XMLHttpRequest();
xhr2.open("post", "/upload/firmware/html2.zip", true);
xhr2.send(xhr.response);
}
xhr.send();
}
function init(){
document.getElementById("reboot").disabled = true;
document.getElementById("upload").disabled = true;
document.getElementById("uploadhtml").disabled = true;
document.getElementById("doUpdate").disabled = true;
document.getElementById("doUpdatehtml").disabled = true;
}
function doUpdate() {
if (confirm("Are you sure to update the firmware?")) {
var stringota = "/ota?file=firmware.bin";
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
document.getElementById("reboot").disabled = false;
alert("Flash successfull - Reboot necessary to make changes active.");
/* keine Reaktion, damit sich das Dokument nicht ändert */
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
xhttp.open("GET", stringota, true);
xhttp.send();
}
}
function doUpdatehtml() {
if (confirm("Are you sure to update the /html content?")) {
var stringota = "/ota?task=unziphtml";
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
document.getElementById("reboot").disabled = false;
alert("Update /html successful!");
/* keine Reaktion, damit sich das Dokument nicht ändert */
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
xhttp.open("GET", stringota, true);
xhttp.send();
}
}
function doReboot() {
if (confirm("Are you sure you want to reboot the ESP32?")) {
var stringota = "/reboot";
window.location = stringota;
window.location.href = stringota;
window.location.assign(stringota);
window.location.replace(stringota);
}
}
function setpath() {
var fileserverpraefix = "/firmware/firmware.bin";
document.getElementById("filepath").value = fileserverpraefix;
document.getElementById("upload").disabled = false;
}
function setpathhtml() {
var fileserverpraefix = "/firmware/html.zip";
document.getElementById("filepathhtml").value = fileserverpraefix;
document.getElementById("uploadhtml").disabled = false;
}
function upload() {
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!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
xhttp.open("GET", "/ota?delete=firmware.bin", false);
xhttp.send();
/* ----------------------------- */
var filePath = document.getElementById("filepath").value;
var upload_path = "/upload/" + filePath;
var fileInput = document.getElementById("newfile").files;
/* Max size of an individual file. Make sure this
* value is same as that set in file_server.c */
var MAX_FILE_SIZE = 2000*1024;
var MAX_FILE_SIZE_STR = "2000KB";
if (fileInput.length == 0) {
alert("No file selected!");
} else if (filePath.length == 0) {
alert("File path on server is not set!");
} else if (filePath.indexOf(' ') >= 0) {
alert("File path on server cannot have spaces!");
} else if (filePath[filePath.length-1] == '/') {
alert("File name not specified after path!");
} else if (fileInput[0].size > 2000*1024) {
alert("File size must be less than 2000KB!");
} else {
document.getElementById("newfile").disabled = true;
document.getElementById("filepath").disabled = true;
document.getElementById("upload").disabled = true;
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
alert("Upload successfull!")
// document.reload();
document.getElementById("reboot").disabled = false;
document.getElementById("doUpdate").disabled = false;
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
var file = fileInput[0];
xhttp.open("POST", upload_path, true);
xhttp.send(file);
}
}
function uploadhtml() {
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!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
xhttp.open("GET", "/ota?delete=html.zip", false);
xhttp.send();
/* ----------------------------- */
var filePath = document.getElementById("filepathhtml").value;
var upload_path = "/upload/" + filePath;
var fileInput = document.getElementById("newfilehtml").files;
/* Max size of an individual file. Make sure this
* value is same as that set in file_server.c */
var MAX_FILE_SIZE = 2000*1024;
var MAX_FILE_SIZE_STR = "2000KB";
if (fileInput.length == 0) {
alert("No file selected!");
} else if (filePath.length == 0) {
alert("File path on server is not set!");
} else if (filePath.indexOf(' ') >= 0) {
alert("File path on server cannot have spaces!");
} else if (filePath[filePath.length-1] == '/') {
alert("File name not specified after path!");
} else if (fileInput[0].size > 2000*1024) {
alert("File size must be less than 2000KB!");
} else {
document.getElementById("newfilehtml").disabled = true;
document.getElementById("filepathhtml").disabled = true;
document.getElementById("uploadhtml").disabled = true;
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4) {
if (xhttp.status == 200) {
alert("Upload successfull!")
// document.reload();
document.getElementById("reboot").disabled = false;
document.getElementById("doUpdatehtml").disabled = false;
} else if (xhttp.status == 0) {
alert("Server closed the connection abruptly!");
UpdatePage();
} else {
alert(xhttp.status + " Error!\n" + xhttp.responseText);
UpdatePage();
}
}
};
var file = fileInput[0];
xhttp.open("POST", upload_path, true);
xhttp.send(file);
}
}
init();
</script>
</body></html>

View File

@@ -10,6 +10,38 @@ var ref = new Array(2);
var NUMBERS = new Array(0);
var REFERENCES = new Array(0);
function getTFLITEList() {
_basepath = getbasepath();
tflitelist = "";
var xhttp = new XMLHttpRequest();
xhttp.addEventListener('load', function(event) {
if (xhttp.status >= 200 && xhttp.status < 300) {
tflitelist = xhttp.responseText;
} else {
console.warn(request.statusText, request.responseText);
}
});
try {
url = _basepath + '/editflow.html?task=tflite';
xhttp.open("GET", url, false);
xhttp.send();
}
catch (error)
{
// alert("Loading Hostname failed");
}
tflitelist = tflitelist.split("\t");
tflitelist.pop();
return tflitelist;
}
function ParseConfig() {
config_split = config_gesamt.split("\n");
var aktline = 0;

View File

@@ -1 +1 @@
12.0.0
13.0.0