소스 검색

Rolling 20210701

jomjol 4 년 전
부모
커밋
f243f4b8ea

+ 10 - 0
FeatureRequest.md

@@ -11,6 +11,16 @@
 
 ____
 
+#### #7 Extended Error Handling
+
+Check different types of error (e.g. tflite not availabe) and generate an error on the html page.
+
+To do:
+
+* Make a list of "important" errors
+* Implement a checking algo
+* Extend the firmware and html page for the error handling
+
 #### #6 Check for double ROI names
 
 Check during configuration, that ROI names are unique.

+ 21 - 1
README.md

@@ -12,6 +12,8 @@ respectively ESP32-Cam housing only: https://www.thingiverse.com/thing:4571627
 
 <img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/watermeter.jpg" width="600"> 
 
+<img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/powermeter.jpg" width="600"> 
+
 
 
 
@@ -45,7 +47,25 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
 
 
 
-##### Rolling - (2021-06-17)
+##### Rolling - (2021-07-01)
+
+* NEW FEATURE: adding support for more than 1 number on a meter (e.g. two different power readings)
+  Therefore the concept of "Numbers" is implemented - a bunch of digits and analog counters are combined to one number. You can define them during setup of digital and analog ROIs:
+  <img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/numbers.jpg" width="300"> 
+  
+* MQTT: standardization of the naming - only the main topic needs to be specified. The subtopics will be named automatically. This is necessary to handle the multi number option.
+  **ATTENTION**: the parameter `maintopic` needs to be set
+  
+* Remark: 
+  
+  * This is an early stage - do only use it on a test system and make a backup of your configuration. 
+  * The documentation is not updated yet.
+
+* <span style="color: red;">**ATTENTION: the configuration and prevalue files are modified automatically and will not be backward compatible!**</span> 
+
+  
+
+Rolling - (2021-06-17)
 
 * bug fix setting hostname, Flash-LED not off during reboot
 

BIN
code/components/connect_wlan.zip


+ 20 - 3
code/components/jomjol_flowcontroll/ClassFlow.cpp

@@ -94,6 +94,23 @@ string ClassFlow::getReadout()
 	return string();
 }
 
+std::string ClassFlow::GetParameterName(std::string _input)
+{
+    string _param;
+    int _pospunkt = _input.find_first_of(".");
+    if (_pospunkt > -1)
+    {
+        _param = _input.substr(_pospunkt+1, _input.length() - _pospunkt - 1);
+    }
+    else
+    {
+        _param = _input;
+    }
+//    printf("Parameter: %s, Pospunkt: %d\n", _param.c_str(), _pospunkt);
+	return _param;
+}
+
+
 bool ClassFlow::getNextLine(FILE* pfile, string *rt)
 {
 	char zw[1024];
@@ -102,13 +119,13 @@ bool ClassFlow::getNextLine(FILE* pfile, string *rt)
 		*rt = "";
 		return false;
 	}
-	fgets(zw, 1024, pfile);
-	printf("%s", zw);
-	if ((strlen(zw) == 0) && feof(pfile))
+	if (!fgets(zw, 1024, pfile))
 	{
 		*rt = "";
+		printf("END OF FILE\n");
 		return false;
 	}
+	printf("%s", zw);
 	*rt = zw;
 	*rt = trim(*rt);
 	while ((zw[0] == ';' || zw[0] == '#' || (rt->size() == 0)) && !(zw[1] == '['))			// Kommentarzeilen (; oder #) und Leerzeilen überspringen, es sei denn es ist ein neuer auskommentierter Paragraph

+ 2 - 0
code/components/jomjol_flowcontroll/ClassFlow.h

@@ -37,6 +37,8 @@ protected:
 
 	virtual void SetInitialParameter(void);
 
+	std::string GetParameterName(std::string _input);
+
 	bool disabled;
 
 public:

+ 1 - 1
code/components/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -275,7 +275,7 @@ string ClassFlowControll::getReadoutAll(int _type)
                 out = out + numbers[i]->ReturnValue;
                 break;
             case READOUT_TYPE_PREVALUE:
