mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
Use raw value as prevalue (#1405)
* remove loggng password * use raw value of selected number as default value * fix log message Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
@@ -265,7 +265,7 @@ extern "C" void app_main(void)
|
|||||||
} else { // Test Camera
|
} else { // Test Camera
|
||||||
camera_fb_t * fb = esp_camera_fb_get();
|
camera_fb_t * fb = esp_camera_fb_get();
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Camera cannot be initialzed. Will restart in 5 minutes!");
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Camera Framebuffer cannot be initialzed. Will restart in 5 minutes!");
|
||||||
initSucessful = false;
|
initSucessful = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ input[type=number] {
|
|||||||
<div id="prevalue"></div>
|
<div id="prevalue"></div>
|
||||||
<h3>Set Value:</h3><p>
|
<h3>Set Value:</h3><p>
|
||||||
Input (Format = 123.456):<p>
|
Input (Format = 123.456):<p>
|
||||||
PreValue:
|
Previous Value:
|
||||||
<input type="number" id="myInput" name="myInput"
|
<input type="number" id="myInput" name="myInput"
|
||||||
pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
|
pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
|
||||||
title="This should be a number with up to 4 decimal places.">
|
title="This should be a number with up to 4 decimal places.">
|
||||||
<p></p>
|
<p></p>
|
||||||
<button class="button" type="button" onclick="setprevalue()">Set PreValue</button>
|
<button class="button" type="button" onclick="setprevalue()">Set Previous Value</button>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<h3>Result:</h3><p>
|
<h3>Result:</h3><p>
|
||||||
@@ -90,30 +90,56 @@ function setprevalue() {
|
|||||||
response = xhttp.responseText;
|
response = xhttp.responseText;
|
||||||
document.getElementById("result").innerHTML=response;
|
document.getElementById("result").innerHTML=response;
|
||||||
}
|
}
|
||||||
catch (error)
|
catch (error)
|
||||||
{
|
{
|
||||||
// alert("Deleting Config.ini failed");
|
alert("Failed to get data from device!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPrevalue(_basepath) {
|
function loadPrevalue(_basepath) {
|
||||||
var sel = document.getElementById("Numbers_value1");
|
// Get current Pre Value
|
||||||
var _number = sel.options[sel.selectedIndex].text;
|
var sel = document.getElementById("Numbers_value1");
|
||||||
|
var _number = sel.options[sel.selectedIndex].text;
|
||||||
|
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
try {
|
try {
|
||||||
url = _basepath + '/setPreValue?numbers=' + _number;
|
url = _basepath + '/setPreValue?numbers=' + _number;
|
||||||
xhttp.open("GET", url, false);
|
xhttp.open("GET", url, false);
|
||||||
xhttp.send();
|
xhttp.send();
|
||||||
response = xhttp.responseText;
|
response = xhttp.responseText;
|
||||||
document.getElementById("prevalue").innerHTML=response;
|
document.getElementById("prevalue").innerHTML=response;
|
||||||
document.getElementById("myInput").value=response;
|
}
|
||||||
}
|
catch (error)
|
||||||
catch (error)
|
{
|
||||||
{
|
alert("Failed to get data from device!");
|
||||||
// alert("Deleting Config.ini failed");
|
}
|
||||||
}
|
|
||||||
return true;
|
// Get current RAW Value
|
||||||
|
var sel = document.getElementById("Numbers_value1");
|
||||||
|
var _number = sel.options[sel.selectedIndex].text;
|
||||||
|
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
try {
|
||||||
|
url = _basepath + '/value?all=true&type=raw';
|
||||||
|
xhttp.open("GET", url, false);
|
||||||
|
xhttp.send();
|
||||||
|
response = xhttp.responseText;
|
||||||
|
|
||||||
|
lines = response.split(/\r?\n/);
|
||||||
|
|
||||||
|
lines.forEach(function(line) {
|
||||||
|
arr = line.split("\t");
|
||||||
|
if (_number == arr[0]) {
|
||||||
|
document.getElementById("myInput").value=arr[1];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (error)
|
||||||
|
{
|
||||||
|
alert("Failed to get data from device!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ function ZerlegeZeile(input, delimiter = " =\t\r")
|
|||||||
* equal sign, if the key is "password"
|
* equal sign, if the key is "password"
|
||||||
*/
|
*/
|
||||||
if (input.includes("password")) { // Line contains a password, use the equal sign as the only delimiter and only split on first occurrence
|
if (input.includes("password")) { // Line contains a password, use the equal sign as the only delimiter and only split on first occurrence
|
||||||
console.log(input);
|
|
||||||
var pos = input.indexOf("=");
|
var pos = input.indexOf("=");
|
||||||
Output.push(trim(input.substr(0, pos), delimiter));
|
Output.push(trim(input.substr(0, pos), delimiter));
|
||||||
Output.push(trim(input.substr(pos +1, input.length), delimiter));
|
Output.push(trim(input.substr(pos +1, input.length), delimiter));
|
||||||
|
|||||||
Reference in New Issue
Block a user