jomjol 5 yıl önce
ebeveyn
işleme
16290d4566

+ 6 - 0
README.md

@@ -9,6 +9,11 @@ Details can be found on the Wiki pages.
 
 ## Changelog - lastest version
 
+##### 0.1.1 (2020-08-13)
+
+* Implementation of Digital Consistency Check: check if Digit shows next number earlier, than previous number has gone through zero - Turn on/off - see updated config.ini `CheckDigitIncreaseConsistency = True`)
+  Not fully tested!
+
 ##### 0.1.0 (2020-08-07)
 
 * Initial Version
@@ -19,6 +24,7 @@ Details can be found on the Wiki pages.
 
 * spontaneous reboot, especially in case of intensive web server access
 * stopping automated tflite flow - Error teared down to alignment procedure (results in restart)
+* Camera initialization stuck not often, but randomly 5s after reboot - Hard reboot (power on/off) necessary :-(
 
 
 

+ 55 - 4
code/lib/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -101,6 +101,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing()
     ListFlowControll = NULL;
     PreValueOkay = false;
     useMaxRateValue = false;
+    checkDigitIncreaseConsistency = false;
     FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
 }
 
@@ -114,6 +115,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
     ListFlowControll = NULL;
     PreValueOkay = false;
     useMaxRateValue = false;
+    checkDigitIncreaseConsistency = false;    
     FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
     ListFlowControll = lfc;
 }
@@ -157,14 +159,19 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
                 }
             }
         }
+        if ((zerlegt[0] == "CheckDigitIncreaseConsistency") && (zerlegt.size() > 1))
+        {
+            if (toUpper(zerlegt[1]) == "TRUE")
+                checkDigitIncreaseConsistency = true;
+        }        
         if ((zerlegt[0] == "AllowNegativeRates") && (zerlegt.size() > 1))
         {
-            if ((zerlegt[1] == "True") || (zerlegt[1] == "true"))
+            if (toUpper(zerlegt[1]) == "TRUE")
                 AllowNegativeRates = true;
         }
         if ((zerlegt[0] == "ErrorMessage") && (zerlegt.size() > 1))
         {
-            if ((zerlegt[1] == "True") || (zerlegt[1] == "true"))
+            if (toUpper(zerlegt[1]) == "TRUE")
                 ErrorMessage = true;
         }
         if ((zerlegt[0] == "PreValueAgeStartup") && (zerlegt.size() > 1))
@@ -253,9 +260,13 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
 
     if (isdigit)
     {
-        digit = ErsetzteN(digit);
+        int lastanalog = -1;
+        if (isanalog)
+            lastanalog = analog[0] - 48;
+        digit = ErsetzteN(digit, lastanalog);
         zw = digit;
     }
+
     if (isdigit && isanalog)
         zw = zw + ".";
     if (isanalog)
@@ -304,7 +315,7 @@ string ClassFlowPostProcessing::getReadoutParam(bool _rawValue)
 }
 
 
-string ClassFlowPostProcessing::ErsetzteN(string input)
+string ClassFlowPostProcessing::ErsetzteN(string input, int lastvalueanalog = -1)
 {
     int posN, posPunkt;
     int pot, ziffer;
@@ -322,5 +333,45 @@ string ClassFlowPostProcessing::ErsetzteN(string input)
 
         posN = findDelimiterPos(input, "N");
     }
+
+///////////////////////////// TestCode
+/*
+    input = "10";
+    posPunkt = input.length();
+    PreValue = 9.5;
+    lastvalueanalog = 7;
+*/
+    if (checkDigitIncreaseConsistency && lastvalueanalog > -1)
+    {
+        int zifferIST;
+        int substrakt = 0;
+        bool lastcorrected = false;
+        for (int i = input.length() - 1; i >= 0; --i)
+        {
+            zifferIST = input[i] - 48;  //std::stoi(std::string(input[i]));
+            if (lastcorrected)
+            {
+                zifferIST--;
+                input[i] = zifferIST + 48;
+                lastcorrected = false;
+            }
+
+            pot = posPunkt - i - 1;
+            zw = PreValue / pow(10, pot);
+            ziffer = ((int) zw) % 10;
+            if (zifferIST < ziffer)
+            {
+                if (lastvalueanalog >= 7)
+                {
+                    input[i] = ziffer + 48;
+                    lastvalueanalog = ziffer;
+                    lastcorrected = true;
+                }
+            }
+        
+            
+        }
+        
+    }
     return input;
 }

+ 2 - 1
code/lib/jomjol_flowcontroll/ClassFlowPostProcessing.h

@@ -15,6 +15,7 @@ protected:
     bool useMaxRateValue;
     bool ErrorMessage;
     bool PreValueOkay;
+    bool checkDigitIncreaseConsistency;
 
     string FilePreValue;
     float PreValue;
@@ -25,7 +26,7 @@ protected:
     bool LoadPreValue(void);
 
 
-    string ErsetzteN(string);
+    string ErsetzteN(string, int lastvalueanalog);
 
 public:
     ClassFlowPostProcessing();

+ 1 - 1
code/lib/jomjol_tfliteclass/CTfLiteClass.cpp

@@ -166,7 +166,7 @@ bool CTfLiteClass::LoadInputImage(std::string _fn)
                 *(input_data_ptr) = (float) blue;
                 input_data_ptr++;
 
-                printf("BMP: %f %f %f\n", (float) red, (float) green, (float) blue);
+//                printf("BMP: %f %f %f\n", (float) red, (float) green, (float) blue);
 
             }
     return true;

+ 7 - 3
code/src/main.cpp

@@ -104,22 +104,26 @@ void Init_NVS_SDCard()
 
 extern "C" void app_main()
 {
+//    LogFile.WriteToFile("Startsequence 01");
     Init_NVS_SDCard();
-
+    LogFile.WriteToFile("Startsequence 02");
     CheckOTAUpdate();
-
+    LogFile.WriteToFile("Startsequence 03");
     std::string ssid = "";
     std::string password = "";
     LoadWlanFromFile("/sdcard/wlan.ini", ssid, password); 
+    LogFile.WriteToFile("Startsequence 04");    
     printf("WLan: %s, %s\n", ssid.c_str(), password.c_str());
    
     initialise_wifi(ssid, password);
+    LogFile.WriteToFile("Startsequence 05");  
 
     TickType_t xDelay;
     xDelay = 2000 / portTICK_PERIOD_MS;
     printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
+    LogFile.WriteToFile("Startsequence 06");      
     vTaskDelay( xDelay );   
-
+    LogFile.WriteToFile("Startsequence 07");  
     setup_time();
     LogFile.WriteToFile("======================== Main Started ================================");
 

BIN
firmware/firmware.bin


+ 4 - 3
sd-card/config/config.ini

@@ -15,9 +15,9 @@ SearchFieldY = 20
 Model=/config/dig0622.tfl
 ModelInputSize 20, 32
 LogImageLocation = /log/digit
-digit1, 291, 97, 37, 67
-digit2, 344, 97, 37, 67
-digit3, 394, 97, 37, 67
+digit1, 290, 99, 37, 67
+digit2, 342, 99, 37, 67
+digit3, 392, 99, 37, 67
 
 [Analog]
 Model=/config/ana0622.tfl
@@ -34,6 +34,7 @@ PreValueAgeStartup = 30
 AllowNegativeRates = False
 MaxRateValue = 0.1
 ErrorMessage = True
+CheckDigitIncreaseConsistency = True
 
 
 [AutoTimer]