-                out = out + std::to_string(numbers[i]->PreValue);
+                out = out + numbers[i]->ReturnPreValue;
                 break;
             case READOUT_TYPE_RAWVALUE:
                 out = out + numbers[i]->ReturnRawValue;

+ 42 - 39
code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp

@@ -13,6 +13,9 @@ void ClassFlowMQTT::SetInitialParameter(void)
     topicError = "";
     topicRate = "";
     topicTimeStamp = "";
+    maintopic = "";
+    mainerrortopic = ""; 
+
     clientname = "watermeter";
     OldValue = "";
     flowpostprocessing = NULL;  
@@ -88,33 +91,23 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
         {
             this->uri = zerlegt[1];
         }
-        if ((toUpper(zerlegt[0]) == "TOPIC") && (zerlegt.size() > 1))
-        {
-            this->topic = zerlegt[1];
-        }
-        if ((toUpper(zerlegt[0]) == "TOPICERROR") && (zerlegt.size() > 1))
-        {
-            this->topicError = zerlegt[1];
-        }
-        if ((toUpper(zerlegt[0]) == "TOPICRATE") && (zerlegt.size() > 1))
-        {
-            this->topicRate  = zerlegt[1];
-        }
-        if ((toUpper(zerlegt[0]) == "TOPICTIMESTAMP") && (zerlegt.size() > 1))
-        {
-            this->topicTimeStamp  = zerlegt[1];
-        }
 
         if ((toUpper(zerlegt[0]) == "CLIENTID") && (zerlegt.size() > 1))
         {
             this->clientname = zerlegt[1];
         }
 
+        if (((toUpper(zerlegt[0]) == "TOPIC") || (toUpper(zerlegt[0]) == "MAINTOPIC")) && (zerlegt.size() > 1))
+        {
+            maintopic = zerlegt[1];
+        }
     }
 
-    if ((uri.length() > 0) && (topic.length() > 0)) 
+    if ((uri.length() > 0) && (maintopic.length() > 0)) 
     {
-        MQTTInit(uri, clientname, user, password, topicError, 60);
+        mainerrortopic = maintopic + "/connection";
+        MQTTInit(uri, clientname, user, password, mainerrortopic, 60); 
+        MQTTPublish(mainerrortopic, "connected");
     }
    
     return true;
@@ -128,13 +121,39 @@ bool ClassFlowMQTT::doFlow(string zwtime)
     std::string resultrate = "";
     std::string resulttimestamp = "";
     string zw = "";
+    string namenumber = "";
+
+    MQTTPublish(mainerrortopic, "connected");
     
     if (flowpostprocessing)
     {
-        result =  flowpostprocessing->getReadoutParam(false, true);
-        resulterror = flowpostprocessing->getReadoutError();
-        resultrate = flowpostprocessing->getReadoutRate();
-        resulttimestamp = flowpostprocessing->getReadoutTimeStamp();
+        std::vector<NumberPost*> NUMBERS = flowpostprocessing->GetNumbers();
+
+        for (int i = 0; i < NUMBERS.size(); ++i)
+        {
+            result =  NUMBERS[i]->ReturnValueNoError;
+            resulterror = NUMBERS[i]->ErrorMessageText;
+            resultrate = std::to_string(NUMBERS[i]->FlowRateAct);
+            resulttimestamp = NUMBERS[i]->timeStamp;
+
+            namenumber = NUMBERS[i]->name;
+            if (namenumber == "default")
+                namenumber = maintopic + "/";
+            else
+                namenumber = maintopic + "/" + namenumber + "/";
+
+            zw = namenumber + "value";    
+            MQTTPublish(zw, result);
+
+            zw = namenumber + "error";    
+            MQTTPublish(zw, resulterror, 1);
+
+            zw = namenumber + "rate";    
+            MQTTPublish(zw, resultrate);
+
+            zw = namenumber + "timestamp";    
+            MQTTPublish(zw, resulttimestamp);
+        }
     }
     else
     {
@@ -149,25 +168,9 @@ bool ClassFlowMQTT::doFlow(string zwtime)
                     result = result + "\t" + zw;
             }
         }
