jomjol 4 лет назад
Родитель
Сommit
dd995ec28a

+ 7 - 1
README.md

@@ -47,7 +47,13 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
 
 
 
 
 
 
-##### Rolling (2021-08-31)
+##### Rolling (2021-09-10)
+
+* Upgrade digital CNN to v12.1.0 (added new images)
+* Internal refactoring (CNN-Handling)
+* html: confirmation after config update, spelling corrections
+
+Rolling (2021-08-31)
 
 
 * Bug fix
 * Bug fix
 
 

+ 0 - 487
code/components/jomjol_flowcontroll/ClassFlowAnalog.cpp

@@ -1,487 +0,0 @@
-#include "ClassFlowAnalog.h"
-
-#include <math.h>
-#include <iomanip> 
-#include <sys/types.h>
-#include <sstream>      // std::stringstream
-
-  
-// #define OHNETFLITE
-
-#ifndef OHNETFLITE
-#include "CTfLiteClass.h"
-#endif
-
-#include "ClassLogFile.h"
-
-static const char* TAG = "flow_analog";
-
-bool debugdetailanalog = false;
-
-void ClassFlowAnalog::SetInitialParameter(void)
-{
-    string cnnmodelfile = "";
-    modelxsize = 1;
-    modelysize = 1;
-    ListFlowControll = NULL;
-    previousElement = NULL;   
-    SaveAllFiles = false; 
-    disabled = false;
-    extendedResolution = false;
-}   
-
-ClassFlowAnalog::ClassFlowAnalog(std::vector<ClassFlow*>* lfc) : ClassFlowImage(lfc, TAG)
-{
-    SetInitialParameter();
-    ListFlowControll = lfc;
-
-    for (int i = 0; i < ListFlowControll->size(); ++i)
-    {
-        if (((*ListFlowControll)[i])->name().compare("ClassFlowAlignment") == 0)
-        {
-            flowpostalignment = (ClassFlowAlignment*) (*ListFlowControll)[i];
-        }
-    }
-
-}
-
-
-int ClassFlowAnalog::AnzahlROIs(int _analog = 0)
-{
-    int zw = ANALOG[_analog]->ROI.size();
-    if (extendedResolution)
-        zw++;
-    
-    return zw;
-} 
-
-
-string ClassFlowAnalog::getReadout(int _analog = 0)
-{
-    string result = "";    
-    if (ANALOG[_analog]->ROI.size() == 0)
-        return result;
-
-
-    float zahl = ANALOG[_analog]->ROI[ANALOG[_analog]->ROI.size() - 1]->result;
-    int ergebnis_nachkomma = ((int) floor(zahl * 10)) % 10;
-
-    int prev = -1;
-
-    prev = ZeigerEval(ANALOG[_analog]->ROI[ANALOG[_analog]->ROI.size() - 1]->result, prev);
-    result = std::to_string(prev);
-
-    if (extendedResolution)
-        result = result + std::to_string(ergebnis_nachkomma);
-
-    for (int i = ANALOG[_analog]->ROI.size() - 2; i >= 0; --i)
-    {
-        prev = ZeigerEval(ANALOG[_analog]->ROI[i]->result, prev);
-        result = std::to_string(prev) + result;
-    }
-
-    return result;
-}
-
-int ClassFlowAnalog::ZeigerEval(float zahl, int ziffer_vorgaenger)
-{
-    int ergebnis_nachkomma = ((int) floor(zahl * 10)) % 10;
-    int ergebnis_vorkomma = ((int) floor(zahl)) % 10;
-    int ergebnis, ergebnis_rating;
-
-    if (ziffer_vorgaenger == -1)
-        return ergebnis_vorkomma % 10;
-
-    ergebnis_rating = ergebnis_nachkomma - ziffer_vorgaenger;
-    if (ergebnis_nachkomma >= 5)
-        ergebnis_rating-=5;
-    else
-        ergebnis_rating+=5;
-    ergebnis = (int) round(zahl);
-    if (ergebnis_rating < 0)
-        ergebnis-=1;
-    if (ergebnis == -1)
-        ergebnis+=10;
-
-    ergebnis = ergebnis % 10;
-    return ergebnis;
-}
-
-bool ClassFlowAnalog::ReadParameter(FILE* pfile, string& aktparamgraph)
-{
-    std::vector<string> zerlegt;
-
-    aktparamgraph = trim(aktparamgraph);
-
-    if (aktparamgraph.size() == 0)
-        if (!this->GetNextParagraph(pfile, aktparamgraph))
-            return false;
-
-
-    if ((aktparamgraph.compare("[Analog]") != 0) && (aktparamgraph.compare(";[Analog]") != 0))       // Paragraph passt nich zu MakeImage
-        return false;
-
-    if (aktparamgraph[0] == ';')
-    {
-        disabled = true;
-        while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
-        printf("[Analog] is disabled !!!\n");
-        return true;
-    }
-
-
-    while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
-    {
-        zerlegt = this->ZerlegeZeile(aktparamgraph);
-        if ((zerlegt[0] == "LogImageLocation") && (zerlegt.size() > 1))
-        {
-            this->LogImageLocation = "/sdcard" + zerlegt[1];
-            this->isLogImage = true;
-        }
-        if ((toUpper(zerlegt[0]) == "LOGFILERETENTIONINDAYS") && (zerlegt.size() > 1))
-        {
-            this->logfileRetentionInDays = std::stoi(zerlegt[1]);
-        }
-        if ((zerlegt[0] == "Model") && (zerlegt.size() > 1))
-        {
-            this->cnnmodelfile = zerlegt[1];
-        }
-        if ((zerlegt[0] == "ModelInputSize") && (zerlegt.size() > 2))
-        {
-            this->modelxsize = std::stoi(zerlegt[1]);
-            this->modelysize = std::stoi(zerlegt[2]);
-        }
-        if (zerlegt.size() >= 5)
-        {
-            analog* _analog = GetANALOG(zerlegt[0], true);
-            roianalog* neuroi = _analog->ROI[_analog->ROI.size()-1];
-            neuroi->posx = std::stoi(zerlegt[1]);
-            neuroi->posy = std::stoi(zerlegt[2]);
-            neuroi->deltax = std::stoi(zerlegt[3]);
-            neuroi->deltay = std::stoi(zerlegt[4]);
-            neuroi->result = -1;
-            neuroi->image = NULL;
-            neuroi->image_org = NULL;
-//            ROI.push_back(neuroi);
-        }
-
-        if ((toUpper(zerlegt[0]) == "SAVEALLFILES") && (zerlegt.size() > 1))
-        {
-            if (toUpper(zerlegt[1]) == "TRUE")
-                SaveAllFiles = true;
-        }
-
-        if ((toUpper(zerlegt[0]) == "EXTENDEDRESOLUTION") && (zerlegt.size() > 1))
-        {
-            if (toUpper(zerlegt[1]) == "TRUE")
-                extendedResolution = true;
-        }
-    }
-
-   for (int _ana = 0; _ana < ANALOG.size(); ++_ana)
-        for (int i = 0; i < ANALOG[_ana]->ROI.size(); ++i)
-        {
-            ANALOG[_ana]->ROI[i]->image = new CImageBasis(modelxsize, modelysize, 3);
-            ANALOG[_ana]->ROI[i]->image_org = new CImageBasis(ANALOG[_ana]->ROI[i]->deltax, ANALOG[_ana]->ROI[i]->deltay, 3);
-        }
-
-    return true;
-}
-
-analog* ClassFlowAnalog::FindANALOG(string _name_number)
-{
-
-    for (int i = 0; i < ANALOG.size(); ++i)
-    {
-        if (ANALOG[i]->name == _name_number)
-            return ANALOG[i];
-    }
-
-    return NULL;
-}
-
-
-
-analog* ClassFlowAnalog::GetANALOG(string _name, bool _create = true)
-{
-    string _analog, _roi;
-    int _pospunkt = _name.find_first_of(".");
-//    printf("Name: %s, Pospunkt: %d\n", _name.c_str(), _pospunkt);
-    if (_pospunkt > -1)
-    {
-        _analog = _name.substr(0, _pospunkt);
-        _roi = _name.substr(_pospunkt+1, _name.length() - _pospunkt - 1);
-    }
-    else
-    {
-        _analog = "default";
-        _roi = _name;
-    }
-
-    analog *_ret = NULL;
-
-    for (int i = 0; i < ANALOG.size(); ++i)
-    {
-        if (ANALOG[i]->name == _analog)
-            _ret = ANALOG[i];
-    }
-
-    if (!_create)         // nicht gefunden und soll auch nicht erzeugt werden
-        return _ret;
-
-
-    if (_ret == NULL)
-    {
-        _ret = new analog;
-        _ret->name = _analog;
-        ANALOG.push_back(_ret);
-    }
-
-    roianalog* neuroi = new roianalog;
-    neuroi->name = _roi;
-    _ret->ROI.push_back(neuroi);
-
-    printf("GetANALOG - ANALOG %s - roi %s\n", _analog.c_str(), _roi.c_str());
-
-    return _ret;
-}
-
-
-
-string ClassFlowAnalog::getHTMLSingleStep(string host)
-{
-    string result, zw;
-    std::vector<HTMLInfo*> htmlinfo;
-
-    result = "<p>Found ROIs: </p> <p><img src=\"" + host + "/img_tmp/alg_roi.jpg\"></p>\n";
-    result = result + "Analog Pointers: <p> ";
-
-    htmlinfo = GetHTMLInfo();
-    for (int i = 0; i < htmlinfo.size(); ++i)
-    {
-        std::stringstream stream;
-        stream << std::fixed << std::setprecision(1) << htmlinfo[i]->val;
-        zw = stream.str();
-
-        result = result + "<img src=\"" + host + "/img_tmp/" +  htmlinfo[i]->filename + "\"> " + zw;
-        delete htmlinfo[i];
-    }
-    htmlinfo.clear();         
-
-    return result;
-}
-
-
-
-bool ClassFlowAnalog::doFlow(string time)
-{
-    if (disabled)
-      return true;
-
-    if (!doAlignAndCut(time)){
-        return false;
-    };
-
-    if (debugdetailanalog) LogFile.WriteToFile("ClassFlowAnalog::doFlow nach Alignment");
-
-    doNeuralNetwork(time);
-
-    RemoveOldLogs();
-
-    return true;
-}
-
-bool ClassFlowAnalog::doAlignAndCut(string time)
-{
-    if (disabled)
-        return true;
-
-    CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();    
-
-    for (int _ana = 0; _ana < ANALOG.size(); ++_ana)
-        for (int i = 0; i < ANALOG[_ana]->ROI.size(); ++i)
-        {
-            printf("Analog %d - Align&Cut\n", i);
-            
-            caic->CutAndSave(ANALOG[_ana]->ROI[i]->posx, ANALOG[_ana]->ROI[i]->posy, ANALOG[_ana]->ROI[i]->deltax, ANALOG[_ana]->ROI[i]->deltay, ANALOG[_ana]->ROI[i]->image_org);
-            if (SaveAllFiles)
-            {
-                if (ANALOG[_ana]->name == "default")
-                    ANALOG[_ana]->ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ANALOG[_ana]->ROI[i]->name + ".jpg"));
-                else
-                    ANALOG[_ana]->ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ANALOG[_ana]->name + "_" + ANALOG[_ana]->ROI[i]->name + ".jpg"));
-            } 
-
-            ANALOG[_ana]->ROI[i]->image_org->Resize(modelxsize, modelysize, ANALOG[_ana]->ROI[i]->image);
-            if (SaveAllFiles)
-            {
-                if (ANALOG[_ana]->name == "default")
-                    ANALOG[_ana]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ANALOG[_ana]->ROI[i]->name + ".bmp"));
-                else
-                    ANALOG[_ana]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ANALOG[_ana]->name + "_" + ANALOG[_ana]->ROI[i]->name + ".bmp"));
-            } 
-        }
-
-    return true;
-} 
-
-void ClassFlowAnalog::DrawROI(CImageBasis *_zw)
-{
-    int r = 0;
-    int g = 255;
-    int b = 0;
-
-    for (int _ana = 0; _ana < ANALOG.size(); ++_ana)
-        for (int i = 0; i < ANALOG[_ana]->ROI.size(); ++i)
-        {
-            _zw->drawRect(ANALOG[_ana]->ROI[i]->posx, ANALOG[_ana]->ROI[i]->posy, ANALOG[_ana]->ROI[i]->deltax, ANALOG[_ana]->ROI[i]->deltay, r, g, b, 1);
-            _zw->drawCircle((int) (ANALOG[_ana]->ROI[i]->posx + ANALOG[_ana]->ROI[i]->deltax/2), (int)  (ANALOG[_ana]->ROI[i]->posy + ANALOG[_ana]->ROI[i]->deltay/2), (int) (ANALOG[_ana]->ROI[i]->deltax/2), r, g, b, 2);
-            _zw->drawLine((int) (ANALOG[_ana]->ROI[i]->posx + ANALOG[_ana]->ROI[i]->deltax/2), (int) ANALOG[_ana]->ROI[i]->posy, (int) (ANALOG[_ana]->ROI[i]->posx + ANALOG[_ana]->ROI[i]->deltax/2), (int) (ANALOG[_ana]->ROI[i]->posy + ANALOG[_ana]->ROI[i]->deltay), r, g, b, 2);
-            _zw->drawLine((int) ANALOG[_ana]->ROI[i]->posx, (int) (ANALOG[_ana]->ROI[i]->posy + ANALOG[_ana]->ROI[i]->deltay/2), (int) ANALOG[_ana]->ROI[i]->posx + ANALOG[_ana]->ROI[i]->deltax, (int) (ANALOG[_ana]->ROI[i]->posy + ANALOG[_ana]->ROI[i]->deltay/2), r, g, b, 2);
-        }
-} 
-
-bool ClassFlowAnalog::doNeuralNetwork(string time)
-{
-    if (disabled)
-        return true;
-
-    string logPath = CreateLogFolder(time);
-    
-    string input = "/sdcard/img_tmp/alg.jpg";
-    string ioresize = "/sdcard/img_tmp/resize.bmp";
-    string output;
-    input = FormatFileName(input);
-
-#ifndef OHNETFLITE
-    CTfLiteClass *tflite = new CTfLiteClass;  
-    string zwcnn = "/sdcard" + cnnmodelfile;
-    zwcnn = FormatFileName(zwcnn);
-    printf(zwcnn.c_str());printf("\n");
-    if (!tflite->LoadModel(zwcnn)) {
-        printf("Can't read model file /sdcard%s\n", cnnmodelfile.c_str());
-        delete tflite;
-        return false;
-    } 
-    tflite->MakeAllocate();
-#endif
-
-    for (int _ana = 0; _ana < ANALOG.size(); ++_ana)
-    {
-        for (int i = 0; i < ANALOG[_ana]->ROI.size(); ++i)
-        {
-            printf("Analog %d - TfLite\n", i);
-
-            float f1, f2;
-            f1 = 0; f2 = 0;
-
-    #ifndef OHNETFLITE
-            tflite->LoadInputImageBasis(ANALOG[_ana]->ROI[i]->image);        
-            tflite->Invoke();
-            if (debugdetailanalog) LogFile.WriteToFile("Nach Invoke");
-
-
-            f1 = tflite->GetOutputValue(0);
-            f2 = tflite->GetOutputValue(1);
-    #endif
-
-            float result = fmod(atan2(f1, f2) / (M_PI * 2) + 2, 1);
-    //        printf("Result sin, cos, ziffer: %f, %f, %f\n", f1, f2, result);  
-            ANALOG[_ana]->ROI[i]->result = result * 10;
-
-            printf("Result Analog%i: %f\n", i, ANALOG[_ana]->ROI[i]->result); 
-
-            if (isLogImage)
-            {
-                LogImage(logPath, ANALOG[_ana]->ROI[i]->name, &ANALOG[_ana]->ROI[i]->result, NULL, time, ANALOG[_ana]->ROI[i]->image_org);
-            }
-        }
-    }
-
-#ifndef OHNETFLITE
-        delete tflite;
-#endif    
-
-    return true;
-}
-
-
-std::vector<HTMLInfo*> ClassFlowAnalog::GetHTMLInfo()
-{
-    std::vector<HTMLInfo*> result;
-
-    for (int _ana = 0; _ana < ANALOG.size(); ++_ana)
-        for (int i = 0; i < ANALOG[_ana]->ROI.size(); ++i)
-        {
-                if (ANALOG[_ana]->name == "default")
-                    ANALOG[_ana]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ANALOG[_ana]->ROI[i]->name + ".bmp"));
-                else
-                    ANALOG[_ana]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ANALOG[_ana]->name + "_" + ANALOG[_ana]->ROI[i]->name + ".bmp"));
-
-
-            HTMLInfo *zw = new HTMLInfo;
-            if (ANALOG[_ana]->name == "default")
-            {
-                zw->filename = ANALOG[_ana]->ROI[i]->name + ".bmp";
-                zw->filename_org = ANALOG[_ana]->ROI[i]->name + ".jpg";
-            }
-            else
-            {
-                zw->filename = ANALOG[_ana]->name + "_" + ANALOG[_ana]->ROI[i]->name + ".bmp";
-                zw->filename_org = ANALOG[_ana]->name + "_" + ANALOG[_ana]->ROI[i]->name + ".jpg";
-            }
-
-            zw->val = ANALOG[_ana]->ROI[i]->result;
-            zw->image = ANALOG[_ana]->ROI[i]->image;
-            zw->image_org = ANALOG[_ana]->ROI[i]->image_org;
-
-            result.push_back(zw);
-        }
-
-    return result;
-}
-
-
-
-int ClassFlowAnalog::getAnzahlANALOG()
-{
-    return ANALOG.size();
-}
-
-string ClassFlowAnalog::getNameANALOG(int _analog)
-{
-    if (_analog < ANALOG.size())
-        return ANALOG[_analog]->name;
-
-    return "ANALOG DOES NOT EXIST";
-}
-
-analog* ClassFlowAnalog::GetANALOG(int _analog)
-{
-    if (_analog < ANALOG.size())
-        return ANALOG[_analog];
-
-    return NULL;
-}
-
-
-
-void ClassFlowAnalog::UpdateNameNumbers(std::vector<std::string> *_name_numbers)
-{
-    for (int _dig = 0; _dig < ANALOG.size(); _dig++)
-    {
-        std::string _name = ANALOG[_dig]->name;
-        bool found = false;
-        for (int i = 0; i < (*_name_numbers).size(); ++i)
-        {
-            if ((*_name_numbers)[i] == _name)
-                found = true;
-        }
-        if (!found)
-            (*_name_numbers).push_back(_name);
-    }
-}
-
-
-
-

