mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-12 22:47:01 +03:00
Rolling 20210701
This commit is contained in:
@@ -506,58 +506,18 @@ textarea {
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20px" style="padding-left: 40px;">
|
||||
<input type="checkbox" id="MQTT_Topic_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "Topic")' unchecked >
|
||||
<input type="checkbox" id="MQTT_MainTopic_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "MainTopic")' unchecked >
|
||||
</td>
|
||||
<td width="200px">
|
||||
<class id="MQTT_Topic_text" style="color:black;">Topic</class>
|
||||
<class id="MQTT_MainTopic_text" style="color:black;">MainTopic</class>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="MQTT_Topic_value1">
|
||||
<input type="text" id="MQTT_MainTopic_value1">
|
||||
</td>
|
||||
<td style="font-size: 80%;">
|
||||
MQTT topic, in which the value is registered
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20px" style="padding-left: 40px;">
|
||||
<input type="checkbox" id="MQTT_TopicError_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "TopicError")' unchecked >
|
||||
</td>
|
||||
<td width="200px">
|
||||
<class id="MQTT_TopicError_text" style="color:black;">TopicError</class>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="MQTT_TopicError_value1">
|
||||
</td>
|
||||
<td style="font-size: 80%;">
|
||||
MQTT topic, in which the error status is reported (empty = no error)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20px" style="padding-left: 40px;">
|
||||
<input type="checkbox" id="MQTT_TopicRate_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "TopicRate")' unchecked >
|
||||
</td>
|
||||
<td width="200px">
|
||||
<class id="MQTT_TopicRate_text" style="color:black;">TopicRate</class>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="MQTT_TopicRate_value1">
|
||||
</td>
|
||||
<td style="font-size: 80%;">
|
||||
MQTT topic, in which the flow rate [units / minute] is reported
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20px" style="padding-left: 40px;">
|
||||
<input type="checkbox" id="MQTT_TopicTimeStamp_enabled" value="1" onclick = 'InvertEnableItem("MQTT", "TopicTimeStamp")' unchecked >
|
||||
</td>
|
||||
<td width="200px">
|
||||
<class id="MQTT_TopicTimeStamp_text" style="color:black;">TopicTimeStamp</class>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="MQTT_TopicTimeStamp_value1">
|
||||
</td>
|
||||
<td style="font-size: 80%;">
|
||||
MQTT topic, reporting the last correct readout
|
||||
MQTT main topic, under which the counters are published. The single value will be published with the following key: MAINTOPIC/VALUE_NAME/PARAMTER <br>
|
||||
where parameters are: value, rate, timestamp, error<br>
|
||||
The general connection status can be found in MAINTOPiC"/CONNECTION
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -762,7 +722,7 @@ function LoadConfigNeu() {
|
||||
alert("Config.ini could not be loaded!\nPlease reload the page.");
|
||||
return;
|
||||
}
|
||||
loadConfig(basepath);
|
||||
// loadConfig(basepath);
|
||||
ParseConfig();
|
||||
param = getConfigParameters();
|
||||
category = getConfigCategory();
|
||||
@@ -804,7 +764,7 @@ function getParameterByName(name, url = window.location.href) {
|
||||
function WriteParameter(_param, _category, _cat, _name, _optional, _select = false, _anzpara = 1, _number = -1){
|
||||
if (_number > -1)
|
||||
{
|
||||
if (NUMBERS[_number][_cat][_name]["found"]){
|
||||
{
|
||||
if (_optional) {
|
||||
document.getElementById(_cat+"_"+_name+"_enabled").checked = _param[_cat][_name]["enabled"];
|
||||
for (var j = 1; j <= _anzpara; ++j)
|
||||
@@ -827,19 +787,10 @@ function WriteParameter(_param, _category, _cat, _name, _optional, _select = fal
|
||||
document.getElementById(_cat+"_"+_name+"_value"+j).value = NUMBERS[_number][_cat][_name]["value"+j];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (_optional) {
|
||||
document.getElementById(_cat+"_"+_name+"_enabled").disabled = true;
|
||||
for (var j = 1; j <= _anzpara; ++j) {
|
||||
document.getElementById(_cat+"_"+_name+"_value"+j).disabled = true;
|
||||
}
|
||||
}
|
||||
document.getElementById(_cat+"_"+_name+"_text").style="color:lightgrey;"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_param[_cat][_name]["found"]){
|
||||
{
|
||||
if (_optional) {
|
||||
document.getElementById(_cat+"_"+_name+"_enabled").checked = _param[_cat][_name]["enabled"];
|
||||
for (var j = 1; j <= _anzpara; ++j)
|
||||
@@ -862,15 +813,6 @@ function WriteParameter(_param, _category, _cat, _name, _optional, _select = fal
|
||||
document.getElementById(_cat+"_"+_name+"_value"+j).value = _param[_cat][_name]["value"+j];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (_optional) {
|
||||
document.getElementById(_cat+"_"+_name+"_enabled").disabled = true;
|
||||
for (var j = 1; j <= _anzpara; ++j) {
|
||||
document.getElementById(_cat+"_"+_name+"_value"+j).disabled = true;
|
||||
}
|
||||
}
|
||||
document.getElementById(_cat+"_"+_name+"_text").style="color:lightgrey;"
|
||||
}
|
||||
}
|
||||
|
||||
///////////////// am Ende, falls Kategorie als gesamtes nicht ausgewählt --> deaktivieren
|
||||
@@ -917,7 +859,7 @@ function InvertEnableItem(_cat, _param)
|
||||
|
||||
function EnDisableItem(_status, _param, _category, _cat, _name, _optional, _number = -1)
|
||||
{
|
||||
_status = _param[_cat][_name]["found"] && _category[_cat]["enabled"];
|
||||
_status = _category[_cat]["enabled"];
|
||||
|
||||
_color = "color:lightgrey;";
|
||||
if (_status) {
|
||||
@@ -965,35 +907,31 @@ function ReadParameter(_param, _cat, _name, _optional, _select = false, _number
|
||||
if (_cat == "Analog")
|
||||
_cat = "analog"
|
||||
|
||||
if (NUMBERS[_number][_cat][_name]["found"]){
|
||||
if (_optional) {
|
||||
NUMBERS[_number][_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
|
||||
}
|
||||
if (_select) {
|
||||
var sel = document.getElementById(_cat+"_"+_name+"_value1");
|
||||
NUMBERS[_number][_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
|
||||
}
|
||||
else {
|
||||
for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
|
||||
NUMBERS[_number][_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
|
||||
}
|
||||
if (_optional) {
|
||||
NUMBERS[_number][_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
|
||||
}
|
||||
if (_select) {
|
||||
var sel = document.getElementById(_cat+"_"+_name+"_value1");
|
||||
NUMBERS[_number][_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
|
||||
}
|
||||
else {
|
||||
for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
|
||||
NUMBERS[_number][_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_param[_cat][_name]["found"]){
|
||||
if (_optional) {
|
||||
_param[_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
|
||||
}
|
||||
if (_select) {
|
||||
var sel = document.getElementById(_cat+"_"+_name+"_value1");
|
||||
_param[_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
|
||||
}
|
||||
else {
|
||||
for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
|
||||
_param[_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
|
||||
}
|
||||
if (_optional) {
|
||||
_param[_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
|
||||
}
|
||||
if (_select) {
|
||||
var sel = document.getElementById(_cat+"_"+_name+"_value1");
|
||||
_param[_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
|
||||
}
|
||||
else {
|
||||
for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
|
||||
_param[_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1049,10 +987,7 @@ function UpdateInput() {
|
||||
WriteParameter(param, category, "PostProcessing", "CheckDigitIncreaseConsistency", true, true);
|
||||
|
||||
WriteParameter(param, category, "MQTT", "Uri", true);
|
||||
WriteParameter(param, category, "MQTT", "Topic", true);
|
||||
WriteParameter(param, category, "MQTT", "TopicError", true);
|
||||
WriteParameter(param, category, "MQTT", "TopicRate", true);
|
||||
WriteParameter(param, category, "MQTT", "TopicTimeStamp", true);
|
||||
WriteParameter(param, category, "MQTT", "MainTopic", true);
|
||||
WriteParameter(param, category, "MQTT", "ClientID", true);
|
||||
WriteParameter(param, category, "MQTT", "user", true);
|
||||
WriteParameter(param, category, "MQTT", "password", true);
|
||||
@@ -1107,10 +1042,7 @@ function ReadParameterAll()
|
||||
ReadParameter(param, "PostProcessing", "CheckDigitIncreaseConsistency", true, true);
|
||||
|
||||
ReadParameter(param, "MQTT", "Uri", true);
|
||||
ReadParameter(param, "MQTT", "Topic", true);
|
||||
ReadParameter(param, "MQTT", "TopicError", true);
|
||||
ReadParameter(param, "MQTT", "TopicRate", true);
|
||||
ReadParameter(param, "MQTT", "TopicTimeStamp", true);
|
||||
ReadParameter(param, "MQTT", "MainTopic", true);
|
||||
ReadParameter(param, "MQTT", "ClientID", true);
|
||||
ReadParameter(param, "MQTT", "user", true);
|
||||
ReadParameter(param, "MQTT", "password", true);
|
||||
@@ -1127,7 +1059,7 @@ function ReadParameterAll()
|
||||
|
||||
UpdateInputIndividual();
|
||||
|
||||
FormatDecimalValue(param, "PostProcessing", "MaxRateValue");
|
||||
// FormatDecimalValue(param, "PostProcessing", "MaxRateValue");
|
||||
}
|
||||
|
||||
function WriteConfig(){
|
||||
@@ -1147,6 +1079,7 @@ function UpdateAfterCategoryCheck() {
|
||||
ReadParameterAll();
|
||||
category["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
|
||||
category["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
|
||||
category["MQTT"]["enabled"] = document.getElementById("Category_MQTT_enabled").checked;
|
||||
UpdateInput();
|
||||
UpdateInputIndividual();
|
||||
}
|
||||
@@ -1176,10 +1109,6 @@ function saveTextAsFile()
|
||||
ReadParameterAll();
|
||||
WriteConfigININew();
|
||||
SaveConfigToServer(basepath);
|
||||
|
||||
// var textToSave = WriteConfig();
|
||||
// FileDeleteOnServer("/config/config.ini", basepath);
|
||||
// FileSendContent(textToSave, "/config/config.ini", basepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user