Bladeren bron

Update Rolling

jomjol 5 jaren geleden
bovenliggende
commit
c65de27e9d

+ 10 - 1
README.md

@@ -33,6 +33,7 @@ If you would like to support the developer with a cup of coffee you can do that
 ### Known Issues
 
 * slow response of web server during picture analysis
+* spontaneous reboots (mostly due to html access during image processing) - self recovery implemented
 
 ------
 
@@ -40,7 +41,15 @@ If you would like to support the developer with a cup of coffee you can do that
 
 
 
-##### Rolling - (2021-01-05)
+##### Rolling - (2021-01-17)
+
+* Disabling of digital counters implemented
+* Attention: do not disable digital and analog!
+* Bug fixing:
+
+  * Configuration of analog counters on html-page failed (enable/disable, undefined ROIs)
+
+2021-01-05
 
 * Configuration: simple enabling / disabling of analog counters 
 

+ 1 - 1
code/components/connect_wlan/connect_wlan.cpp

@@ -217,7 +217,7 @@ void initialise_wifi_fixed_ip(std::string _ip, std::string _gw, std::string _net
     netmask = std::string(ip4addr_ntoa(&ip_info2.netmask));
     gw = std::string(ip4addr_ntoa(&ip_info2.gw));
 
-    vEventGroupDelete(wifi_event_group);
+//    vEventGroupDelete(wifi_event_group);
 }
 
 

+ 2 - 2
code/components/jomjol_flowcontroll/ClassFlowAnalog.cpp

@@ -3,7 +3,7 @@
 #include <math.h>
 #include <iomanip>
 #include <sys/types.h>
-
+  
 // #define OHNETFLITE
 
 #ifndef OHNETFLITE
@@ -97,7 +97,7 @@ bool ClassFlowAnalog::ReadParameter(FILE* pfile, string& aktparamgraph)
     if (aktparamgraph[0] == ';')
     {
         disabled = true;
-        while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph));
+        while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
         printf("[Analog] is disabled !!!\n");
         return true;
     }

+ 1 - 1
code/components/jomjol_flowcontroll/ClassFlowAnalog.h

@@ -40,6 +40,6 @@ public:
    	std::vector<HTMLInfo*> GetHTMLInfo();   
     int AnzahlROIs(){return ROI.size();}; 
 
-    string name(){return "ClassFlowAnalog";};
+    string name(){return "ClassFlowAnalog";}; 
 };
 

+ 17 - 0
code/components/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -76,6 +76,8 @@ void ClassFlowControll::SetInitialParameter(void)
     flowanalog = NULL;
     flowpostprocessing = NULL;
     disabled = false;
+    aktRunNr = 0;
+    aktstatus = "Startup";
 
 }
 
@@ -241,6 +243,21 @@ bool ClassFlowControll::doFlow(string time)
     return result;
 }
 