+ 593 - 0
code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp

@@ -0,0 +1,593 @@
+#include "ClassFlowCNNGeneral.h"
+
+#include <math.h>
+#include <iomanip> 
+#include <sys/types.h>
+#include <sstream>      // std::stringstream
+
+#include "CTfLiteClass.h"
+#include "ClassLogFile.h"
+
+static const char* TAG = "flow_analog";
+
+bool debugdetailgeneral = false;
+
+ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNType _cnntype) : ClassFlowImage(NULL, TAG)
+{
+    string cnnmodelfile = "";
+    modelxsize = 1;
+    modelysize = 1;
+    ListFlowControll = NULL;
+    previousElement = NULL;   
+    SaveAllFiles = false; 
+    disabled = false;
+    extendedResolution = false;
+    isLogImageSelect = false;
+    CNNType = AutoDetect;
+    CNNType = _cnntype;
+    flowpostalignment = _flowalign;
+}
+
+
+int ClassFlowCNNGeneral::AnzahlROIs(int _analog = 0)
+{
+    int zw = GENERAL[_analog]->ROI.size();
+    if (extendedResolution && (CNNType != Digital)) zw++;   // da letzte Ziffer inkl Nachhkomma, es sei denn, das Nachkomma gibt es nicht (Digital)
+    return zw;
+} 
+
+
+string ClassFlowCNNGeneral::getReadout(int _analog = 0)
+{
+    string result = "";    
+    if (GENERAL[_analog]->ROI.size() == 0)
+        return result;
+
+    if (CNNType == Analogue)
+    {
+        float zahl = GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result;
+        int ergebnis_nachkomma = ((int) floor(zahl * 10)) % 10;
+
+        int prev = -1;
+
+        prev = ZeigerEval(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result, prev);
+        result = std::to_string(prev);
+
+        if (extendedResolution && (CNNType != Digital))
+            result = result + std::to_string(ergebnis_nachkomma);
+
+        for (int i = GENERAL[_analog]->ROI.size() - 2; i >= 0; --i)
+        {
+            prev = ZeigerEval(GENERAL[_analog]->ROI[i]->result, prev);
+            result = std::to_string(prev) + result;
+        }
+    }
+
+    if (CNNType == Digital)
+    {
+        for (int i = 0; i < GENERAL[_analog]->ROI.size(); ++i)
+        {
+            if (GENERAL[_analog]->ROI[i]->resultklasse == 10)
+                result = result + "N";
+            else
+                result = result + std::to_string(GENERAL[_analog]->ROI[i]->resultklasse);
+        }
+    }
+
+    if (CNNType == DigitalHyprid)
+    {
+        int ergebnis_nachkomma = -1;
+        int prev = -1;
+
+        float zahl = GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result;
+        if (zahl >= 0)       // NaN?
+        {
+            ergebnis_nachkomma = ((int) floor(zahl * 10)) % 10;
+            prev = ZeigerEval(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result, prev);
+            result = std::to_string(prev);
+            if (extendedResolution && (CNNType != Digital))
+                result = result + std::to_string(ergebnis_nachkomma);
+        }
+        else
+        {
+            result = "N";
+            if (extendedResolution && (CNNType != Digital))
+                result = "NN";
+        }
+
+        for (int i = GENERAL[_analog]->ROI.size() - 2; i >= 0; --i)
+        {
+            if (GENERAL[_analog]->ROI[i]->result >= 0)
+            {
+                prev = ZeigerEval(GENERAL[_analog]->ROI[i]->result, prev);
+                result = std::to_string(prev) + result;
+            }
+            else
+            {
+                prev = -1;
+                result = "N" + result;
+            }
+        }
+    }
+
+
+    return result;
+}
+
+int ClassFlowCNNGeneral::ZeigerEval(float zahl, int ziffer_vorgaenger)
+{
+    int ergebnis_nachkomma = ((int) floor(zahl * 10)) % 10;
+    int ergebnis_vorkomma = ((int) floor(zahl)) % 10;
+    int ergebnis, ergebnis_rating;
+
+    if (ziffer_vorgaenger == -1)
+        return ergebnis_vorkomma % 10;
+
+    ergebnis_rating = ergebnis_nachkomma - ziffer_vorgaenger;
+    if (ergebnis_nachkomma >= 5)
+        ergebnis_rating-=5;
+    else
+        ergebnis_rating+=5;
+    ergebnis = (int) round(zahl);
+    if (ergebnis_rating < 0)
+        ergebnis-=1;
+    if (ergebnis == -1)
+        ergebnis+=10;
+
+    ergebnis = ergebnis % 10;
+    return ergebnis;
+}
+
+bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph)
+{
+    std::vector<string> zerlegt;
+
+    aktparamgraph = trim(aktparamgraph);
+
+    if (aktparamgraph.size() == 0)
+        if (!this->GetNextParagraph(pfile, aktparamgraph))
+            return false;
+
+
+    if ((toUpper(aktparamgraph) != "[ANALOG]") && (toUpper(aktparamgraph) != ";[ANALOG]") 
+        && (toUpper(aktparamgraph) != "[DIGIT]") && (toUpper(aktparamgraph) != ";[DIGIT]")
+        && (toUpper(aktparamgraph) != "[DIGITS]") && (toUpper(aktparamgraph) != ";[DIGITS]")
+        )       // Paragraph passt nicht
+        return false;
+
+
+/*
+    if ((aktparamgraph.compare("[Analog]") != 0) && (aktparamgraph.compare(";[Analog]") != 0) 
+        && (aktparamgraph.compare("[Digit]") != 0) && (aktparamgraph.compare(";[Digit]")))       // Paragraph passt nicht
+        return false;
+*/
+
+    if (aktparamgraph[0] == ';')
+    {
+        disabled = true;
+        while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
+        printf("[Analog/Digit] is disabled !!!\n");
+        return true;
+    }
+
+
+    while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
+    {
+        zerlegt = this->ZerlegeZeile(aktparamgraph);
+        if ((zerlegt[0] == "LogImageLocation") && (zerlegt.size() > 1))
+        {
+            this->LogImageLocation = "/sdcard" + zerlegt[1];
+            this->isLogImage = true;
+        }
+        if ((zerlegt[0] == "LogImageSelect") && (zerlegt.size() > 1))
+        {
+            LogImageSelect = zerlegt[1];
+            isLogImageSelect = true;            
+        }
+
+        if ((toUpper(zerlegt[0]) == "LOGFILERETENTIONINDAYS") && (zerlegt.size() > 1))
+        {
+            this->logfileRetentionInDays = std::stoi(zerlegt[1]);
+        }
+        if ((toUpper(zerlegt[0]) == "MODELTYPE") && (zerlegt.size() > 1))
+        {
+            if (toUpper(zerlegt[1]) == "DIGITHYPRID")
+                CNNType = DigitalHyprid;
+        }
+
+        if ((zerlegt[0] == "Model") && (zerlegt.size() > 1))
+        {
+            this->cnnmodelfile = zerlegt[1];
+        }
+        if ((zerlegt[0] == "ModelInputSize") && (zerlegt.size() > 2))
+        {
+            this->modelxsize = std::stoi(zerlegt[1]);
+            this->modelysize = std::stoi(zerlegt[2]);
+        }
+        if (zerlegt.size() >= 5)
+        {
+            general* _analog = GetGENERAL(zerlegt[0], true);
+            roi* neuroi = _analog->ROI[_analog->ROI.size()-1];
+            neuroi->posx = std::stoi(zerlegt[1]);
+            neuroi->posy = std::stoi(zerlegt[2]);
+            neuroi->deltax = std::stoi(zerlegt[3]);
+            neuroi->deltay = std::stoi(zerlegt[4]);
+            neuroi->result = -1;
+            neuroi->image = NULL;
+            neuroi->image_org = NULL;
+        }
+
+        if ((toUpper(zerlegt[0]) == "SAVEALLFILES") && (zerlegt.size() > 1))
+        {
+            if (toUpper(zerlegt[1]) == "TRUE")
+                SaveAllFiles = true;
+        }
+
+        if ((toUpper(zerlegt[0]) == "EXTENDEDRESOLUTION") && (zerlegt.size() > 1))
+        {
+            if (toUpper(zerlegt[1]) == "TRUE")
+                extendedResolution = true;
+        }
+    }
+
+   for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
+        for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
+        {
+            GENERAL[_ana]->ROI[i]->image = new CImageBasis(modelxsize, modelysize, 3);
+            GENERAL[_ana]->ROI[i]->image_org = new CImageBasis(GENERAL[_ana]->ROI[i]->deltax, GENERAL[_ana]->ROI[i]->deltay, 3);
+        }
+
+    return true;
+}
+
+general* ClassFlowCNNGeneral::FindGENERAL(string _name_number)
+{
+    for (int i = 0; i < GENERAL.size(); ++i)
+        if (GENERAL[i]->name == _name_number)
+            return GENERAL[i];
+    return NULL;
+}
+
+
+
+general* ClassFlowCNNGeneral::GetGENERAL(string _name, bool _create = true)
+{
+    string _analog, _roi;
+    int _pospunkt = _name.find_first_of(".");
+
+    if (_pospunkt > -1)
+    {
+        _analog = _name.substr(0, _pospunkt);
+        _roi = _name.substr(_pospunkt+1, _name.length() - _pospunkt - 1);
+    }
+    else
+    {
+        _analog = "default";
+        _roi = _name;
+    }
+
+    general *_ret = NULL;
+
+    for (int i = 0; i < GENERAL.size(); ++i)
+        if (GENERAL[i]->name == _analog)
+            _ret = GENERAL[i];
+
+    if (!_create)         // nicht gefunden und soll auch nicht erzeugt werden
+        return _ret;
+
+    if (_ret == NULL)
+    {
+        _ret = new general;
+        _ret->name = _analog;
+        GENERAL.push_back(_ret);
+    }
+
+    roi* neuroi = new roi;
+    neuroi->name = _roi;
+    _ret->ROI.push_back(neuroi);
+
+    printf("GetGENERAL - GENERAL %s - roi %s\n", _analog.c_str(), _roi.c_str());
+
+    return _ret;
+}
+
+
+
+string ClassFlowCNNGeneral::getHTMLSingleStep(string host)
+{
+    string result, zw;
+    std::vector<HTMLInfo*> htmlinfo;
+
+    result = "<p>Found ROIs: </p> <p><img src=\"" + host + "/img_tmp/alg_roi.jpg\"></p>\n";
+    result = result + "Analog Pointers: <p> ";
+
+    htmlinfo = GetHTMLInfo();
+    for (int i = 0; i < htmlinfo.size(); ++i)
+    {
+        std::stringstream stream;
+        stream << std::fixed << std::setprecision(1) << htmlinfo[i]->val;
+        zw = stream.str();
+
+        result = result + "<img src=\"" + host + "/img_tmp/" +  htmlinfo[i]->filename + "\"> " + zw;
+        delete htmlinfo[i];
+    }
+    htmlinfo.clear();         
+
+    return result;
+}
+
+
+
+bool ClassFlowCNNGeneral::doFlow(string time)
+{
+    if (disabled)
+      return true;
+
+    if (!doAlignAndCut(time)){
+        return false;
+    };
+
+    if (debugdetailgeneral) LogFile.WriteToFile("ClassFlowCNNGeneral::doFlow nach Alignment");
+
+    doNeuralNetwork(time);
+
+    RemoveOldLogs();
+    return true;
+}
+
+bool ClassFlowCNNGeneral::doAlignAndCut(string time)
+{
+    if (disabled)
+        return true;
+
+    CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();    
+
+    for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
+        for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
+        {
+            printf("General %d - Align&Cut\n", i);
+            
+            caic->CutAndSave(GENERAL[_ana]->ROI[i]->posx, GENERAL[_ana]->ROI[i]->posy, GENERAL[_ana]->ROI[i]->deltax, GENERAL[_ana]->ROI[i]->deltay, GENERAL[_ana]->ROI[i]->image_org);
+            if (SaveAllFiles)
+            {
+                if (GENERAL[_ana]->name == "default")
+                    GENERAL[_ana]->ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + GENERAL[_ana]->ROI[i]->name + ".jpg"));
+                else
+                    GENERAL[_ana]->ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg"));
+            } 
+
+            GENERAL[_ana]->ROI[i]->image_org->Resize(modelxsize, modelysize, GENERAL[_ana]->ROI[i]->image);
+            if (SaveAllFiles)
+            {
+                if (GENERAL[_ana]->name == "default")
+                    GENERAL[_ana]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + GENERAL[_ana]->ROI[i]->name + ".bmp"));
+                else
+                    GENERAL[_ana]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".bmp"));
+            } 
+        }
+
+    return true;
+} 
+
+void ClassFlowCNNGeneral::DrawROI(CImageBasis *_zw)
+{
+    if (CNNType == Analogue)
+    {
+        int r = 0;
+        int g = 255;
+        int b = 0;
+
+        for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
+            for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
+            {
+                _zw->drawRect(GENERAL[_ana]->ROI[i]->posx, GENERAL[_ana]->ROI[i]->posy, GENERAL[_ana]->ROI[i]->deltax, GENERAL[_ana]->ROI[i]->deltay, r, g, b, 1);
+                _zw->drawCircle((int) (GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax/2), (int)  (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay/2), (int) (GENERAL[_ana]->ROI[i]->deltax/2), r, g, b, 2);
+                _zw->drawLine((int) (GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax/2), (int) GENERAL[_ana]->ROI[i]->posy, (int) (GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax/2), (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay), r, g, b, 2);
+                _zw->drawLine((int) GENERAL[_ana]->ROI[i]->posx, (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay/2), (int) GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax, (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay/2), r, g, b, 2);
+            }
+    }
+    else
+    {
+        for (int _dig = 0; _dig < GENERAL.size(); ++_dig)
+            for (int i = 0; i < GENERAL[_dig]->ROI.size(); ++i)
+                _zw->drawRect(GENERAL[_dig]->ROI[i]->posx, GENERAL[_dig]->ROI[i]->posy, GENERAL[_dig]->ROI[i]->deltax, GENERAL[_dig]->ROI[i]->deltay, 0, 0, (255 - _dig*100), 2);
+    }
+} 
+
+bool ClassFlowCNNGeneral::doNeuralNetwork(string time)
+{
+    if (disabled)
+        return true;
+
+    string logPath = CreateLogFolder(time);
+
+    CTfLiteClass *tflite = new CTfLiteClass;  
+    string zwcnn = "/sdcard" + cnnmodelfile;
+    zwcnn = FormatFileName(zwcnn);
+    printf(zwcnn.c_str());printf("\n");
+    if (!tflite->LoadModel(zwcnn)) {
+        printf("Can't read model file /sdcard%s\n", cnnmodelfile.c_str());
+        delete tflite;
+        return false;
+    } 
+    tflite->MakeAllocate();
+
+    if (CNNType == AutoDetect)
+    {
+        int _anzoutputdimensions = tflite->GetAnzOutPut();
+        switch (_anzoutputdimensions) 
+        {
+            case 2:
+                CNNType = Analogue;
+                printf("TFlite-Type set to Analogue\n");
+                break;
+            case 11:
+                CNNType = Digital;
+                printf("TFlite-Type set to Digital\n");
+                break;
+            case 22:
+                CNNType = DigitalHyprid;
+                printf("TFlite-Type set to DigitalHyprid\n");
+                break;
+            default:
+                printf("ERROR ERROR ERROR - tflite passt nicht zur Firmware - ERROR ERROR ERROR\n");
+        }
+    }
+
+    for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
+    {
+        for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
+        {
+            printf("General %d - TfLite\n", i);
+
+            switch (CNNType) {
+                case Analogue:
+                    {
+                        float f1, f2;
+                        f1 = 0; f2 = 0;
+
+                        tflite->LoadInputImageBasis(GENERAL[_ana]->ROI[i]->image);        
+                        tflite->Invoke();
+                        if (debugdetailgeneral) LogFile.WriteToFile("Nach Invoke");
+
+                        f1 = tflite->GetOutputValue(0);
+                        f2 = tflite->GetOutputValue(1);
+                        float result = fmod(atan2(f1, f2) / (M_PI * 2) + 2, 1);
+                        GENERAL[_ana]->ROI[i]->result = result * 10;
+                        printf("Result General(Analog)%i: %f\n", i, GENERAL[_ana]->ROI[i]->result); 
+                        if (isLogImage)
+                            LogImage(logPath, GENERAL[_ana]->ROI[i]->name, &GENERAL[_ana]->ROI[i]->result, NULL, time, GENERAL[_ana]->ROI[i]->image_org);
+                    } break;
+                case Digital:
+                    {
+                        GENERAL[_ana]->ROI[i]->resultklasse = 0;
+                        GENERAL[_ana]->ROI[i]->resultklasse = tflite->GetClassFromImageBasis(GENERAL[_ana]->ROI[i]->image);
+                        printf("Result General(Digit)%i: %d\n", i, GENERAL[_ana]->ROI[i]->resultklasse);
+
+                        if (isLogImage)
+                        {
+                            if (isLogImageSelect)
+                            {
+                                if (LogImageSelect.find(GENERAL[_ana]->ROI[i]->name) != std::string::npos)
+                                    LogImage(logPath, GENERAL[_ana]->ROI[i]->name, NULL, &GENERAL[_ana]->ROI[i]->resultklasse, time, GENERAL[_ana]->ROI[i]->image_org);
+                            }
+                            else
+                            {
+                                LogImage(logPath, GENERAL[_ana]->ROI[i]->name, NULL, &GENERAL[_ana]->ROI[i]->resultklasse, time, GENERAL[_ana]->ROI[i]->image_org);
+                            }
+                        }
+                    } break;
+                case DigitalHyprid:
+                    {
+                        int _num, _nachkomma;
+
+                        tflite->LoadInputImageBasis(GENERAL[_ana]->ROI[i]->image);        
+                        tflite->Invoke();
+                        if (debugdetailgeneral) LogFile.WriteToFile("Nach Invoke");
+
+                        _num = tflite->GetOutClassification(0, 10);
+                        _nachkomma = tflite->GetOutClassification(11, 22);
+
+                        if ((_num == 10) || (_nachkomma == 10))                      // NaN detektiert
+                            GENERAL[_ana]->ROI[i]->result = -1;
+                        else
+                            GENERAL[_ana]->ROI[i]->result = fmod(_num + (_nachkomma-5)/10 + 10, 10);
+
+                        printf("Result General(DigitalHyprid)%i: %f\n", i, GENERAL[_ana]->ROI[i]->result); 
+                        if (isLogImage)
+                            LogImage(logPath, GENERAL[_ana]->ROI[i]->name, &GENERAL[_ana]->ROI[i]->result, NULL, time, GENERAL[_ana]->ROI[i]->image_org);
+                    } break;
+                default:
+                    break;
+            }
+        }
+    }
+
+    delete tflite;
+
+    return true;
+}
+
+bool ClassFlowCNNGeneral::isExtendedResolution(int _number)
+{
+    if (extendedResolution && !(CNNType == Digital))
+        return true;
+
+    return false;
+}
+
+
+
+std::vector<HTMLInfo*> ClassFlowCNNGeneral::GetHTMLInfo()
+{
+    std::vector<HTMLInfo*> result;
+
+    for (int _ana = 0; _ana < GENERAL.size(); ++_ana)
+        for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
+        {
+                if (GENERAL[_ana]->name == "default")
+                    GENERAL[_ana]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + GENERAL[_ana]->ROI[i]->name + ".bmp"));
+                else
+                    GENERAL[_ana]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".bmp"));
+
+
+            HTMLInfo *zw = new HTMLInfo;
+            if (GENERAL[_ana]->name == "default")
+            {
+                zw->filename = GENERAL[_ana]->ROI[i]->name + ".bmp";
+                zw->filename_org = GENERAL[_ana]->ROI[i]->name + ".jpg";
+            }
+            else
+            {
+                zw->filename = GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".bmp";
+                zw->filename_org = GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg";
+            }
+
+            zw->val = GENERAL[_ana]->ROI[i]->result;
+            zw->image = GENERAL[_ana]->ROI[i]->image;
+            zw->image_org = GENERAL[_ana]->ROI[i]->image_org;
+
+            result.push_back(zw);
+        }
+
+    return result;
+}
+
+int ClassFlowCNNGeneral::getAnzahlGENERAL()
+{
+    return GENERAL.size();
+}
+
+string ClassFlowCNNGeneral::getNameGENERAL(int _analog)
+{
+    if (_analog < GENERAL.size())
+        return GENERAL[_analog]->name;
+
+    return "GENERAL DOES NOT EXIST";
+}
+
+general* ClassFlowCNNGeneral::GetGENERAL(int _analog)
+{
+    if (_analog < GENERAL.size())
+        return GENERAL[_analog];
+
+    return NULL;
+}
+
+
+
+void ClassFlowCNNGeneral::UpdateNameNumbers(std::vector<std::string> *_name_numbers)
+{
+    for (int _dig = 0; _dig < GENERAL.size(); _dig++)
+    {
+        std::string _name = GENERAL[_dig]->name;
+        bool found = false;
+        for (int i = 0; i < (*_name_numbers).size(); ++i)
+        {
+            if ((*_name_numbers)[i] == _name)
+                found = true;
+        }
+        if (!found)
+            (*_name_numbers).push_back(_name);
+    }
+}