+        MQTTPublish(topic, result);
     }
     
-    MQTTPublish(topic, result);
-
-    if (topicError.length() > 0) {
-        if (resulterror.length() == 0)
-        {
-            resulterror = " ";
-        }
-        MQTTPublish(topicError, resulterror, 1);
-    }
-
-    if (topicRate.length() > 0) {
-        MQTTPublish(topicRate, resultrate);
-    }
-
-    if (topicTimeStamp.length() > 0) {
-        MQTTPublish(topicTimeStamp, resulttimestamp);
-    }
 
     OldValue = result;
     

+ 3 - 1
code/components/jomjol_flowcontroll/ClassFlowMQTT.h

@@ -12,7 +12,9 @@ protected:
     std::string uri, topic, topicError, clientname, topicRate, topicTimeStamp;
     std::string OldValue;
 	ClassFlowPostProcessing* flowpostprocessing;  
-    std::string user, password;  
+    std::string user, password; 
+
+    std::string maintopic, mainerrortopic; 
 	void SetInitialParameter(void);        
 
 public:

+ 23 - 10
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -28,10 +28,11 @@ string ClassFlowPostProcessing::GetPreValue(std::string _number)
         if (NUMBERS[i]->name == _number)
             index = i;
 
-    result = RundeOutput(NUMBERS[index]->PreValue, -NUMBERS[index]->DecimalShift);
+//    result = RundeOutput(NUMBERS[index]->PreValue, -NUMBERS[index]->DecimalShift);
+    result = RundeOutput(NUMBERS[index]->PreValue, NUMBERS[index]->Nachkomma);
 
-    if (NUMBERS[index]->digit_roi && NUMBERS[index]->analog_roi)
-        result = RundeOutput(NUMBERS[index]->PreValue, NUMBERS[index]->AnzahlAnalog - NUMBERS[index]->DecimalShift);
+//    if (NUMBERS[index]->digit_roi && NUMBERS[index]->analog_roi)
+//        result = RundeOutput(NUMBERS[index]->PreValue, NUMBERS[index]->AnzahlAnalog - NUMBERS[index]->DecimalShift);
 
     return result;
 }
@@ -83,6 +84,7 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
                 if (NUMBERS[j]->name == name)
                 {
                     NUMBERS[j]->PreValue = stof(zwvalue.c_str());
+                    NUMBERS[j]->ReturnPreValue = RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma);
 
                     time_t tStart;
                     int yy, month, dd, hh, mm, ss;
