mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 12:06:58 +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
|
||||
camera_fb_t * fb = esp_camera_fb_get();
|
||||
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;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -52,12 +52,12 @@ input[type=number] {
|
||||
<div id="prevalue"></div>
|
||||
<h3>Set Value:</h3><p>
|
||||
Input (Format = 123.456):<p>
|
||||
PreValue:
|
||||
Previous Value:
|
||||
<input type="number" id="myInput" name="myInput"
|
||||
pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
|
||||
title="This should be a number with up to 4 decimal places.">
|
||||
<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>
|
||||
<h3>Result:</h3><p>
|
||||
@@ -92,11 +92,12 @@ function setprevalue() {
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
// alert("Deleting Config.ini failed");
|
||||
alert("Failed to get data from device!");
|
||||
}
|
||||
}
|
||||
|
||||
function loadPrevalue(_basepath) {
|
||||
// Get current Pre Value
|
||||
var sel = document.getElementById("Numbers_value1");
|
||||
var _number = sel.options[sel.selectedIndex].text;
|
||||
|
||||
@@ -107,13 +108,38 @@ function loadPrevalue(_basepath) {
|
||||
xhttp.send();
|
||||
response = xhttp.responseText;
|
||||
document.getElementById("prevalue").innerHTML=response;
|
||||
document.getElementById("myInput").value=response;
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
// alert("Deleting Config.ini failed");
|
||||
alert("Failed to get data from device!");
|
||||
}
|
||||
|
||||
// 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!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ function ZerlegeZeile(input, delimiter = " =\t\r")
|
||||
* 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
|
||||
console.log(input);
|
||||
var pos = input.indexOf("=");
|
||||
Output.push(trim(input.substr(0, pos), delimiter));
|
||||
Output.push(trim(input.substr(pos +1, input.length), delimiter));
|
||||
|
||||
Reference in New Issue
Block a user