+ 34 - 24
code/components/jomjol_flowcontroll/ClassFlowAnalog.h → code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h

@@ -1,65 +1,75 @@
 #pragma once
 #pragma once
 #include "ClassFlowImage.h"
 #include "ClassFlowImage.h"
 #include "ClassFlowAlignment.h"
 #include "ClassFlowAlignment.h"
-// #include "CTfLiteClass.h"
 
 
-struct roianalog {
+enum t_CNNType {
+    AutoDetect,
+    Analogue,
+    Digital,
+    DigitalHyprid,
+    None
+ };
+
+struct roi {
     int posx, posy, deltax, deltay;
     int posx, posy, deltax, deltay;
     float result;
     float result;
-    CImageBasis *image, *image_org;
+    int resultklasse;
     string name;
     string name;
+    CImageBasis *image, *image_org;
 };
 };
 
 
-struct analog {
+struct general {
     string name;
     string name;
-    std::vector<roianalog*> ROI;
+    std::vector<roi*> ROI;
 };
 };
 
 
 
 
-class ClassFlowAnalog :
+class ClassFlowCNNGeneral :
     public ClassFlowImage
     public ClassFlowImage
 {
 {
 protected:
 protected:
-//    std::vector<roianalog*> ROI;
-    std::vector<analog*> ANALOG;
+    t_CNNType CNNType;
+    std::vector<general*> GENERAL;
 
 
     string cnnmodelfile;
     string cnnmodelfile;
     int modelxsize, modelysize;
     int modelxsize, modelysize;
-    int ZeigerEval(float zahl, int ziffer_vorgaenger);
-    bool SaveAllFiles;    
-
-
+    bool isLogImageSelect;
+    string LogImageSelect;
     ClassFlowAlignment* flowpostalignment;
     ClassFlowAlignment* flowpostalignment;
+    bool SaveAllFiles;   
+    bool extendedResolution;
 
 
-	void SetInitialParameter(void);   
+    int ZeigerEval(float zahl, int ziffer_vorgaenger);
 
 
+    bool doNeuralNetwork(string time); 
+    bool doAlignAndCut(string time);
 
 
 public:
 public:
-    bool extendedResolution;
-
-    ClassFlowAnalog(std::vector<ClassFlow*>* lfc);
+    ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNType _cnntype = AutoDetect);
 
 
     bool ReadParameter(FILE* pfile, string& aktparamgraph);
     bool ReadParameter(FILE* pfile, string& aktparamgraph);
     bool doFlow(string time);
     bool doFlow(string time);
+
     string getHTMLSingleStep(string host);
     string getHTMLSingleStep(string host);
     string getReadout(int _analog);   
     string getReadout(int _analog);   
 
 
     void DrawROI(CImageBasis *_zw); 
     void DrawROI(CImageBasis *_zw); 
 
 
-    bool doNeuralNetwork(string time); 
-    bool doAlignAndCut(string time);
    	std::vector<HTMLInfo*> GetHTMLInfo();   
    	std::vector<HTMLInfo*> GetHTMLInfo();   
+
     int AnzahlROIs(int _analog);
     int AnzahlROIs(int _analog);
+    int getAnzahlGENERAL();
+    general* GetGENERAL(int _analog);
+    general* GetGENERAL(string _name, bool _create);
+    general* FindGENERAL(string _name_number);    
+    string getNameGENERAL(int _analog);    
 
 
-    int getAnzahlANALOG();
-    analog* GetANALOG(int _analog);
-    analog* GetANALOG(string _name, bool _create);
-    analog* FindANALOG(string _name_number);    
-    string getNameANALOG(int _analog);     
+    bool isExtendedResolution(int _number); 
 
 
     void UpdateNameNumbers(std::vector<std::string> *_name_numbers);
     void UpdateNameNumbers(std::vector<std::string> *_name_numbers);
 
 
+    t_CNNType getCNNType(){return CNNType;};
 
 
-    string name(){return "ClassFlowAnalog";}; 
+    string name(){return "ClassFlowCNNGeneral";}; 
 };
 };
 
 