@@ -247,10 +249,10 @@ void ClassFlowPostProcessing::handleDecimalSeparator(string _decsep, string _val
 {
     string _digit, _decpos;
     int _pospunkt = _decsep.find_first_of(".");
-//    printf("Name: %s, Pospunkt: %d\n", _name.c_str(), _pospunkt);
+    printf("Name: %s, Pospunkt: %d\n", _decsep.c_str(), _pospunkt);
     if (_pospunkt > -1)
     {
-        _digit = _decsep.substr(_pospunkt+1, _decsep.length() - _pospunkt - 1);
+        _digit = _decsep.substr(0, _pospunkt);
     }
     else
     {
@@ -264,6 +266,8 @@ void ClassFlowPostProcessing::handleDecimalSeparator(string _decsep, string _val
 
         if (NUMBERS[j]->name == _digit)
             NUMBERS[j]->DecimalShift = stoi(_value);
+
+        NUMBERS[j]->Nachkomma = NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift;
     }
 }
 
@@ -289,7 +293,9 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
     while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
     {
         zerlegt = this->ZerlegeZeile(aktparamgraph);
-        if ((toUpper(zerlegt[0].substr(0, 12)) == "DECIMALSHIFT") && (zerlegt.size() > 1))
+        std::string _param = GetParameterName(zerlegt[0]);
+
+        if ((toUpper(_param) == "DECIMALSHIFT") && (zerlegt.size() > 1))
         {
             handleDecimalSeparator(zerlegt[0], zerlegt[1]);
         }
@@ -364,8 +370,10 @@ void ClassFlowPostProcessing::InitNUMBERS()
         }
     }
 
-    flowDigit->UpdateNameNumbers(&name_numbers);
-    flowAnalog->UpdateNameNumbers(&name_numbers);
+    if (flowDigit)
+        flowDigit->UpdateNameNumbers(&name_numbers);
+    if (flowAnalog)
+        flowAnalog->UpdateNameNumbers(&name_numbers);
 
     printf("Anzahl NUMBERS: %d - DIGITS: %d, ANALOG: %d\n", name_numbers.size(), anzDIGIT, anzANALOG);
 
@@ -398,6 +406,7 @@ void ClassFlowPostProcessing::InitNUMBERS()
         _number->ReturnValue = "";         // korrigierter Rückgabewert, ggf. mit Fehlermeldung
         _number->ReturnValueNoError = "";  // korrigierter Rückgabewert ohne Fehlermeldung
         _number->ErrorMessageText = "";        // Fehlermeldung bei Consistency Check
+        _number->ReturnPreValue = "";
         _number->PreValueOkay = false;
         _number->AllowNegativeRates = false;
         _number->MaxRateValue = 0.1;
@@ -414,6 +423,8 @@ void ClassFlowPostProcessing::InitNUMBERS()
         _number->ReturnValueNoError = "";  // korrigierter Rückgabewert ohne Fehlermeldung
         _number->ErrorMessageText = "";        // Fehlermeldung bei Consistency Check
 
+        _number->Nachkomma = _number->AnzahlAnalog;
+
         NUMBERS.push_back(_number);
     }
 
@@ -519,6 +530,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
 
                 NUMBERS[j]->PreValueOkay = true;
                 NUMBERS[j]->PreValue = NUMBERS[j]->Value;
+                NUMBERS[j]->ReturnPreValue = RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma);
                 NUMBERS[j]->lastvalue = flowMakeImage->getTimeImageTaken();
                 zwtime = ConvertTimeToString(NUMBERS[j]->lastvalue, PREVALUE_TIME_FORMAT_OUTPUT);
 
@@ -547,9 +559,9 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
 
             if (NUMBERS[j]->useMaxRateValue && (abs(NUMBERS[j]->Value - NUMBERS[j]->PreValue) > NUMBERS[j]->MaxRateValue))
             {
-                NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Rate too high - Read: " + zwvalue + " - Pre: " + RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift) + " ";
+                NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Rate too high - Read: " + RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Pre: " + RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " ";
                 NUMBERS[j]->Value = NUMBERS[j]->PreValue;
-                zwvalue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift);
+                zwvalue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma);
             }
 
             NUMBERS[j]->ReturnValueNoError = zwvalue;
@@ -566,6 +578,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
             if (NUMBERS[j]->ErrorMessageText.length() == 0)
             {
                 NUMBERS[j]->PreValue = NUMBERS[j]->Value;
+                NUMBERS[j]->ReturnPreValue = RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma);
                 NUMBERS[j]->ErrorMessageText = "no error";
                 UpdatePreValueINI = true;
             }

+ 3 - 1
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h