+void ClassFlowControll::UpdateAktStatus(std::string _flow)
+{
+    aktstatus = gettimestring("%Y%m%d-%H%M%S");
+    aktstatus = aktstatus + "\t" + std::to_string(aktRunNr) + "\t";
+    
+    if (_flow == "ClassFlowMakeImage")
+        aktstatus = aktstatus + "Taking Raw Image";
+    else
+        if (_flow == "ClassFlowAlignment")
+            aktstatus = aktstatus + "Aligning Image";
+
+
+}
+
+
 string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false)
 {
     if (flowpostprocessing)

+ 3 - 0
code/components/jomjol_flowcontroll/ClassFlowControll.h

@@ -28,6 +28,9 @@ protected:
 	bool SetupModeActive;
 	void SetInitialParameter(void);	
 	std::string aktstatus;
+	int aktRunNr;
+
+	void UpdateAktStatus(std::string _flow);
 
 public:
 	void InitFlow(std::string config);

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

@@ -85,13 +85,21 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
     aktparamgraph = trim(aktparamgraph);
 
     if (aktparamgraph.size() == 0)
-        if (!this->GetNextParagraph(pfile, aktparamgraph))
+        if (!this->GetNextParagraph(pfile, aktparamgraph)) 
             return false;
 
-
-    if (aktparamgraph.compare("[Digits]") != 0)       // Paragraph passt nicht
+    if ((aktparamgraph.compare("[Digits]") != 0) && (aktparamgraph.compare(";[Digits]") != 0))       // Paragraph passt nich zu MakeImage
         return false;
 
+    if (aktparamgraph[0] == ';')
+    {
+        disabled = true;
+        while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
+        printf("[Digits] is disabled !!!\n");
+        return true;
+    }
+
+
     while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph))
     {
         zerlegt = this->ZerlegeZeile(aktparamgraph);
@@ -169,6 +177,9 @@ string ClassFlowDigit::getHTMLSingleStep(string host)
 
 bool ClassFlowDigit::doFlow(string time)
 {
+    if (disabled)
+        return true;
+        
     if (!doAlignAndCut(time)){
         return false;
     };
@@ -182,6 +193,9 @@ bool ClassFlowDigit::doFlow(string time)
 
 bool ClassFlowDigit::doAlignAndCut(string time)
 {
+    if (disabled)
+        return true;
+
     CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();
 
     for (int i = 0; i < ROI.size(); ++i)
@@ -200,6 +214,9 @@ bool ClassFlowDigit::doAlignAndCut(string time)
 
 bool ClassFlowDigit::doNeuralNetwork(string time)
 {
+    if (disabled)
+        return true;
+            
     string logPath = CreateLogFolder(time);
 
 #ifndef OHNETFLITE

+ 1 - 1
code/components/jomjol_flowcontroll/ClassFlowDigit.h

@@ -23,7 +23,7 @@ protected:
     bool SaveAllFiles;
 
     ClassFlowAlignment* flowpostalignment;
-
+ 
     bool doNeuralNetwork(string time); 
     bool doAlignAndCut(string time); 
 

+ 54 - 33
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -14,17 +14,28 @@
 string ClassFlowPostProcessing::GetPreValue()
 {
     std::string result;
+    bool isAnalog = false;
+    bool isDigit = false;
+
+    int AnzahlAnalog = 0;
     result = RundeOutput(PreValue, -DecimalShift);
 
     for (int i = 0; i < ListFlowControll->size(); ++i)
     {
         if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
         {
-            int AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
-            result =  RundeOutput(PreValue, AnzahlAnalog - DecimalShift);
+            isAnalog = true;
+            AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
+        }
+        if (((*ListFlowControll)[i])->name().compare("ClassFlowDigit") == 0)
+        {
+            isDigit = true;
         }
     }
 
+    if (isDigit && isAnalog)
+        result = RundeOutput(PreValue, AnzahlAnalog - DecimalShift);
+
     return result;
 }
 
@@ -75,17 +86,24 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
     ReturnValue = to_string(Value);
     ReturnValueNoError = ReturnValue; 
 
-    // falls es Analog gibt, dann die Anzahl der Nachkommastellen feststellen und entsprechend runden:   
+    bool isAnalog = false;
+    bool isDigit = false;
+    int AnzahlAnalog = 0;
+
     for (int i = 0; i < ListFlowControll->size(); ++i)
     {
         if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
-        {
-            int AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
-            ReturnValue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
-            ReturnValueNoError = ReturnValue;
-        }
+            isAnalog = true;
+        if (((*ListFlowControll)[i])->name().compare("ClassFlowDigit") == 0)
+            isDigit = true;
     }
-    
+
+    if (isDigit || isAnalog)
+    {
+        ReturnValue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
+        ReturnValueNoError = ReturnValue;
+    }
+   
     return true;
 }
 
@@ -119,28 +137,6 @@ void ClassFlowPostProcessing::SavePreValue(float value, string zwtime)
 }
 
 
-/*
-ClassFlowPostProcessing::ClassFlowPostProcessing()
-{
-    PreValueUse = false;
-    PreValueAgeStartup = 30;
-    AllowNegativeRates = false;
-    MaxRateValue = 0.1;
-    ErrorMessage = false;
-    ListFlowControll = NULL;
-    PreValueOkay = false;
-    useMaxRateValue = false;
-    checkDigitIncreaseConsistency = false;
-    DecimalShift = 0;
-    ErrorMessageText = "";
-    disabled = false;
-    disabled = false;
-
-
-    FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
-}
-*/
-
 ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
 {
     PreValueUse = false;
@@ -273,6 +269,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
     int AnzahlAnalog = 0;
     string zw;
     time_t imagetime = 0;
+    string rohwert;
 
     ErrorMessageText = "";
 
@@ -311,6 +308,8 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
     //    isdigit = true; digit = "12N";
     //    isanalog = true; analog = "456";
 
+    ReturnRawValue = "";
+
     if (isdigit)
         ReturnRawValue = digit;
     if (isdigit && isanalog)
@@ -318,8 +317,16 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
     if (isanalog)
         ReturnRawValue = ReturnRawValue + analog; 
 
+
+    if (!isdigit)
+    {
+        AnzahlAnalog = 0;
+    }
+
     ReturnRawValue = ShiftDecimal(ReturnRawValue, DecimalShift);   
 
+    rohwert = ReturnRawValue;
+
     if (!PreValueUse || !PreValueOkay)
     {
         ReturnValue = ReturnRawValue;
@@ -354,7 +361,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
 
     if ((!AllowNegativeRates) && (Value < PreValue))
     {
-        ErrorMessageText = ErrorMessageText + "Negative Rate - Returned old value - read value: " + zwvalue + " ";
+        ErrorMessageText = ErrorMessageText + "Negative Rate - Returned old value - read value: " + zwvalue + " - raw value: " + ReturnRawValue;
         Value = PreValue;
         zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
     }
@@ -397,10 +404,24 @@ string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror)
 
 string ClassFlowPostProcessing::RundeOutput(float _in, int _anzNachkomma){
     std::stringstream stream;
+    int _zw = _in;    
+//    printf("AnzNachkomma: %d\n", _anzNachkomma);
+
     if (_anzNachkomma < 0) {
         _anzNachkomma = 0;
     }
-    stream << std::fixed << std::setprecision(_anzNachkomma) << _in;
+
+    if (_anzNachkomma > 0)
+    {
+        stream << std::fixed << std::setprecision(_anzNachkomma) << _in;
+        return stream.str();          
+    }
+    else
+    {
+        stream << _zw;
+    }
+
+
     return stream.str();  
 }
 

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

@@ -34,7 +34,6 @@ protected:
     string RundeOutput(float _in, int _anzNachkomma);
 
 public:
-//    ClassFlowPostProcessing();
     ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc);
     bool ReadParameter(FILE* pfile, string& aktparamgraph);
     bool doFlow(string time);

+ 8 - 3
code/components/jomjol_tfliteclass/server_tflite.cpp

@@ -470,21 +470,26 @@ esp_err_t handler_prevalue(httpd_req_t *req)
     const char* resp_str;
     string zw;
 
-//    printf("handler_prevalue:\n"); printf(req->uri); printf("\n");
+#ifdef DEBUG_DETAIL_ON       
+    printf("handler_prevalue:\n"); printf(req->uri); printf("\n");
+#endif
 
     char _query[100];
     char _size[10] = "";
 
     if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
     {
-//        printf("Query: "); printf(_query); printf("\n");
+#ifdef DEBUG_DETAIL_ON       
+        printf("Query: "); printf(_query); printf("\n");
+#endif
+
         if (httpd_query_key_value(_query, "value", _size, 10) == ESP_OK)
         {
 #ifdef DEBUG_DETAIL_ON       
             printf("Value: "); printf(_size); printf("\n"); 
 #endif
         }
-    }           
+    }      
 
     if (strlen(_size) == 0)
         zw = tfliteflow.GetPrevalue();

+ 2 - 2
code/main/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="e520609";
+const char* GIT_REV="9bb715f";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-01-05 20:40";
+const char* BUILD_TIME="2021-01-17 12:21";

+ 2 - 2
code/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="e520609";
+const char* GIT_REV="9bb715f";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-01-05 20:40";
+const char* BUILD_TIME="2021-01-17 12:21";

BIN
firmware/bootloader.bin


BIN
firmware/firmware.bin


BIN
firmware/html.zip


+ 25 - 18
sd-card/html/edit_analog.html

@@ -147,16 +147,20 @@ function EnDisableAnalog() {
             $("#div2").addClass("disabledDiv");
         }
 		
-        sah1(document.getElementById("div1"));
+        sah1(document.getElementById("div1"), !isEnabled);
+        if (isEnabled)
+        {
+            UpdateROIs();
+        }
 }
 