+ 46 - 15
code/components/jomjol_flowcontroll/ClassFlowControll.cpp

@@ -35,10 +35,10 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
     if ((_stepname.compare(0, 7, "[Digits") == 0) || (_stepname.compare(0, 8, ";[Digits") == 0)) {
     if ((_stepname.compare(0, 7, "[Digits") == 0) || (_stepname.compare(0, 8, ";[Digits") == 0)) {
 //    if ((_stepname.compare("[Digits]") == 0) || (_stepname.compare(";[Digits]") == 0)){
 //    if ((_stepname.compare("[Digits]") == 0) || (_stepname.compare(";[Digits]") == 0)){
 //        printf("Digits!!!\n");
 //        printf("Digits!!!\n");
-        _classname = "ClassFlowDigit";
+        _classname = "ClassFlowCNNGeneral";
     }
     }
     if ((_stepname.compare("[Analog]") == 0) || (_stepname.compare(";[Analog]") == 0)){
     if ((_stepname.compare("[Analog]") == 0) || (_stepname.compare(";[Analog]") == 0)){
-        _classname = "ClassFlowAnalog";
+        _classname = "ClassFlowCNNGeneral";
     }
     }
     if ((_stepname.compare("[MQTT]") == 0) || (_stepname.compare(";[MQTT]") == 0)){
     if ((_stepname.compare("[MQTT]") == 0) || (_stepname.compare(";[MQTT]") == 0)){
         _classname = "ClassFlowMQTT";
         _classname = "ClassFlowMQTT";
@@ -54,16 +54,17 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
     return result;
     return result;
 }
 }
 
 