@@ -23,11 +23,13 @@ struct NumberPost {
     float Value;                // letzer ausgelesener Wert, inkl. Korrekturen
     string ReturnRawValue;      // Rohwert (mit N & führenden 0)    
     string ReturnValue;         // korrigierter Rückgabewert, ggf. mit Fehlermeldung
-    string ReturnValueNoError;  // korrigierter Rückgabewert ohne Fehlermeldung
+    string ReturnPreValue;  // korrigierter Rückgabewert ohne Fehlermeldung
+    string ReturnValueNoError;
     string ErrorMessageText;        // Fehlermeldung bei Consistency Check
     int AnzahlAnalog;
     int AnzahlDigital;
     int DecimalShift;
+    int Nachkomma;
 //    ClassFlowAnalog* ANALOG;
 //    ClassFlowDigit* DIGIT;
 

+ 1 - 1
code/main/server_main.cpp

@@ -387,7 +387,7 @@ httpd_handle_t start_webserver(void)
     httpd_config_t config = { };
 
     config.task_priority      = tskIDLE_PRIORITY+5;
-    config.stack_size         = 32384;                  // bei 32k stürzt das Programm beim Bilderaufnehmen ab
+    config.stack_size         = 32768;                  // bei 32k stürzt das Programm beim Bilderaufnehmen ab
     config.core_id            = tskNO_AFFINITY;
     config.server_port        = 80;
     config.ctrl_port          = 32768;

+ 2 - 2
code/main/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="f4edd36";
+const char* GIT_REV="45154cb";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-06-17 20:14";
+const char* BUILD_TIME="2021-07-01 19:03";

+ 2 - 2
code/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="f4edd36";
+const char* GIT_REV="45154cb";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-06-17 20:14";
+const char* BUILD_TIME="2021-07-01 19:03";

BIN
firmware/bootloader.bin


BIN
firmware/firmware.bin


BIN
firmware/html.zip


BIN
images/numbers.jpg


BIN
images/powermeter.jpg


+ 1 - 1
sd-card/config/config.ini

@@ -18,7 +18,7 @@ InitialMirror= false
 AlignmentAlgo = Default
 
 [Digits]
-Model = /config/dig0901s1q.tflite
+Model = /config/dig1030s1q.tflite
 ;LogImageLocation = /log/digit
 ;LogfileRetentionInDays = 3
 ModelInputSize = 20 32

BIN
sd-card/config/dig0870s3q.tflite


BIN
sd-card/config/dig0900s1q.tflite


BIN
sd-card/config/dig0901s1q.tflite


BIN
sd-card/config/dig1030s1q.tflite


+ 7 - 9
sd-card/html/edit_analog.html

@@ -69,10 +69,16 @@ th, td {
    
 
 <div id="div1">
+	<table>
+	  <tr>
+		<td><canvas id="canvas" crossorigin></canvas></td>
+	  </tr>
+	</table>	
+
     <p>
         <table>
             <tr>
-                <class id="Numbers_text" style="color:black;">Number: </class>
+                <class id="Numbers_text" style="color:black;"><b>Number: </b></class>
                 <select id="Numbers_value1" onchange="numberChanged()">
                     <option value="0" selected>default</option>
                     <option value="1" >NT</option>
@@ -85,12 +91,6 @@ th, td {
         </table>
     </p>
 
-	<table>
-	  <tr>
-		<td><canvas id="canvas" crossorigin></canvas></td>
-	  </tr>
-	</table>	
-			 
 	<table>
 	  <tr>
 		<td><input class="button" type="submit" id= "newROI" name="newROI" onclick="newROI()" value="New ROI (after current)"></td>	  
@@ -268,7 +268,6 @@ function UpdateROIs(){
         document.getElementById("newROI").disabled = false;
         document.getElementById("deleteROI").disabled = true;
         document.getElementById("index").disabled = true;
-        document.getElementById("saveroi").disabled = true;
         document.getElementById("renameROI").disabled = true;
         document.getElementById("moveNext").disabled = true;
         document.getElementById("movePrevious").disabled = true;
@@ -280,7 +279,6 @@ function UpdateROIs(){
         document.getElementById("deleteROI").disabled = false;
         document.getElementById("renameROI").disabled = false;
         document.getElementById("index").disabled = false;
-        document.getElementById("saveroi").disabled = false;
     }
 
     var _index = document.getElementById("index");

+ 0 - 1
sd-card/html/edit_config.html

@@ -41,7 +41,6 @@ textarea {
 </table>
 
 <script type="text/javascript" src="./gethost.js"></script> 
-<script type="text/javascript" src="./readconfig.js"></script>  
 <script type="text/javascript" src="./readconfigcommon.js"></script>  
  
 <script type="text/javascript">

+ 34 - 105
sd-card/html/edit_config_param.html

@@ -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);
 	}
 }
 

+ 9 - 11
sd-card/html/edit_digits.html

@@ -59,10 +59,17 @@ th, td {
         Edit Digits</h2>
 
 <div id="div1">
+
+	<table>
+	  <tr>
+		<canvas id="canvas" crossorigin></canvas>
+	  </tr>
+	</table>
+    
     <p>
         <table>
             <tr>
-                <class id="Numbers_text" style="color:black;">Number: </class>
+                <class id="Numbers_text" style="color:black;"><b>Number:</b> </class>
                 <select id="Numbers_value1" onchange="numberChanged()">
                     <option value="0" selected>default</option>
                     <option value="1" >NT</option>
@@ -74,17 +81,8 @@ th, td {
             </tr>
         </table>
     </p>
-
-	<table>
-	  <tr>
-		<canvas id="canvas" crossorigin></canvas>
-	  </tr>
-	</table>	
-			 
-	<table>
-
     
-
+	<table>
 	  <tr>
 		<td><input class="button" type="submit" id="newROI" name="newROI" onclick="newROI()" value="New ROI (after current)"></td>	  
 		<td><input class="button" type="submit" id="deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI"></td>

+ 1 - 1
sd-card/html/edit_reference.html

@@ -53,7 +53,7 @@ table {
 	  </tr>
 	  <tr>
         <td><label for="mirror">Pre-rotate Angle:</label></td>	  
-		<td><input type="number" id="prerotateangle" name="prerotateangle" value=0 min="-360" max="360" onchange="drawRotated()">Degrees</td>
+		<td><input type="number" id="prerotateangle" name="prerotateangle" value="0" min="-360" max="360" onchange="drawRotated()">Degrees</td>
         <td>
             <class id="MakeImage_Brightness_text" style="color:black;">Brightness: </class>
             <input type="number" id="MakeImage_Brightness_value1" size="13" value=0  min="-2" max="2" style="float: right; clear: both;">

+ 2 - 2
sd-card/html/gethost.js

@@ -8,8 +8,8 @@ function getbasepath(){
     if ((host == "127.0.0.1") || (host == "localhost"))
     {
 //        host = "http://192.168.2.219";          // jomjol interner test
-//        host = "http://192.168.178.26";          // jomjol interner test
-        host = "http://192.168.178.22";          // jomjol interner Real
+        host = "http://192.168.178.47";          // jomjol interner test
+//        host = "http://192.168.178.22";          // jomjol interner Real
 
 //        host = ".";                           // jomjol interner localhost   
 

+ 6 - 1
sd-card/html/readconfigcommon.js

@@ -44,7 +44,7 @@ function createReader(file) {
 
 
 
-function ZerlegeZeile(input, delimiter = " =,\t")
+function ZerlegeZeile(input, delimiter = " =,\t\r")
      {
           var Output = Array(0);
 //          delimiter = " =,\t";
@@ -106,6 +106,11 @@ function trim(istring, adddelimiter)
      }
      
 
+function getConfig()
+{
+     return config_gesamt;
+}
+
      
 function loadConfig(_basepath) {
      var xhttp = new XMLHttpRequest();

+ 34 - 26
sd-card/html/readconfigparam.js

@@ -84,10 +84,7 @@ function ParseConfig() {
      category[catname]["found"] = false;
      param[catname] = new Object();
      ParamAddValue(param, catname, "Uri");
-     ParamAddValue(param, catname, "Topic");
-     ParamAddValue(param, catname, "TopicError");
-     ParamAddValue(param, catname, "TopicRate");
-     ParamAddValue(param, catname, "TopicTimeStamp");
+     ParamAddValue(param, catname, "MainTopic");
      ParamAddValue(param, catname, "ClientID");
      ParamAddValue(param, catname, "user");
      ParamAddValue(param, catname, "password");     
@@ -191,7 +188,8 @@ function ParamExtractValue(_param, _linesplit, _catname, _paramname, _aktline, _
 
 function ParamExtractValueAll(_param, _linesplit, _catname, _aktline, _iscom){
      for (var paramname in _param[_catname]) {
-          if ((_linesplit[0].toUpperCase() == paramname.toUpperCase()) && (_linesplit.length > _param[_catname][paramname]["anzParam"]))
+          _param_zw = _linesplit[0].substring(_linesplit[0].length - paramname.length, _linesplit[0].length);
+          if ((_param_zw.toUpperCase() == paramname.toUpperCase()) && (_linesplit.length > _param[_catname][paramname]["anzParam"]))
           {
                _param[_catname][paramname]["found"] = true;
                _param[_catname][paramname]["enabled"] = !_iscom;
@@ -258,38 +256,36 @@ function WriteConfigININew()
                {
                     for (_num in NUMBERS)
                     {
-                         if (NUMBERS[_num][cat][name]["found"]) {
-                              if (NUMBERS[_num]["name"] == "default")
-                                   text = name;
-                              else
-                                   text = name + "." + NUMBERS[_num]["name"];
+                         if (NUMBERS[_num]["name"] == "default")
+                              text = name;
+                         else
+                              text = NUMBERS[_num]["name"] + "." + name;
 
-                              var text = text + " =" 
-                              
-                              for (var j = 1; j <= param[cat][name]["anzParam"]; ++j) {
+                         var text = text + " =" 
+                         
+                         for (var j = 1; j <= param[cat][name]["anzParam"]; ++j) {
+                              if (!(typeof NUMBERS[_num][cat][name]["value"+j] == 'undefined'))
                                    text = text + " " + NUMBERS[_num][cat][name]["value"+j];
-                                   }
-                              if (!NUMBERS[_num][cat][name]["enabled"]) {
-                                   text = ";" + text;
                               }
-                              config_split.push(text);
+                         if (!NUMBERS[_num][cat][name]["enabled"]) {
+                              text = ";" + text;
                          }
+                         config_split.push(text);
                     }
                }
                else
                {
-                    if (param[cat][name]["found"]) {
-                         var text = name + " =" 
-                         
-                         for (var j = 1; j <= param[cat][name]["anzParam"]; ++j) {
+                    var text = name + " =" 
+                    
+                    for (var j = 1; j <= param[cat][name]["anzParam"]; ++j) {
+                         if (!(typeof param[cat][name]["value"+j] == 'undefined'))
                               text = text + " " + param[cat][name]["value"+j];
-                              }
-                         if (!param[cat][name]["enabled"]) {
-                              text = ";" + text;
                          }
-                         config_split.push(text);
-                    }
+                    if (!param[cat][name]["enabled"]) {
+                         text = ";" + text;
                     }
+                    config_split.push(text);
+               }
           }
           if (cat == "Digits")
           {
@@ -597,6 +593,18 @@ function CreateNUMBER(_numbernew){
      _ret["name"] = _numbernew;
      _ret['digit'] = new Array();
      _ret['analog'] = new Array();
+
+     for (_cat in param)
+          for (_param in param[_cat])
+               if (param[_cat][_param]["Numbers"] == true){
+                    _ret[_cat] = new Object();
+                    _ret[_cat][_param] = new Object();
+                    _ret[_cat][_param]["found"] = false;
+                    _ret[_cat][_param]["enabled"] = false;
+                    _ret[_cat][_param]["anzParam"] = param[_cat][_param]["anzParam"]; 
+
+               }
+
      NUMBERS.push(_ret);
 
      return "";

+ 1 - 1
sd-card/html/version.txt

@@ -1 +1 @@
-8.0.0
+9.0.0