-    function sah1(el) {
+function sah1(el, _target) {
         try {
-            el.disabled = el.disabled ? false : true;
+            el.disabled = _target;
         } catch (E) {}
         if (el.childNodes && el.childNodes.length > 0) {
             for (var x = 0; x < el.childNodes.length; x++) {
-                sah1(el.childNodes[x]);
+                sah1(el.childNodes[x], _target);
             }
         }
     }
@@ -219,7 +223,7 @@ function ChangeSelection(){
 }
 
 function SaveToConfig(){
-    _enabled = document.getElementById("index").checked;
+    _enabled = document.getElementById("Category_Analog_enabled").checked;
     SaveROIToConfig(ROIInfo, "[Analog]", basepath, _enabled);
     UpdatePage();  
 }
@@ -346,22 +350,25 @@ function ParseIni(_basepath) {
         }  
 
 
-        function draw() {
+    function draw() {
         var canvas = document.getElementById('canvas');
         var context = canvas.getContext('2d');
         context.drawImage(imageObj, 0, 0);
-        lw = 4
-        context.lineWidth = lw;
-        context.strokeStyle = "#FF0000";
-        var x0 = parseInt(rect.startX) - parseInt(lw/2);
-        var y0 = parseInt(rect.startY) - parseInt(lw/2);
-        var dx = parseInt(rect.w) + parseInt(lw);
-        var dy = parseInt(rect.h) + parseInt(lw);
-        context.strokeRect(x0, y0, dx, dy);    
-        ROIInfo[aktindex]["x"] = rect.startX;       
-        ROIInfo[aktindex]["y"] = rect.startY;       
-        ROIInfo[aktindex]["dx"] = rect.w;       
-        ROIInfo[aktindex]["dy"] = rect.h;       
+        if (document.getElementById("Category_Analog_enabled").checked)
+        {
+            lw = 4
+            context.lineWidth = lw;
+            context.strokeStyle = "#FF0000";
+            var x0 = parseInt(rect.startX) - parseInt(lw/2);
+            var y0 = parseInt(rect.startY) - parseInt(lw/2);
+            var dx = parseInt(rect.w) + parseInt(lw);
+            var dy = parseInt(rect.h) + parseInt(lw);
+            context.strokeRect(x0, y0, dx, dy);    
+            ROIInfo[aktindex]["x"] = rect.startX;       
+            ROIInfo[aktindex]["y"] = rect.startY;       
+            ROIInfo[aktindex]["dx"] = rect.w;       
+            ROIInfo[aktindex]["dy"] = rect.h;       
+        }
     }
 
     function getCoords(elem) { // crossbrowser version

+ 7 - 2
sd-card/html/edit_config_param.html

@@ -179,8 +179,10 @@ textarea {
 			</td>
 		</tr>
 
-		<tr class="expert"  id="ex4">
-			<td colspan="4" style="padding-left: 20px;"><h4>Digits</h4></td>
+
+		<tr id="Category_Digits_ex4">
+			<td colspan="4" style="padding-left: 20px;">
+				<h4><input type="checkbox" id="Category_Digits_enabled" value="1"  onclick = 'UpdateAfterCategoryCheck()' unchecked >Digits</h4></td>
 		</tr> 
 		<tr>
 			<td width="20px"  style="padding-left: 40px;">
@@ -736,6 +738,7 @@ function ReadParameter(_param, _cat, _name, _optional, _select = false){
 
 function UpdateInput() {
 	document.getElementById("Category_Analog_enabled").checked = category["Analog"]["enabled"];
+	document.getElementById("Category_Digits_enabled").checked = category["Digits"]["enabled"];
 	document.getElementById("Category_MQTT_enabled").checked = category["MQTT"]["enabled"];
 
 	WriteParameter(param, category, "MakeImage", "LogImageLocation", true);
@@ -787,6 +790,7 @@ function UpdateInput() {
 function 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;
 
 	ReadParameter(param, "MakeImage", "LogImageLocation", true);
@@ -853,6 +857,7 @@ function FormatDecimalValue(_param, _cat, _name) {
 function UpdateAfterCategoryCheck() {
 	ReadParameterAll();
 	category["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
+	category["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
 	UpdateInput();
 }
 

+ 72 - 16
sd-card/html/edit_digits.html

@@ -55,7 +55,10 @@ th, td {
 
 <body style="font-family: arial; padding: 0px 10px;">
 
-	<h2>Edit Digits</h2>
+    <h2><input type="checkbox" id="Category_Digits_enabled" value="1"  onclick = 'EnDisableDigits()' checked >
+        Edit Digits</h2>
+
+<div id="div1">
 
 	<table>
 	  <tr>
@@ -91,7 +94,9 @@ th, td {
 		<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()"></td>	
 		<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()"></td>
 	  </tr>
-	</table>			 
+    </table>	
+    
+</div>
 			 
 	<table>
 	  <tr>
@@ -102,6 +107,7 @@ th, td {
 <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" src="./jquery-3.5.1.min.js"></script>  
 
 <script language="JavaScript">
         var canvas = document.getElementById('canvas'),
@@ -115,6 +121,41 @@ th, td {
             lockAR = true;
             basepath = "http://192.168.178.26";
 
+
+function EnDisableDigits() {
+        isEnabled = document.getElementById("Category_Digits_enabled").checked;
+
+		$("#div2").attr("disabled", "disabled").off('click');
+        var x1=$("#div2").hasClass("disabledDiv");
+        
+        if (isEnabled)
+        {
+            $("#div2").removeClass("disabledDiv");
+        }
+        else
+        {
+            $("#div2").addClass("disabledDiv");
+        }
+		
+        sah1(document.getElementById("div1"), !isEnabled);
+        if (isEnabled)
+        {
+            UpdateROIs();
+        }
+}
+
+    function sah1(el, _target) {
+        try {
+            el.disabled = _target;
+        } catch (E) {}
+        if (el.childNodes && el.childNodes.length > 0) {
+            for (var x = 0; x < el.childNodes.length; x++) {
+                sah1(el.childNodes[x], _target);
+            }
+        }
+    }
+
+
 function onNameChange(){
     ROIInfo[aktindex]["name"] = document.getElementById("name").value;
     UpdateROIs();
@@ -173,7 +214,8 @@ function ChangeSelection(){
 }
 
 function SaveToConfig(){
-    SaveROIToConfig(ROIInfo, "[Digits]", basepath);
+    _enabled = document.getElementById("Category_Digits_enabled").checked;
+    SaveROIToConfig(ROIInfo, "[Digits]", basepath, _enabled);
     UpdatePage();  
 }
 
@@ -231,8 +273,19 @@ function UpdateROIs(){
 function ParseIni(_basepath) {
     loadConfig(_basepath);
     ParseConfig();
+
+    document.getElementById("Category_Digits_enabled").checked = true;
     ROIInfo = getROIInfo("[Digits]");
 
+    if (!GetDigitsEnabled()) 
+    {
+        document.getElementById("Category_Digits_enabled").checked = false;
+        EnDisableDigits();
+        alert("Digital ROIs are disabled - please enable (Check box top left).\n");
+        return;
+    }
+
+
     UpdateROIs();
 }
 			
@@ -288,22 +341,25 @@ function ParseIni(_basepath) {
         }  
 
 
-        function draw() {
+function draw() {
         var canvas = document.getElementById('canvas');
         var context = canvas.getContext('2d');
         context.drawImage(imageObj, 0, 0);
-        lw = 4
-        context.lineWidth = lw;
-        context.strokeStyle = "#FF0000";
-        var x0 = parseInt(rect.startX) - parseInt(lw/2);
-        var y0 = parseInt(rect.startY) - parseInt(lw/2);
-        var dx = parseInt(rect.w) + parseInt(lw);
-        var dy = parseInt(rect.h) + parseInt(lw);
-        context.strokeRect(x0, y0, dx, dy);    
-        ROIInfo[aktindex]["x"] = rect.startX;       
-        ROIInfo[aktindex]["y"] = rect.startY;       
-        ROIInfo[aktindex]["dx"] = rect.w;       
-        ROIInfo[aktindex]["dy"] = rect.h;       
+        if (document.getElementById("Category_Digits_enabled").checked)
+        {
+            lw = 4
+            context.lineWidth = lw;
+            context.strokeStyle = "#FF0000";
+            var x0 = parseInt(rect.startX) - parseInt(lw/2);
+            var y0 = parseInt(rect.startY) - parseInt(lw/2);
+            var dx = parseInt(rect.w) + parseInt(lw);
+            var dy = parseInt(rect.h) + parseInt(lw);
+            context.strokeRect(x0, y0, dx, dy);    
+            ROIInfo[aktindex]["x"] = rect.startX;       
+            ROIInfo[aktindex]["y"] = rect.startY;       
+            ROIInfo[aktindex]["dx"] = rect.w;       
+            ROIInfo[aktindex]["dy"] = rect.h;       
+        }
     }
 
     function getCoords(elem) { // crossbrowser version

+ 22 - 7
sd-card/html/readconfig.js

@@ -10,6 +10,8 @@ var analog = new Array(0);
 var initalrotate = new Object();
 var analogEnabled = false;
 var posAnalogHeader;
+var digitsEnabled = false;
+var posDigitsHeader;
 
 function MakeRefZW(zw, _basepath){
      url = _basepath + "/editflow.html?task=cutref&in=/config/reference.jpg&out=/img_tmp/ref_zw_org.jpg&x=" + zw["x"] + "&y="  + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
@@ -96,6 +98,12 @@ function GetAnalogEnabled() {
      return analogEnabled;
 }
 
+
+function GetDigitsEnabled() {
+     return digitsEnabled;
+}
+
+
 function ParseConfigAnalog(_aktline){
      ++_aktline;
      analog.length = 0;
@@ -133,16 +141,19 @@ function getROIInfo(_typeROI){
 }
 
 function SaveROIToConfig(_ROIInfo, _typeROI, _basepath, _enabled){
+     if (_enabled) {
+          text = _typeROI;
+     }
+     else {
+          text = ";" + _typeROI;
+     }
+
      if (_typeROI == "[Digits]"){
+          config_split[posDigitsHeader] = text;
           targetROI = digit;
      }
+
      if (_typeROI == "[Analog]"){
-          if (_enabled) {
-               text = _typeROI;
-          }
-          else {
-               text = ";" + _typeROI;
-          }
           config_split[posAnalogHeader] = text;
           targetROI = analog;
      }
@@ -188,14 +199,18 @@ function ParseConfig() {
                continue;
           }
           if ((config_split[aktline].trim().toUpperCase() == "[DIGITS]") || (config_split[aktline].trim().toUpperCase() == ";[DIGITS]")){
+               posDigitsHeader = aktline;
+               if (config_split[aktline][0] == "[") {
+                    digitsEnabled = true;
+               }
                aktline = ParseConfigDigit(aktline);
                continue;
           }
 
           if ((config_split[aktline].trim().toUpperCase() == "[ANALOG]") || (config_split[aktline].trim().toUpperCase() == ";[ANALOG]")) {
+               posAnalogHeader = aktline;
                if (config_split[aktline][0] == "[") {
                     analogEnabled = true;
-                    posAnalogHeader = aktline;
                }
                aktline = ParseConfigAnalog(aktline);
                continue;

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

@@ -1 +1 @@
-5.0.1
+5.1.0