+
 std::string ClassFlowControll::TranslateAktstatus(std::string _input)
 std::string ClassFlowControll::TranslateAktstatus(std::string _input)
 {
 {
     if (_input.compare("ClassFlowMakeImage") == 0)
     if (_input.compare("ClassFlowMakeImage") == 0)
         return ("Take Image");
         return ("Take Image");
     if (_input.compare("ClassFlowAlignment") == 0)
     if (_input.compare("ClassFlowAlignment") == 0)
         return ("Aligning");
         return ("Aligning");
-    if (_input.compare("ClassFlowAnalog") == 0)
-        return ("Analog ROIs");
-    if (_input.compare("ClassFlowDigit") == 0)
-        return ("Digital ROIs");
+    //if (_input.compare("ClassFlowAnalog") == 0)
+    //    return ("Analog ROIs");
+    if (_input.compare("ClassFlowCNNGeneral") == 0)
+        return ("Digitalization of ROIs");
     if (_input.compare("ClassFlowMQTT") == 0)
     if (_input.compare("ClassFlowMQTT") == 0)
         return ("Sending MQTT");
         return ("Sending MQTT");
     if (_input.compare("ClassFlowPostProcessing") == 0)
     if (_input.compare("ClassFlowPostProcessing") == 0)
@@ -75,9 +76,14 @@ std::string ClassFlowControll::TranslateAktstatus(std::string _input)
 
 
 std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital()
 std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital()
 {
 {
+/*    
     for (int i = 0; i < FlowControll.size(); ++i)
     for (int i = 0; i < FlowControll.size(); ++i)
-        if (FlowControll[i]->name().compare("ClassFlowDigit") == 0)
-            return ((ClassFlowDigit*) (FlowControll[i]))->GetHTMLInfo();
+        if (FlowControll[i]->name().compare("ClassFlowCNNGeneral") == 0)
+            return ((ClassFlowCNNGeneral*) (FlowControll[i]))->GetHTMLInfo();
+*/
+
+    if (flowdigit)
+        flowdigit->GetHTMLInfo();
 
 
     std::vector<HTMLInfo*> empty;
     std::vector<HTMLInfo*> empty;
     return empty;
     return empty;
@@ -85,14 +91,39 @@ std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital()
 
 
 std::vector<HTMLInfo*> ClassFlowControll::GetAllAnalog()
 std::vector<HTMLInfo*> ClassFlowControll::GetAllAnalog()
 {
 {
+/*
     for (int i = 0; i < FlowControll.size(); ++i)
     for (int i = 0; i < FlowControll.size(); ++i)
         if (FlowControll[i]->name().compare("ClassFlowAnalog") == 0)
         if (FlowControll[i]->name().compare("ClassFlowAnalog") == 0)
             return ((ClassFlowAnalog*) (FlowControll[i]))->GetHTMLInfo();
             return ((ClassFlowAnalog*) (FlowControll[i]))->GetHTMLInfo();
 
 
+    std::vector<HTMLInfo*> empty;
+    return empty;
+*/
+
+    if (flowanalog)
+        flowanalog->GetHTMLInfo();
+
     std::vector<HTMLInfo*> empty;
     std::vector<HTMLInfo*> empty;
     return empty;
     return empty;
 }
 }
 
 
+t_CNNType ClassFlowControll::GetTypeDigital()
+{
+    if (flowdigit)
+        return flowdigit->getCNNType();
+
+    return t_CNNType::None;
+}
+
+t_CNNType ClassFlowControll::GetTypeAnalog()
+{
+    if (flowanalog)
+        return flowanalog->getCNNType();
+
+    return t_CNNType::None;
+}
+
+
 
 
 
 
 string ClassFlowControll::GetMQTTMainTopic()
 string ClassFlowControll::GetMQTTMainTopic()
@@ -145,20 +176,20 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
     }
     }
     if (toUpper(_type).compare("[ANALOG]") == 0)
     if (toUpper(_type).compare("[ANALOG]") == 0)
     {
     {
-        cfc = new ClassFlowAnalog(&FlowControll);
-        flowanalog = (ClassFlowAnalog*) cfc;
+        cfc = new ClassFlowCNNGeneral(flowalignment);
+        flowanalog = (ClassFlowCNNGeneral*) cfc;
     }
     }
     if (toUpper(_type).compare(0, 7, "[DIGITS") == 0)
     if (toUpper(_type).compare(0, 7, "[DIGITS") == 0)
     {
     {
-        cfc = new ClassFlowDigit(&FlowControll);
-        flowdigit = (ClassFlowDigit*) cfc;
+        cfc = new ClassFlowCNNGeneral(flowalignment);
+        flowdigit = (ClassFlowCNNGeneral*) cfc;
     }
     }
     if (toUpper(_type).compare("[MQTT]") == 0)
     if (toUpper(_type).compare("[MQTT]") == 0)
         cfc = new ClassFlowMQTT(&FlowControll);
         cfc = new ClassFlowMQTT(&FlowControll);
         
         
     if (toUpper(_type).compare("[POSTPROCESSING]") == 0)
     if (toUpper(_type).compare("[POSTPROCESSING]") == 0)
     {
     {
-        cfc = new ClassFlowPostProcessing(&FlowControll); 
+        cfc = new ClassFlowPostProcessing(&FlowControll, flowanalog, flowdigit); 
         flowpostprocessing = (ClassFlowPostProcessing*) cfc;
         flowpostprocessing = (ClassFlowPostProcessing*) cfc;
     }
     }
 
 
@@ -203,7 +234,7 @@ void ClassFlowControll::InitFlow(std::string config)
         cfc = CreateClassFlow(line);
         cfc = CreateClassFlow(line);
         if (cfc)
         if (cfc)
         {
         {
-            printf("Start ReadParameter\n");
+            printf("Start ReadParameter (%s)\n", line.c_str());
             cfc->ReadParameter(pFile, line);
             cfc->ReadParameter(pFile, line);
         }
         }
         else
         else
@@ -254,7 +285,7 @@ bool ClassFlowControll::doFlow(string time)
     for (int i = 0; i < FlowControll.size(); ++i)
     for (int i = 0; i < FlowControll.size(); ++i)
     {
     {
         zw_time = gettimestring("%H:%M:%S");
         zw_time = gettimestring("%H:%M:%S");
-        aktstatus = TranslateAktstatus(FlowControll[i]->name()) + "(" + zw_time + ")";
+        aktstatus = TranslateAktstatus(FlowControll[i]->name()) + " (" + zw_time + ")";
 
 
 //        zw_time = gettimestring("%Y%m%d-%H%M%S");
 //        zw_time = gettimestring("%Y%m%d-%H%M%S");
 //        aktstatus = zw_time + ": " + FlowControll[i]->name();
 //        aktstatus = zw_time + ": " + FlowControll[i]->name();

+ 9 - 4
code/components/jomjol_flowcontroll/ClassFlowControll.h

@@ -5,10 +5,11 @@
 #include "ClassFlow.h"
 #include "ClassFlow.h"
 #include "ClassFlowMakeImage.h"
 #include "ClassFlowMakeImage.h"
 #include "ClassFlowAlignment.h"
 #include "ClassFlowAlignment.h"
-#include "ClassFlowDigit.h"
-#include "ClassFlowAnalog.h"
+//#include "ClassFlowDigit.h"
+#include "ClassFlowCNNGeneral.h"
 #include "ClassFlowPostProcessing.h"
 #include "ClassFlowPostProcessing.h"
 #include "ClassFlowMQTT.h"
 #include "ClassFlowMQTT.h"
+#include "ClassFlowCNNGeneral.h"
 
 
 
 
 #define READOUT_TYPE_VALUE 0
 #define READOUT_TYPE_VALUE 0
@@ -24,8 +25,9 @@ protected:
 	std::vector<ClassFlow*> FlowControll;
 	std::vector<ClassFlow*> FlowControll;
 	ClassFlowPostProcessing* flowpostprocessing;
 	ClassFlowPostProcessing* flowpostprocessing;
 	ClassFlowAlignment* flowalignment;	
 	ClassFlowAlignment* flowalignment;	
-	ClassFlowAnalog* flowanalog;
-	ClassFlowDigit* flowdigit;
+	ClassFlowCNNGeneral* flowanalog;
+	ClassFlowCNNGeneral* flowdigit;
+//	ClassFlowDigit* flowdigit;
 	ClassFlowMakeImage* flowmakeimage;
 	ClassFlowMakeImage* flowmakeimage;
 	ClassFlow* CreateClassFlow(std::string _type);
 	ClassFlow* CreateClassFlow(std::string _type);
 
 
@@ -63,6 +65,9 @@ public:
 	std::vector<HTMLInfo*> GetAllDigital();
 	std::vector<HTMLInfo*> GetAllDigital();
 	std::vector<HTMLInfo*> GetAllAnalog();	
 	std::vector<HTMLInfo*> GetAllAnalog();	
 
 
+	t_CNNType GetTypeDigital();
+	t_CNNType GetTypeAnalog();
+
 	int CleanTempFolder();
 	int CleanTempFolder();
 
 
 	string name(){return "ClassFlowControll";};
 	string name(){return "ClassFlowControll";};

+ 0 - 438
code/components/jomjol_flowcontroll/ClassFlowDigit.cpp

@@ -1,438 +0,0 @@
-#include "ClassFlowDigit.h"
-
-
-//#include "CFindTemplate.h"
-//#include "CTfLiteClass.h"
-
-// #define OHNETFLITE
-
-#ifndef OHNETFLITE
-#include "CTfLiteClass.h"
-#endif
-
-// #include "bitmap_image.hpp"
-
-#include "ClassLogFile.h"
-
-static const char* TAG = "flow_digital";
-
-
-void ClassFlowDigit::SetInitialParameter(void)
-{
-    string cnnmodelfile = "";
-    modelxsize = 1;
-    modelysize = 1;
-    ListFlowControll = NULL;
-    previousElement = NULL;    
-    SaveAllFiles = false;
-    disabled = false;
-    DecimalShift = 0;
-    DecimalShiftEnabled = false;
-    isLogImageSelect = false;
-}    
-
-ClassFlowDigit::ClassFlowDigit() : ClassFlowImage(TAG)
-{
-    SetInitialParameter();
-}
-
-ClassFlowDigit::ClassFlowDigit(std::vector<ClassFlow*>* lfc) : ClassFlowImage(lfc, TAG)
-{
-    SetInitialParameter();
-    ListFlowControll = lfc;
-
-    for (int i = 0; i < ListFlowControll->size(); ++i)
-    {
-        if (((*ListFlowControll)[i])->name().compare("ClassFlowAlignment") == 0)
-        {
-            flowpostalignment = (ClassFlowAlignment*) (*ListFlowControll)[i];
-        }
-    }
-}
-
-ClassFlowDigit::ClassFlowDigit(std::vector<ClassFlow*>* lfc, ClassFlow *_prev) : ClassFlowImage(lfc, _prev, TAG)
-{
-    SetInitialParameter();
-    ListFlowControll = lfc;
-    previousElement = _prev;
-
-    for (int i = 0; i < ListFlowControll->size(); ++i)
-    {
-        if (((*ListFlowControll)[i])->name().compare("ClassFlowAlignment") == 0)
-        {
-            flowpostalignment = (ClassFlowAlignment*) (*ListFlowControll)[i];
-        }
-    }    
-}
-
-string ClassFlowDigit::getReadout(int _digit = 0)
-{
-    string rst = "";
-
-    for (int i = 0; i < DIGIT[_digit]->ROI.size(); ++i)
-    {
-        if (DIGIT[_digit]->ROI[i]->resultklasse == 10)
-            rst = rst + "N";
-        else
-            rst = rst + std::to_string(DIGIT[_digit]->ROI[i]->resultklasse);
-    }
-
-    return rst;
-}
-
-bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
-{
-    std::vector<string> zerlegt;
-
-    aktparamgraph = trim(aktparamgraph);
-
-    if (aktparamgraph.size() == 0)
-        if (!this->GetNextParagraph(pfile, aktparamgraph)) 
-            return false;
-
-    printf("aktparamgraph: %s\n", aktparamgraph.c_str());
-
-    if ((aktparamgraph.compare(0, 7, "[Digits") != 0) && (aktparamgraph.compare(0, 8, ";[Digits") != 0))       // Paragraph passt nich zu MakeImage
-        return false;
-
-    int _pospkt = aktparamgraph.find_first_of(".");
-    int _posklammerzu = aktparamgraph.find_first_of("]");
-    if (_pospkt > -1)
-        NameDigit = aktparamgraph.substr(_pospkt+1, _posklammerzu - _pospkt-1);
-    else
-        NameDigit = "";
-    printf("Name Digit: %s\n", NameDigit.c_str());
-
-    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);
-        if ((zerlegt[0] == "LogImageLocation") && (zerlegt.size() > 1))
-        {
-            LogImageLocation = "/sdcard" + zerlegt[1];
-            isLogImage = true;            
-        }
-
-        if ((zerlegt[0] == "LogImageSelect") && (zerlegt.size() > 1))
-        {
-            LogImageSelect = zerlegt[1];
-            isLogImageSelect = true;            
-        }
-
-        if ((zerlegt[0] == "Model") && (zerlegt.size() > 1))
-        {
-            cnnmodelfile = zerlegt[1];
-        }
-        if ((zerlegt[0] == "ModelInputSize") && (zerlegt.size() > 2))
-        {
-            modelxsize = std::stoi(zerlegt[1]);
-            modelysize = std::stoi(zerlegt[2]);
-        }
-        if (zerlegt.size() >= 5)
-        {
-            digit* _digit = GetDIGIT(zerlegt[0], true);
-            roi* neuroi = _digit->ROI[_digit->ROI.size()-1];
-            neuroi->posx = std::stoi(zerlegt[1]);
-            neuroi->posy = std::stoi(zerlegt[2]);
-            neuroi->deltax = std::stoi(zerlegt[3]);
-            neuroi->deltay = std::stoi(zerlegt[4]);
-            neuroi->resultklasse = -1;
-            neuroi->image = NULL;
-            neuroi->image_org = NULL;            
-        }
-
-        if ((toUpper(zerlegt[0]) == "SAVEALLFILES") && (zerlegt.size() > 1))
-        {
-            if (toUpper(zerlegt[1]) == "TRUE")
-                SaveAllFiles = true;
-        }
-
-    }
-
-   for (int _dig = 0; _dig < DIGIT.size(); ++_dig)
-        for (int i = 0; i < DIGIT[_dig]->ROI.size(); ++i)
-        {
-            DIGIT[_dig]->ROI[i]->image = new CImageBasis(modelxsize, modelysize, 3);
-            DIGIT[_dig]->ROI[i]->image_org = new CImageBasis(DIGIT[_dig]->ROI[i]->deltax, DIGIT[_dig]->ROI[i]->deltay, 3);
-        }
-
-    return true;
-}
-
-digit* ClassFlowDigit::FindDIGIT(string _name_number)
-{
-    for (int i = 0; i < DIGIT.size(); ++i)
-    {
-        if (DIGIT[i]->name == _name_number)
-            return DIGIT[i];
-    }
-
-    return NULL;
-}
-
-
-digit* ClassFlowDigit::GetDIGIT(string _name, bool _create = true)
-{
-    string _digit, _roi;
-    int _pospunkt = _name.find_first_of(".");
-//    printf("Name: %s, Pospunkt: %d\n", _name.c_str(), _pospunkt);
-    if (_pospunkt > -1)
-    {
-        _digit = _name.substr(0, _pospunkt);
-        _roi = _name.substr(_pospunkt+1, _name.length() - _pospunkt - 1);
-    }
-    else
-    {
-        _digit = "default";
-        _roi = _name;
-    }
-
-    digit *_ret = NULL;
-
-    for (int i = 0; i < DIGIT.size(); ++i)
-    {
-        if (DIGIT[i]->name == _digit)
-            _ret = DIGIT[i];
-    }
-
-    if (!_create)         // nicht gefunden und soll auch nicht erzeugt werden, ggf. geht eine NULL zurück
-        return _ret;
-
-    if (_ret == NULL)
-    {
-        _ret = new digit;
-        _ret->name = _digit;
-        DIGIT.push_back(_ret);
-    }
-
-    roi* neuroi = new roi;
-    neuroi->name = _roi;
-    _ret->ROI.push_back(neuroi);
-
-    printf("GetDIGIT - digit %s - roi %s\n", _digit.c_str(), _roi.c_str());
-
-    return _ret;
-}
-
-
-
-string ClassFlowDigit::getHTMLSingleStep(string host)
-{
-    string result, zw;
-    std::vector<HTMLInfo*> htmlinfo;
-
-    result = "<p>Found ROIs: </p> <p><img src=\"" + host + "/img_tmp/alg_roi.jpg\"></p>\n";
-    result = result + "Digital Counter: <p> ";
-
-    htmlinfo = GetHTMLInfo();
-    for (int i = 0; i < htmlinfo.size(); ++i)
-    {
-        if (htmlinfo[i]->val == 10)
-            zw = "NaN";
-        else
-        {
-            zw = to_string((int) htmlinfo[i]->val);
-        }
-        result = result + "<img src=\"" + host + "/img_tmp/" +  htmlinfo[i]->filename + "\"> " + zw;
-        delete htmlinfo[i];
-    }
-    htmlinfo.clear();    
-
-    return result;
-}
-
-
-bool ClassFlowDigit::doFlow(string time)
-{
-    if (disabled)
-        return true;
-        
-    if (!doAlignAndCut(time)){
-        return false;
-    };
-
-    doNeuralNetwork(time);
-
-    RemoveOldLogs();
-
-    return true;
-}
-
-bool ClassFlowDigit::doAlignAndCut(string time)
-{
-    if (disabled)
-        return true;
-
-    CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();
-
-    for (int _dig = 0; _dig < DIGIT.size(); ++_dig)
-    {
-        printf("DIGIT[_dig]->ROI.size() %d\n", DIGIT[_dig]->ROI.size());
-        for (int i = 0; i < DIGIT[_dig]->ROI.size(); ++i)
-        {
-            printf("DigitalDigit %d - Align&Cut\n", i);
-            
-            caic->CutAndSave(DIGIT[_dig]->ROI[i]->posx, DIGIT[_dig]->ROI[i]->posy, DIGIT[_dig]->ROI[i]->deltax, DIGIT[_dig]->ROI[i]->deltay, DIGIT[_dig]->ROI[i]->image_org);
-            if (SaveAllFiles)
-            {
-                if (DIGIT[_dig]->name == "default")
-                    DIGIT[_dig]->ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + DIGIT[_dig]->ROI[i]->name + ".jpg"));
-                else
-                    DIGIT[_dig]->ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + DIGIT[_dig]->name + "_" + DIGIT[_dig]->ROI[i]->name + ".jpg"));
-            } 
-
-            DIGIT[_dig]->ROI[i]->image_org->Resize(modelxsize, modelysize, DIGIT[_dig]->ROI[i]->image);
-            if (SaveAllFiles)
-            {
-                if (DIGIT[_dig]->name == "default")
-                    DIGIT[_dig]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + DIGIT[_dig]->ROI[i]->name + ".bmp"));
-                else
-                    DIGIT[_dig]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + DIGIT[_dig]->name + "_" + DIGIT[_dig]->ROI[i]->name + ".bmp"));
-            } 
-        }
-    }
-    return true;
-} 
-
-bool ClassFlowDigit::doNeuralNetwork(string time)
-{
-    if (disabled)
-        return true;
-            
-    string logPath = CreateLogFolder(time);
-
-#ifndef OHNETFLITE
-    CTfLiteClass *tflite = new CTfLiteClass;  
-    string zwcnn =  FormatFileName("/sdcard" + cnnmodelfile);
-    printf(zwcnn.c_str());printf("\n");
-    if (!tflite->LoadModel(zwcnn)) {
-        printf("Can't read model file /sdcard%s\n", cnnmodelfile.c_str());
-        delete tflite;
-        return false;
-    } 
-
-    tflite->MakeAllocate();
-#endif
-
-    for (int _dig = 0; _dig < DIGIT.size(); ++_dig)
-        for (int i = 0; i < DIGIT[_dig]->ROI.size(); ++i)
-        {
-            printf("DigitalDigit %d - TfLite\n", i);
-
-            DIGIT[_dig]->ROI[i]->resultklasse = 0;
-    #ifndef OHNETFLITE
-            DIGIT[_dig]->ROI[i]->resultklasse = tflite->GetClassFromImageBasis(DIGIT[_dig]->ROI[i]->image);
-
-    #endif
-            printf("Result Digit%i: %d\n", i, DIGIT[_dig]->ROI[i]->resultklasse);
-
-            if (isLogImage)
-            {
-                if (isLogImageSelect)
-                {
-                    if (LogImageSelect.find(DIGIT[_dig]->ROI[i]->name) != std::string::npos)
-                    {
-                        LogImage(logPath, DIGIT[_dig]->ROI[i]->name, NULL, &DIGIT[_dig]->ROI[i]->resultklasse, time, DIGIT[_dig]->ROI[i]->image_org);
-                    }
-                }
-                else
-                {
-                    LogImage(logPath, DIGIT[_dig]->ROI[i]->name, NULL, &DIGIT[_dig]->ROI[i]->resultklasse, time, DIGIT[_dig]->ROI[i]->image_org);
-                }
-            }
-        }
-#ifndef OHNETFLITE
-        delete tflite;
-#endif
-    return true;
-}
-
-void ClassFlowDigit::DrawROI(CImageBasis *_zw)
-{
-    for (int _dig = 0; _dig < DIGIT.size(); ++_dig)
-        for (int i = 0; i < DIGIT[_dig]->ROI.size(); ++i)
-            _zw->drawRect(DIGIT[_dig]->ROI[i]->posx, DIGIT[_dig]->ROI[i]->posy, DIGIT[_dig]->ROI[i]->deltax, DIGIT[_dig]->ROI[i]->deltay, 0, 0, (255 - _dig*100), 2);
-}     
-
-std::vector<HTMLInfo*> ClassFlowDigit::GetHTMLInfo()
-{
-    std::vector<HTMLInfo*> result;
-
-    for (int _dig = 0; _dig < DIGIT.size(); ++_dig)
-        for (int i = 0; i < DIGIT[_dig]->ROI.size(); ++i)
-        {
-                if (DIGIT[_dig]->name == "default")
-                    DIGIT[_dig]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + DIGIT[_dig]->ROI[i]->name + ".bmp"));
-                else
-                    DIGIT[_dig]->ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + DIGIT[_dig]->name + "_" + DIGIT[_dig]->ROI[i]->name + ".bmp"));
-
-
-            HTMLInfo *zw = new HTMLInfo;
-            if (DIGIT[_dig]->name == "default")
-            {
-                zw->filename = DIGIT[_dig]->ROI[i]->name + ".bmp";
-                zw->filename_org = DIGIT[_dig]->ROI[i]->name + ".jpg";
-            }
-            else
-            {
-                zw->filename = DIGIT[_dig]->name + "_" + DIGIT[_dig]->ROI[i]->name + ".bmp";
-                zw->filename_org = DIGIT[_dig]->name + "_" + DIGIT[_dig]->ROI[i]->name + ".jpg";
-            }
-
-            zw->val = DIGIT[_dig]->ROI[i]->resultklasse;
-            zw->image = DIGIT[_dig]->ROI[i]->image;
-            zw->image_org = DIGIT[_dig]->ROI[i]->image_org;
-            result.push_back(zw);
-        }
-
-    return result;
-}
-
-int ClassFlowDigit::getAnzahlDIGIT()
-{
-    return DIGIT.size();
-}
-
-string ClassFlowDigit::getNameDIGIT(int _digit)
-{
-    if (_digit < DIGIT.size())
-        return DIGIT[_digit]->name;
-
-    return "DIGIT DOES NOT EXIST";
-}
-
-digit* ClassFlowDigit::GetDIGIT(int _digit)
-{
-    if (_digit < DIGIT.size())
-        return DIGIT[_digit];
-
-    return NULL;
-}
-
-void ClassFlowDigit::UpdateNameNumbers(std::vector<std::string> *_name_numbers)
-{
-    for (int _dig = 0; _dig < DIGIT.size(); _dig++)
-    {
-        std::string _name = DIGIT[_dig]->name;
-        bool found = false;
-        for (int i = 0; i < (*_name_numbers).size(); ++i)
-        {
-            if ((*_name_numbers)[i] == _name)
-                found = true;
-        }
-        if (!found)
-            (*_name_numbers).push_back(_name);
-    }
-}
-
-
-
-

+ 0 - 71
code/components/jomjol_flowcontroll/ClassFlowDigit.h

@@ -1,71 +0,0 @@
-#pragma once
-#include "ClassFlowImage.h"
-#include "ClassFlowAlignment.h"
-#include "Helper.h"
-
-#include <string>
-
-
-
-struct roi {
-    int posx, posy, deltax, deltay;
-    int resultklasse;
-    string name;
-    CImageBasis *image, *image_org;
-    roi* next;
-};
-
-struct digit {
-    string name;
-    std::vector<roi*> ROI;
-};
-
-class ClassFlowDigit :
-    public ClassFlowImage
-{
-protected:
-//    std::vector<roi*> ROI;
-    std::vector<digit*> DIGIT;
-    string cnnmodelfile;
-    int modelxsize, modelysize;
-    bool SaveAllFiles;
-    string NameDigit;
-    int DecimalShift;
-    bool DecimalShiftEnabled;
-
-    bool isLogImageSelect;
-    string LogImageSelect;
-
-
-    ClassFlowAlignment* flowpostalignment;
- 
-    bool doNeuralNetwork(string time); 
-    bool doAlignAndCut(string time); 
-
-
-	void SetInitialParameter(void);    
-
-public:
-    ClassFlowDigit();
-    ClassFlowDigit(std::vector<ClassFlow*>* lfc);
-    ClassFlowDigit(std::vector<ClassFlow*>* lfc, ClassFlow *_prev);
-    bool ReadParameter(FILE* pfile, string& aktparamgraph);
-    bool doFlow(string time);
-    string getHTMLSingleStep(string host); 
-    string getReadout(int _digit);
-   	std::vector<HTMLInfo*> GetHTMLInfo();
-
-    int getAnzahlDIGIT();
-    digit* GetDIGIT(int _digit);
-    digit* GetDIGIT(string _name, bool _create);
-    digit* FindDIGIT(string _name_number);
-
-    string getNameDIGIT(int _digit);
-
-    void UpdateNameNumbers(std::vector<std::string> *_name_numbers);
-
-    void DrawROI(CImageBasis *_zw);        
-
-    string name(){return "ClassFlowDigit";};
-};
-

+ 29 - 24
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -28,12 +28,8 @@ string ClassFlowPostProcessing::GetPreValue(std::string _number)
         if (NUMBERS[i]->name == _number)
         if (NUMBERS[i]->name == _number)
             index = i;
             index = i;
 
 
-//    result = RundeOutput(NUMBERS[index]->PreValue, -NUMBERS[index]->DecimalShift);
     result = RundeOutput(NUMBERS[index]->PreValue, NUMBERS[index]->Nachkomma);
     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);
-
     return result;
     return result;
 }
 }
 
 
@@ -231,7 +227,7 @@ void ClassFlowPostProcessing::SavePreValue()
 }
 }
 
 
 
 
-ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
+ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc, ClassFlowCNNGeneral *_analog, ClassFlowCNNGeneral *_digit)
 {
 {
     PreValueUse = false;
     PreValueUse = false;
     PreValueAgeStartup = 30;
     PreValueAgeStartup = 30;
@@ -242,6 +238,9 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
     flowMakeImage = NULL;
     flowMakeImage = NULL;
     UpdatePreValueINI = false;
     UpdatePreValueINI = false;
     IgnoreLeadingNaN = false;
     IgnoreLeadingNaN = false;
+    flowAnalog = _analog;
+    flowDigit = _digit;
+
 
 
     for (int i = 0; i < ListFlowControll->size(); ++i)
     for (int i = 0; i < ListFlowControll->size(); ++i)
     {
     {
@@ -276,10 +275,16 @@ void ClassFlowPostProcessing::handleDecimalSeparator(string _decsep, string _val
         }
         }
         
         
         if (_digit == "default")                        // erstmal auf default setzen (falls sonst nichts gesetzt)
         if (_digit == "default")                        // erstmal auf default setzen (falls sonst nichts gesetzt)
+        {
             NUMBERS[j]->DecimalShift = _zwdc;
             NUMBERS[j]->DecimalShift = _zwdc;
+            NUMBERS[j]->DecimalShiftInitial = _zwdc;
+        }
 
 
         if (NUMBERS[j]->name == _digit)
         if (NUMBERS[j]->name == _digit)
+        {
             NUMBERS[j]->DecimalShift = _zwdc;
             NUMBERS[j]->DecimalShift = _zwdc;
+            NUMBERS[j]->DecimalShiftInitial = _zwdc;
+        }
 
 
         NUMBERS[j]->Nachkomma = NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift;
         NUMBERS[j]->Nachkomma = NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift;
     }
     }
@@ -406,27 +411,16 @@ void ClassFlowPostProcessing::InitNUMBERS()
     int anzANALOG = 0;
     int anzANALOG = 0;
     std::vector<std::string> name_numbers;
     std::vector<std::string> name_numbers;
 
 
-    flowAnalog = NULL;
-    flowDigit = NULL;
-
-    for (int i = 0; i < ListFlowControll->size(); ++i)
-    {
-        if (((*ListFlowControll)[i])->name().compare("ClassFlowDigit") == 0)
-        {
-            flowDigit = (ClassFlowDigit*) (*ListFlowControll)[i];
-            anzDIGIT = flowDigit->getAnzahlDIGIT();
-        }
-        if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
-        {
-            flowAnalog = (ClassFlowAnalog*)(*ListFlowControll)[i];
-            anzANALOG = flowAnalog->getAnzahlANALOG();
-        }
-    }
-
     if (flowDigit)
     if (flowDigit)
+    {
+        anzDIGIT = flowDigit->getAnzahlGENERAL();
         flowDigit->UpdateNameNumbers(&name_numbers);
         flowDigit->UpdateNameNumbers(&name_numbers);
+    }
     if (flowAnalog)
     if (flowAnalog)
+    {
+        anzANALOG = flowAnalog->getAnzahlGENERAL();
         flowAnalog->UpdateNameNumbers(&name_numbers);
         flowAnalog->UpdateNameNumbers(&name_numbers);
+    }
 
 
     printf("Anzahl NUMBERS: %d - DIGITS: %d, ANALOG: %d\n", name_numbers.size(), anzDIGIT, anzANALOG);
     printf("Anzahl NUMBERS: %d - DIGITS: %d, ANALOG: %d\n", name_numbers.size(), anzDIGIT, anzANALOG);
 
 
@@ -438,7 +432,7 @@ void ClassFlowPostProcessing::InitNUMBERS()
         
         
         _number->digit_roi = NULL;
         _number->digit_roi = NULL;
         if (flowDigit)
         if (flowDigit)
-            _number->digit_roi = flowDigit->FindDIGIT(name_numbers[_num]);
+            _number->digit_roi = flowDigit->FindGENERAL(name_numbers[_num]);
         
         
         if (_number->digit_roi)
         if (_number->digit_roi)
             _number->AnzahlDigital = _number->digit_roi->ROI.size();
             _number->AnzahlDigital = _number->digit_roi->ROI.size();
@@ -447,7 +441,7 @@ void ClassFlowPostProcessing::InitNUMBERS()
 
 
         _number->analog_roi = NULL;
         _number->analog_roi = NULL;
         if (flowAnalog)
         if (flowAnalog)
-            _number->analog_roi = flowAnalog->FindANALOG(name_numbers[_num]);
+            _number->analog_roi = flowAnalog->FindGENERAL(name_numbers[_num]);
 
 
 
 
         if (_number->analog_roi)
         if (_number->analog_roi)
@@ -468,6 +462,8 @@ void ClassFlowPostProcessing::InitNUMBERS()
         _number->PreValueOkay = false;
         _number->PreValueOkay = false;
         _number->useMaxRateValue = false;
         _number->useMaxRateValue = false;
         _number->DecimalShift = 0;
         _number->DecimalShift = 0;
+        _number->DecimalShiftInitial = 0;
+
 
 
         _number->FlowRateAct = 0;          // m3 / min
         _number->FlowRateAct = 0;          // m3 / min
         _number->PreValue = 0;             // letzter Wert, der gut ausgelesen wurde
         _number->PreValue = 0;             // letzter Wert, der gut ausgelesen wurde
@@ -540,6 +536,10 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
 
 
 //    ErrorMessageText = "";
 //    ErrorMessageText = "";
 
 
+    // Update Nachkomma, da sich beim Wechsel von CNNType Auto --> xyz auch die Nachkommastellen ändern können:
+
+
+
     imagetime = flowMakeImage->getTimeImageTaken();
     imagetime = flowMakeImage->getTimeImageTaken();
     if (imagetime == 0)
     if (imagetime == 0)
         time(&imagetime);
         time(&imagetime);
@@ -557,6 +557,11 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
         NUMBERS[j]->ReturnRawValue = "";
         NUMBERS[j]->ReturnRawValue = "";
         NUMBERS[j]->ErrorMessageText = "";
         NUMBERS[j]->ErrorMessageText = "";
 
 
+        if (flowAnalog) NUMBERS[j]->AnzahlAnalog = flowAnalog->AnzahlROIs(j);
+        if (flowDigit) NUMBERS[j]->AnzahlDigital = flowDigit->AnzahlROIs(j);
+        NUMBERS[j]->Nachkomma = NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift;
+
+
         if (NUMBERS[j]->digit_roi)
         if (NUMBERS[j]->digit_roi)
             NUMBERS[j]->ReturnRawValue = flowDigit->getReadout(j);
             NUMBERS[j]->ReturnRawValue = flowDigit->getReadout(j);
         if (NUMBERS[j]->digit_roi && NUMBERS[j]->analog_roi)
         if (NUMBERS[j]->digit_roi && NUMBERS[j]->analog_roi)

+ 8 - 7
code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h

@@ -1,8 +1,8 @@
 #pragma once
 #pragma once
 #include "ClassFlow.h"
 #include "ClassFlow.h"
 #include "ClassFlowMakeImage.h"
 #include "ClassFlowMakeImage.h"
-#include "ClassFlowAnalog.h"
-#include "ClassFlowDigit.h"
+#include "ClassFlowCNNGeneral.h"
+#include "ClassFlowCNNGeneral.h"
 
 
 
 
 #include <string>
 #include <string>
@@ -28,10 +28,11 @@ struct NumberPost {
     int AnzahlAnalog;
     int AnzahlAnalog;
     int AnzahlDigital;
     int AnzahlDigital;
     int DecimalShift;
     int DecimalShift;
+    int DecimalShiftInitial;
     int Nachkomma;
     int Nachkomma;
 
 
-    digit *digit_roi;
-    analog *analog_roi;
+    general *digit_roi;
+    general *analog_roi;
 
 
     string name;
     string name;
 };
 };
@@ -51,8 +52,8 @@ protected:
     bool IgnoreLeadingNaN;          // SPEZIALFALL für User Gustl
     bool IgnoreLeadingNaN;          // SPEZIALFALL für User Gustl
 
 
 
 
-    ClassFlowAnalog* flowAnalog;
-    ClassFlowDigit* flowDigit;    
+    ClassFlowCNNGeneral* flowAnalog;
+    ClassFlowCNNGeneral* flowDigit;    
 
 
 
 
     string FilePreValue;
     string FilePreValue;
@@ -74,7 +75,7 @@ protected:
 public:
 public:
     bool PreValueUse;
     bool PreValueUse;
 
 
-    ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc);
+    ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc, ClassFlowCNNGeneral *_analog, ClassFlowCNNGeneral *_digit);
     bool ReadParameter(FILE* pfile, string& aktparamgraph);
     bool ReadParameter(FILE* pfile, string& aktparamgraph);
     bool doFlow(string time);
     bool doFlow(string time);
     string getReadout(int _number);
     string getReadout(int _number);

+ 49 - 5
code/components/jomjol_tfliteclass/CTfLiteClass.cpp

@@ -28,6 +28,48 @@ int CTfLiteClass::GetClassFromImageBasis(CImageBasis *rs)
     return GetOutClassification();
     return GetOutClassification();
 }
 }
 
 
+
+int CTfLiteClass::GetOutClassification(int _von, int _bis)
+{
+  TfLiteTensor* output2 = interpreter->output(0);
+
+  float zw_max;
+  float zw;
+  int zw_class;
+
+  if (output2 == NULL)
+    return -1;
+
+  int numeroutput = output2->dims->data[1];
+  //printf("\n number output neurons: %d\n\n", numeroutput);
+
+  if (_bis == -1)
+    _bis = numeroutput;
+
+  if (_von == -1)
+    _von = 0;
+
+  if (_bis > numeroutput)
+  {
+    printf("ANZAHL OUTPUT NEURONS passt nicht zu geforderter Classifizierung!");
+    return -1;
+  }
+
+  zw_max = output2->data.f[_von];
+  zw_class = _von;
+  for (int i = _von+1; i <= _bis; ++i)
+  {
+    zw = output2->data.f[i];
+    if (zw > zw_max)
+    {
+        zw_max = zw;
+        zw_class = i;
+    }
+  }
+  return (zw_class - _von);
+}
+
+/*
 int CTfLiteClass::GetOutClassification()
 int CTfLiteClass::GetOutClassification()
 {
 {
   TfLiteTensor* output2 = interpreter->output(0);
   TfLiteTensor* output2 = interpreter->output(0);
@@ -51,6 +93,7 @@ int CTfLiteClass::GetOutClassification()
   }
   }
   return zw_class;
   return zw_class;
 }
 }
+*/
 
 
 void CTfLiteClass::GetInputDimension(bool silent = false)
 void CTfLiteClass::GetInputDimension(bool silent = false)
 {
 {
@@ -71,18 +114,18 @@ void CTfLiteClass::GetInputDimension(bool silent = false)
 }
 }
 
 
 
 
-void CTfLiteClass::GetOutPut()
+int CTfLiteClass::GetAnzOutPut(bool silent)
 {
 {
   TfLiteTensor* output2 = this->interpreter->output(0);
   TfLiteTensor* output2 = this->interpreter->output(0);
 
 
   int numdim = output2->dims->size;
   int numdim = output2->dims->size;
-  printf("NumDimension: %d\n", numdim);  
+  if (!silent) printf("NumDimension: %d\n", numdim);  
 
 
   int sizeofdim;
   int sizeofdim;
   for (int j = 0; j < numdim; ++j)
   for (int j = 0; j < numdim; ++j)
   {
   {
     sizeofdim = output2->dims->data[j];
     sizeofdim = output2->dims->data[j];
-    printf("SizeOfDimension %d: %d\n", j, sizeofdim);  
+    if (!silent) printf("SizeOfDimension %d: %d\n", j, sizeofdim);  
   }
   }
 
 
 
 
@@ -93,8 +136,9 @@ void CTfLiteClass::GetOutPut()
   for (int i = 0; i < numeroutput; ++i)
   for (int i = 0; i < numeroutput; ++i)
   {
   {
    fo = output2->data.f[i];
    fo = output2->data.f[i];
-    printf("Result %d: %f\n", i, fo);  
+    if (!silent) printf("Result %d: %f\n", i, fo);  
   }
   }
+  return numeroutput;
 }
 }
 
 
 void CTfLiteClass::Invoke()
 void CTfLiteClass::Invoke()
@@ -107,7 +151,7 @@ void CTfLiteClass::Invoke()
 
 
 bool CTfLiteClass::LoadInputImageBasis(CImageBasis *rs)
 bool CTfLiteClass::LoadInputImageBasis(CImageBasis *rs)
 {
 {
-    std::string zw = "ClassFlowAnalog::doNeuralNetwork nach LoadInputResizeImage: ";
+    std::string zw = "ClassFlowCNNGeneral::doNeuralNetwork nach LoadInputResizeImage: ";
 
 
     unsigned int w = rs->width;
     unsigned int w = rs->width;
     unsigned int h = rs->height;
     unsigned int h = rs->height;

+ 5 - 2
code/components/jomjol_tfliteclass/CTfLiteClass.h

@@ -61,8 +61,11 @@ class CTfLiteClass
         void GetInputTensorSize();
         void GetInputTensorSize();
         bool LoadInputImageBasis(CImageBasis *rs);
         bool LoadInputImageBasis(CImageBasis *rs);
         void Invoke();
         void Invoke();
-        void GetOutPut();
-        int GetOutClassification();
+        int GetAnzOutPut(bool silent = true);        
+//        void GetOutPut();
+//        int GetOutClassification();
+        int GetOutClassification(int _von = -1, int _bis = -1);
+
         int GetClassFromImageBasis(CImageBasis *rs);
         int GetClassFromImageBasis(CImageBasis *rs);
         std::string GetStatusFlow();
         std::string GetStatusFlow();
 
 

+ 23 - 7
code/components/jomjol_tfliteclass/server_tflite.cpp

@@ -284,16 +284,27 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
         httpd_resp_sendstr_chunk(req, txt.c_str()); 
         httpd_resp_sendstr_chunk(req, txt.c_str()); 
         
         
         std::vector<HTMLInfo*> htmlinfo;
         std::vector<HTMLInfo*> htmlinfo;
-        htmlinfo = tfliteflow.GetAllDigital();
+        htmlinfo = tfliteflow.GetAllDigital();  
+        printf("Size of htmlinfo: %i\n", htmlinfo.size());
         for (int i = 0; i < htmlinfo.size(); ++i)
         for (int i = 0; i < htmlinfo.size(); ++i)
         {
         {
-            if (htmlinfo[i]->val == 10)
-                zw = "NaN";
+            if (tfliteflow.GetTypeDigital() == Digital)
+            {
+                if (htmlinfo[i]->val == 10)
+                    zw = "NaN";
+                else
+                    zw = to_string((int) htmlinfo[i]->val);
+
+                txt = "<img src=\"/img_tmp/" +  htmlinfo[i]->filename + "\"> " + zw;
+            }
             else
             else
             {
             {
-                zw = to_string((int) htmlinfo[i]->val);
+                std::stringstream stream;
+                stream << std::fixed << std::setprecision(1) << htmlinfo[i]->val;
+                zw = stream.str();
+
+                txt = "<img src=\"/img_tmp/" +  htmlinfo[i]->filename + "\"> " + zw;
             }
             }
-            txt = "<img src=\"/img_tmp/" +  htmlinfo[i]->filename + "\"> " + zw;
             httpd_resp_sendstr_chunk(req, txt.c_str()); 
             httpd_resp_sendstr_chunk(req, txt.c_str()); 
             delete htmlinfo[i];
             delete htmlinfo[i];
         }
         }
@@ -493,7 +504,9 @@ esp_err_t handler_editflow(httpd_req_t *req)
 //        string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
 //        string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
         std::string zw = tfliteflow.doSingleStep("[Alignment]", _host);
         std::string zw = tfliteflow.doSingleStep("[Alignment]", _host);
         httpd_resp_sendstr_chunk(req, zw.c_str()); 
         httpd_resp_sendstr_chunk(req, zw.c_str()); 
-    }  
+    }
+
+/*      
     if (_task.compare("test_analog") == 0)
     if (_task.compare("test_analog") == 0)
     {
     {
         std::string _host = "";
         std::string _host = "";
@@ -504,7 +517,9 @@ esp_err_t handler_editflow(httpd_req_t *req)
 //        string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
 //        string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
         std::string zw = tfliteflow.doSingleStep("[Analog]", _host);
         std::string zw = tfliteflow.doSingleStep("[Analog]", _host);
         httpd_resp_sendstr_chunk(req, zw.c_str()); 
         httpd_resp_sendstr_chunk(req, zw.c_str()); 
-    }  
+    }
+*/  
+/*    
     if (_task.compare("test_digits") == 0)
     if (_task.compare("test_digits") == 0)
     {
     {
         std::string _host = "";
         std::string _host = "";
@@ -517,6 +532,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
         std::string zw = tfliteflow.doSingleStep("[Digits]", _host);
         std::string zw = tfliteflow.doSingleStep("[Digits]", _host);
         httpd_resp_sendstr_chunk(req, zw.c_str()); 
         httpd_resp_sendstr_chunk(req, zw.c_str()); 
     } 
     } 
+*/
 
 
 
 
     /* Respond with an empty chunk to signal HTTP response completion */
     /* Respond with an empty chunk to signal HTTP response completion */

+ 2 - 2
code/main/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="b7b7029";
+const char* GIT_REV="af99de3";
 const char* GIT_TAG="";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-08-31 11:37";
+const char* BUILD_TIME="2021-09-10 07:03";

+ 2 - 2
code/version.cpp

@@ -1,4 +1,4 @@
-const char* GIT_REV="b7b7029";
+const char* GIT_REV="af99de3";
 const char* GIT_TAG="";
 const char* GIT_TAG="";
 const char* GIT_BRANCH="rolling";
 const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-08-31 11:37";
+const char* BUILD_TIME="2021-09-10 07:03";

BIN
firmware/bootloader.bin


BIN
firmware/dig1210s2q.tflite


BIN
firmware/firmware.bin


BIN
firmware/html.zip


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

@@ -20,7 +20,7 @@ FlipImageSize = false
 /config/ref1.jpg 442 142
 /config/ref1.jpg 442 142
 
 
 [Digits]
 [Digits]
-Model = /config/dig1200s1q.tflite
+Model = /config/dig1210s2q.tflite
 ;LogImageLocation = /log/digit
 ;LogImageLocation = /log/digit
 ;LogfileRetentionInDays = 3
 ;LogfileRetentionInDays = 3
 ModelInputSize = 20 32
 ModelInputSize = 20 32

BIN
sd-card/config/dig1210s2q.tflite


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

@@ -116,6 +116,7 @@ function SaveToConfig(){
     WriteConfigININew();
     WriteConfigININew();
     UpdateConfigReference(basepath)
     UpdateConfigReference(basepath)
     SaveConfigToServer(basepath);
     SaveConfigToServer(basepath);
+	alert("Config.ini is updated!");
 }
 }
 
 
 function EnhanceContrast(){
 function EnhanceContrast(){

+ 2 - 1
sd-card/html/edit_analog.html

@@ -243,7 +243,8 @@ function SaveToConfig(){
     _zwcat = getConfigCategory();
     _zwcat = getConfigCategory();
     _zwcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
     _zwcat["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
     WriteConfigININew();
     WriteConfigININew();
-    SaveConfigToServer(basepath);    
+    SaveConfigToServer(basepath);  
+	alert("Config.ini is updated!");
 }
 }
 
 
 
 

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

@@ -60,6 +60,7 @@ function saveTextAsFile()
 		FileDeleteOnServer("/config/config.ini", basepath);
 		FileDeleteOnServer("/config/config.ini", basepath);
 		var textToSave = document.getElementById("inputTextToSave").value;
 		var textToSave = document.getElementById("inputTextToSave").value;
 		FileSendContent(textToSave, "/config/config.ini", basepath);
 		FileSendContent(textToSave, "/config/config.ini", basepath);
+		alert("Config.ini is updated!")
 	}
 	}
 }
 }
 
 

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

@@ -1804,7 +1804,8 @@ function saveTextAsFile()
 	if (confirm("Are you sure you want to update \"config.ini\"?")) {
 	if (confirm("Are you sure you want to update \"config.ini\"?")) {
 		ReadParameterAll();
 		ReadParameterAll();
 		WriteConfigININew();
 		WriteConfigININew();
-	    SaveConfigToServer(basepath);    
+	    SaveConfigToServer(basepath);
+		alert("Config.ini is updated!")
 	}
 	}
 }
 }
 
 

+ 2 - 1
sd-card/html/edit_digits.html

@@ -236,7 +236,8 @@ function SaveToConfig(){
     _zwcat = getConfigCategory();
     _zwcat = getConfigCategory();
     _zwcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
     _zwcat["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
     WriteConfigININew();
     WriteConfigININew();
-    SaveConfigToServer(basepath);    
+    SaveConfigToServer(basepath); 
+	alert("Config.ini is updated!");
 }
 }
 
 
 
 

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

@@ -1 +1 @@
-9.7.0
+9.7.1