diff --git a/README.md b/README.md
index 3e80834c..5765c7da 100644
--- a/README.md
+++ b/README.md
@@ -45,26 +45,22 @@ In other cases you can contact the developer via email:
+#include
+#include
+#include // 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* 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 zw = ROI.size();
+ if (extendedResolution)
+ zw++;
+
+ return zw;
+}
+
+
+string ClassFlowAnalog::getReadout()
+{
+ string result = "";
+ if (ROI.size() == 0)
+ return result;
+
+
+ float zahl = ROI[ROI.size() - 1]->result;
+ int ergebnis_nachkomma = ((int) floor(zahl * 10)) % 10;
+
+ int prev = -1;
+
+ prev = ZeigerEval(ROI[ROI.size() - 1]->result, prev);
+ result = std::to_string(prev);
+
+ if (extendedResolution)
+ result = result + std::to_string(ergebnis_nachkomma);
+
+ for (int i = ROI.size() - 2; i >= 0; --i)
+ {
+ prev = ZeigerEval(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 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)
+ {
+ roianalog* neuroi = new roianalog;
+ neuroi->name = zerlegt[0];
+ 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 i = 0; i < ROI.size(); ++i)
+ {
+ ROI[i]->image = new CImageBasis(modelxsize, modelysize, 3);
+ ROI[i]->image_org = new CImageBasis(ROI[i]->deltax, ROI[i]->deltay, 3);
+ }
+
+ return true;
+}
+
+
+string ClassFlowAnalog::getHTMLSingleStep(string host)
+{
+ string result, zw;
+ std::vector htmlinfo;
+
+ result = "Found ROIs:

\n";
+ result = result + "Analog Pointers: ";
+
+ 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 + "
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 i = 0; i < ROI.size(); ++i)
+ {
+ printf("Analog %d - Align&Cut\n", i);
+
+ caic->CutAndSave(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay, ROI[i]->image_org);
+ if (SaveAllFiles) ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".jpg"));
+
+ ROI[i]->image_org->Resize(modelxsize, modelysize, ROI[i]->image);
+ if (SaveAllFiles) ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".bmp"));
+ }
+
+ return true;
+}
+
+void ClassFlowAnalog::DrawROI(CImageBasis *_zw)
+{
+ int r = 0;
+ int g = 255;
+ int b = 0;
+
+ for (int i = 0; i < ROI.size(); ++i)
+ {
+ _zw->drawRect(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay, r, g, b, 1);
+ _zw->drawCircle((int) (ROI[i]->posx + ROI[i]->deltax/2), (int) (ROI[i]->posy + ROI[i]->deltay/2), (int) (ROI[i]->deltax/2), r, g, b, 2);
+ _zw->drawLine((int) (ROI[i]->posx + ROI[i]->deltax/2), (int) ROI[i]->posy, (int) (ROI[i]->posx + ROI[i]->deltax/2), (int) (ROI[i]->posy + ROI[i]->deltay), r, g, b, 2);
+ _zw->drawLine((int) ROI[i]->posx, (int) (ROI[i]->posy + ROI[i]->deltay/2), (int) ROI[i]->posx + ROI[i]->deltax, (int) (ROI[i]->posy + 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");
+ tflite->LoadModel(zwcnn);
+ tflite->MakeAllocate();
+#endif
+
+ for (int i = 0; i < ROI.size(); ++i)
+ {
+ printf("Analog %d - TfLite\n", i);
+ ioresize = "/sdcard/img_tmp/ra" + std::to_string(i) + ".bmp";
+ ioresize = FormatFileName(ioresize);
+
+
+ float f1, f2;
+ f1 = 0; f2 = 0;
+
+#ifndef OHNETFLITE
+// LogFile.WriteToFile("ClassFlowAnalog::doNeuralNetwork vor CNN tflite->LoadInputImage(ioresize)");
+// tflite->LoadInputImage(ioresize);
+ tflite->LoadInputImageBasis(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);
+ ROI[i]->result = result * 10;
+
+ printf("Result Analog%i: %f\n", i, ROI[i]->result);
+
+ if (isLogImage)
+ {
+ LogImage(logPath, ROI[i]->name, &ROI[i]->result, NULL, time, ROI[i]->image_org);
+ }
+ }
+#ifndef OHNETFLITE
+ delete tflite;
+#endif
+
+ return true;
+}
+
+
+std::vector ClassFlowAnalog::GetHTMLInfo()
+{
+ std::vector result;
+
+ for (int i = 0; i < ROI.size(); ++i)
+ {
+ HTMLInfo *zw = new HTMLInfo;
+ zw->filename = ROI[i]->name + ".bmp";
+ zw->filename_org = ROI[i]->name + ".jpg";
+ zw->val = ROI[i]->result;
+ zw->image = ROI[i]->image;
+ zw->image_org = ROI[i]->image_org;
+ result.push_back(zw);
+ }
+
+ return result;
+}
+
+
diff --git a/code/components/jomjol_flowcontroll/ClassFlowAnalog._h_ b/code/components/jomjol_flowcontroll/ClassFlowAnalog._h_
new file mode 100644
index 00000000..08a29be7
--- /dev/null
+++ b/code/components/jomjol_flowcontroll/ClassFlowAnalog._h_
@@ -0,0 +1,48 @@
+#pragma once
+#include "ClassFlowImage.h"
+#include "ClassFlowAlignment.h"
+// #include "CTfLiteClass.h"
+
+struct roianalog {
+ int posx, posy, deltax, deltay;
+ float result;
+ CImageBasis *image, *image_org;
+ string name;
+};
+
+
+class ClassFlowAnalog :
+ public ClassFlowImage
+{
+protected:
+ std::vector ROI;
+ string cnnmodelfile;
+ int modelxsize, modelysize;
+ int ZeigerEval(float zahl, int ziffer_vorgaenger);
+ bool SaveAllFiles;
+
+
+ ClassFlowAlignment* flowpostalignment;
+
+ void SetInitialParameter(void);
+
+public:
+ bool extendedResolution;
+
+ ClassFlowAnalog(std::vector* lfc);
+
+ bool ReadParameter(FILE* pfile, string& aktparamgraph);
+ bool doFlow(string time);
+ string getHTMLSingleStep(string host);
+ string getReadout();
+
+ void DrawROI(CImageBasis *_zw);
+
+ bool doNeuralNetwork(string time);
+ bool doAlignAndCut(string time);
+ std::vector GetHTMLInfo();
+ int AnzahlROIs();
+
+ string name(){return "ClassFlowAnalog";};
+};
+
diff --git a/code/components/jomjol_flowcontroll/ClassFlowAnalog.cpp b/code/components/jomjol_flowcontroll/ClassFlowAnalog.cpp
index a23d8b42..c38d15b5 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowAnalog.cpp
+++ b/code/components/jomjol_flowcontroll/ClassFlowAnalog.cpp
@@ -1,7 +1,7 @@
#include "ClassFlowAnalog.h"
#include
-#include
+#include
#include
#include // std::stringstream
@@ -46,9 +46,9 @@ ClassFlowAnalog::ClassFlowAnalog(std::vector* lfc) : ClassFlowImage(
}
-int ClassFlowAnalog::AnzahlROIs()
+int ClassFlowAnalog::AnzahlROIs(int _analog = 0)
{
- int zw = ROI.size();
+ int zw = ANALOG[_analog]->ROI.size();
if (extendedResolution)
zw++;
@@ -56,27 +56,27 @@ int ClassFlowAnalog::AnzahlROIs()
}
-string ClassFlowAnalog::getReadout()
+string ClassFlowAnalog::getReadout(int _analog = 0)
{
string result = "";
- if (ROI.size() == 0)
+ if (ANALOG[_analog]->ROI.size() == 0)
return result;
- float zahl = ROI[ROI.size() - 1]->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(ROI[ROI.size() - 1]->result, prev);
+ 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 = ROI.size() - 2; i >= 0; --i)
+ for (int i = ANALOG[_analog]->ROI.size() - 2; i >= 0; --i)
{
- prev = ZeigerEval(ROI[i]->result, prev);
+ prev = ZeigerEval(ANALOG[_analog]->ROI[i]->result, prev);
result = std::to_string(prev) + result;
}
@@ -153,8 +153,8 @@ bool ClassFlowAnalog::ReadParameter(FILE* pfile, string& aktparamgraph)
}
if (zerlegt.size() >= 5)
{
- roianalog* neuroi = new roianalog;
- neuroi->name = zerlegt[0];
+ 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]);
@@ -162,7 +162,7 @@ bool ClassFlowAnalog::ReadParameter(FILE* pfile, string& aktparamgraph)
neuroi->result = -1;
neuroi->image = NULL;
neuroi->image_org = NULL;
- ROI.push_back(neuroi);
+// ROI.push_back(neuroi);
}
if ((toUpper(zerlegt[0]) == "SAVEALLFILES") && (zerlegt.size() > 1))
@@ -178,15 +178,76 @@ bool ClassFlowAnalog::ReadParameter(FILE* pfile, string& aktparamgraph)
}
}
- for (int i = 0; i < ROI.size(); ++i)
- {
- ROI[i]->image = new CImageBasis(modelxsize, modelysize, 3);
- ROI[i]->image_org = new CImageBasis(ROI[i]->deltax, ROI[i]->deltay, 3);
- }
+ 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)
+{
+ analog *_ret = NULL;
+
+ 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)
{
@@ -238,16 +299,29 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();
- for (int i = 0; i < ROI.size(); ++i)
- {
- printf("Analog %d - Align&Cut\n", i);
-
- caic->CutAndSave(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay, ROI[i]->image_org);
- if (SaveAllFiles) ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".jpg"));
+ 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"));
+ }
- ROI[i]->image_org->Resize(modelxsize, modelysize, ROI[i]->image);
- if (SaveAllFiles) ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".bmp"));
- }
+ 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;
}
@@ -258,13 +332,14 @@ void ClassFlowAnalog::DrawROI(CImageBasis *_zw)
int g = 255;
int b = 0;
- for (int i = 0; i < ROI.size(); ++i)
- {
- _zw->drawRect(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay, r, g, b, 1);
- _zw->drawCircle((int) (ROI[i]->posx + ROI[i]->deltax/2), (int) (ROI[i]->posy + ROI[i]->deltay/2), (int) (ROI[i]->deltax/2), r, g, b, 2);
- _zw->drawLine((int) (ROI[i]->posx + ROI[i]->deltax/2), (int) ROI[i]->posy, (int) (ROI[i]->posx + ROI[i]->deltax/2), (int) (ROI[i]->posy + ROI[i]->deltay), r, g, b, 2);
- _zw->drawLine((int) ROI[i]->posx, (int) (ROI[i]->posy + ROI[i]->deltay/2), (int) ROI[i]->posx + ROI[i]->deltax, (int) (ROI[i]->posy + ROI[i]->deltay/2), r, g, b, 2);
- }
+ 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)
@@ -288,39 +363,38 @@ bool ClassFlowAnalog::doNeuralNetwork(string time)
tflite->MakeAllocate();
#endif
- for (int i = 0; i < ROI.size(); ++i)
+ for (int _ana = 0; _ana < ANALOG.size(); ++_ana)
{
- printf("Analog %d - TfLite\n", i);
- ioresize = "/sdcard/img_tmp/ra" + std::to_string(i) + ".bmp";
- ioresize = FormatFileName(ioresize);
-
-
- float f1, f2;
- f1 = 0; f2 = 0;
-
-#ifndef OHNETFLITE
-// LogFile.WriteToFile("ClassFlowAnalog::doNeuralNetwork vor CNN tflite->LoadInputImage(ioresize)");
-// tflite->LoadInputImage(ioresize);
- tflite->LoadInputImageBasis(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);
- ROI[i]->result = result * 10;
-
- printf("Result Analog%i: %f\n", i, ROI[i]->result);
-
- if (isLogImage)
+ for (int i = 0; i < ANALOG[_ana]->ROI.size(); ++i)
{
- LogImage(logPath, ROI[i]->name, &ROI[i]->result, NULL, time, ROI[i]->image_org);
+ 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
@@ -333,18 +407,78 @@ std::vector ClassFlowAnalog::GetHTMLInfo()
{
std::vector result;
- for (int i = 0; i < ROI.size(); ++i)
- {
- HTMLInfo *zw = new HTMLInfo;
- zw->filename = ROI[i]->name + ".bmp";
- zw->filename_org = ROI[i]->name + ".jpg";
- zw->val = ROI[i]->result;
- zw->image = ROI[i]->image;
- zw->image_org = ROI[i]->image_org;
- result.push_back(zw);
- }
+ 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 *_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);
+ }
+}
+
+
+
+
diff --git a/code/components/jomjol_flowcontroll/ClassFlowAnalog.h b/code/components/jomjol_flowcontroll/ClassFlowAnalog.h
index 08a29be7..bd9af089 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowAnalog.h
+++ b/code/components/jomjol_flowcontroll/ClassFlowAnalog.h
@@ -10,12 +10,19 @@ struct roianalog {
string name;
};
+struct analog {
+ string name;
+ std::vector ROI;
+};
+
class ClassFlowAnalog :
public ClassFlowImage
{
protected:
- std::vector ROI;
+// std::vector ROI;
+ std::vector ANALOG;
+
string cnnmodelfile;
int modelxsize, modelysize;
int ZeigerEval(float zahl, int ziffer_vorgaenger);
@@ -24,7 +31,8 @@ protected:
ClassFlowAlignment* flowpostalignment;
- void SetInitialParameter(void);
+ void SetInitialParameter(void);
+
public:
bool extendedResolution;
@@ -34,14 +42,23 @@ public:
bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time);
string getHTMLSingleStep(string host);
- string getReadout();
+ string getReadout(int _analog);
void DrawROI(CImageBasis *_zw);
bool doNeuralNetwork(string time);
bool doAlignAndCut(string time);
std::vector GetHTMLInfo();
- int AnzahlROIs();
+ int AnzahlROIs(int _analog);
+
+ int getAnzahlANALOG();
+ analog* GetANALOG(int _analog);
+ analog* GetANALOG(string _name, bool _create);
+ analog* FindANALOG(string _name_number);
+ string getNameANALOG(int _analog);
+
+ void UpdateNameNumbers(std::vector *_name_numbers);
+
string name(){return "ClassFlowAnalog";};
};
diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp
index 7399aa23..921e40b0 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp
+++ b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp
@@ -262,6 +262,38 @@ void ClassFlowControll::UpdateAktStatus(std::string _flow)
}
+string ClassFlowControll::getReadoutAll(int _type)
+{
+ std::vector numbers = flowpostprocessing->GetNumbers();
+ std::string out = "";
+
+ for (int i = 0; i < numbers.size(); ++i)
+ {
+ out = out + numbers[i]->name + "\t";
+ switch (_type) {
+ case READOUT_TYPE_VALUE:
+ out = out + numbers[i]->ReturnValue;
+ break;
+ case READOUT_TYPE_PREVALUE:
+ out = out + std::to_string(numbers[i]->PreValue);
+ break;
+ case READOUT_TYPE_RAWVALUE:
+ out = out + numbers[i]->ReturnRawValue;
+ break;
+ case READOUT_TYPE_ERROR:
+ out = out + numbers[i]->ErrorMessageText;
+ break;
+ }
+ if (i < numbers.size()-1)
+ out = out + "\r\n";
+ }
+
+// printf("OUT: %s", out.c_str());
+
+ return out;
+}
+
+
string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false)
{
if (flowpostprocessing)
@@ -285,17 +317,17 @@ string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = fal
return result;
}
-string ClassFlowControll::GetPrevalue()
+string ClassFlowControll::GetPrevalue(std::string _number)
{
if (flowpostprocessing)
{
- return flowpostprocessing->GetPreValue();
+ return flowpostprocessing->GetPreValue(_number);
}
return std::string();
}
-std::string ClassFlowControll::UpdatePrevalue(std::string _newvalue)
+std::string ClassFlowControll::UpdatePrevalue(std::string _newvalue, std::string _numbers)
{
float zw;
char* p;
@@ -317,7 +349,7 @@ std::string ClassFlowControll::UpdatePrevalue(std::string _newvalue)
if (flowpostprocessing)
{
- flowpostprocessing->SavePreValue(zw);
+ flowpostprocessing->SetPreValue(zw, _numbers);
return _newvalue;
}
diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.h b/code/components/jomjol_flowcontroll/ClassFlowControll.h
index 6ef26a2c..7a21406b 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowControll.h
+++ b/code/components/jomjol_flowcontroll/ClassFlowControll.h
@@ -11,6 +11,12 @@
#include "ClassFlowMQTT.h"
+#define READOUT_TYPE_VALUE 0
+#define READOUT_TYPE_PREVALUE 1
+#define READOUT_TYPE_RAWVALUE 2
+#define READOUT_TYPE_ERROR 3
+
+
class ClassFlowControll :
public ClassFlow
{
@@ -38,8 +44,9 @@ public:
void doFlowMakeImageOnly(string time);
bool getStatusSetupModus(){return SetupModeActive;};
string getReadout(bool _rawvalue, bool _noerror);
- string UpdatePrevalue(std::string _newvalue);
- string GetPrevalue();
+ string getReadoutAll(int _type);
+ string UpdatePrevalue(std::string _newvalue, std::string _numbers);
+ string GetPrevalue(std::string _number = "");
bool ReadParameter(FILE* pfile, string& aktparamgraph);
esp_err_t GetJPGStream(std::string _fn, httpd_req_t *req);
diff --git a/code/components/jomjol_flowcontroll/ClassFlowDigit.cpp b/code/components/jomjol_flowcontroll/ClassFlowDigit.cpp
index 6e37cc0b..dad5fcfe 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowDigit.cpp
+++ b/code/components/jomjol_flowcontroll/ClassFlowDigit.cpp
@@ -64,16 +64,16 @@ ClassFlowDigit::ClassFlowDigit(std::vector* lfc, ClassFlow *_prev) :
}
}
-string ClassFlowDigit::getReadout()
+string ClassFlowDigit::getReadout(int _digit = 0)
{
string rst = "";
- for (int i = 0; i < ROI.size(); ++i)
+ for (int i = 0; i < DIGIT[_digit]->ROI.size(); ++i)
{
- if (ROI[i]->resultklasse == 10)
+ if (DIGIT[_digit]->ROI[i]->resultklasse == 10)
rst = rst + "N";
else
- rst = rst + std::to_string(ROI[i]->resultklasse);
+ rst = rst + std::to_string(DIGIT[_digit]->ROI[i]->resultklasse);
}
return rst;
@@ -91,18 +91,11 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
printf("aktparamgraph: %s\n", aktparamgraph.c_str());
-
-/*
- if ((aktparamgraph.compare("[Digits]") != 0) && (aktparamgraph.compare(";[Digits]") != 0)) // Paragraph passt nich zu MakeImage
- return false;
-*/
-
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("]");
-// printf("Pos: %d, %d\n", _pospkt, _posklammerzu);
if (_pospkt > -1)
NameDigit = aktparamgraph.substr(_pospkt+1, _posklammerzu - _pospkt-1);
else
@@ -137,8 +130,8 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
}
if (zerlegt.size() >= 5)
{
- roi* neuroi = new roi;
- neuroi->name = zerlegt[0];
+ 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]);
@@ -146,7 +139,6 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
neuroi->resultklasse = -1;
neuroi->image = NULL;
neuroi->image_org = NULL;
- ROI.push_back(neuroi);
}
if ((toUpper(zerlegt[0]) == "SAVEALLFILES") && (zerlegt.size() > 1))
@@ -157,15 +149,74 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
}
- for (int i = 0; i < ROI.size(); ++i)
- {
- ROI[i]->image = new CImageBasis(modelxsize, modelysize, 3);
- ROI[i]->image_org = new CImageBasis(ROI[i]->deltax, ROI[i]->deltay, 3);
- }
+ 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)
+{
+ digit *_ret = NULL;
+
+ 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)
{
@@ -216,17 +267,32 @@ bool ClassFlowDigit::doAlignAndCut(string time)
CAlignAndCutImage *caic = flowpostalignment->GetAlignAndCutImage();
- for (int i = 0; i < ROI.size(); ++i)
+ for (int _dig = 0; _dig < DIGIT.size(); ++_dig)
{
- printf("DigitalDigit %d - Align&Cut\n", i);
-
- caic->CutAndSave(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay, ROI[i]->image_org);
- if (SaveAllFiles) ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".jpg"));
+ 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"));
+ }
- ROI[i]->image_org->Resize(modelxsize, modelysize, ROI[i]->image);
- if (SaveAllFiles) ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".bmp"));
+ 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;
}
@@ -245,22 +311,23 @@ bool ClassFlowDigit::doNeuralNetwork(string time)
tflite->MakeAllocate();
#endif
- for (int i = 0; i < ROI.size(); ++i)
- {
- printf("DigitalDigit %d - TfLite\n", i);
-
- ROI[i]->resultklasse = 0;
-#ifndef OHNETFLITE
- ROI[i]->resultklasse = tflite->GetClassFromImageBasis(ROI[i]->image);
-
-#endif
- printf("Result Digit%i: %d\n", i, ROI[i]->resultklasse);
-
- if (isLogImage)
+ for (int _dig = 0; _dig < DIGIT.size(); ++_dig)
+ for (int i = 0; i < DIGIT[_dig]->ROI.size(); ++i)
{
- LogImage(logPath, ROI[i]->name, NULL, &ROI[i]->resultklasse, time, ROI[i]->image_org);
+ 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)
+ {
+ 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
@@ -269,25 +336,82 @@ bool ClassFlowDigit::doNeuralNetwork(string time)
void ClassFlowDigit::DrawROI(CImageBasis *_zw)
{
- for (int i = 0; i < ROI.size(); ++i)
- _zw->drawRect(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay, 0, 0, 255, 2);
+ 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 ClassFlowDigit::GetHTMLInfo()
{
std::vector result;
- for (int i = 0; i < ROI.size(); ++i)
- {
- HTMLInfo *zw = new HTMLInfo;
- zw->filename = ROI[i]->name + ".bmp";
- zw->filename_org = ROI[i]->name + ".jpg";
- zw->val = ROI[i]->resultklasse;
- zw->image = ROI[i]->image;
- zw->image_org = ROI[i]->image_org;
- result.push_back(zw);
- }
+ 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 *_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);
+ }
+}
+
+
+
+
diff --git a/code/components/jomjol_flowcontroll/ClassFlowDigit.h b/code/components/jomjol_flowcontroll/ClassFlowDigit.h
index 3af92f85..f6d98616 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowDigit.h
+++ b/code/components/jomjol_flowcontroll/ClassFlowDigit.h
@@ -5,6 +5,8 @@
#include
+
+
struct roi {
int posx, posy, deltax, deltay;
int resultklasse;
@@ -13,11 +15,17 @@ struct roi {
roi* next;
};
+struct digit {
+ string name;
+ std::vector ROI;
+};
+
class ClassFlowDigit :
public ClassFlowImage
{
protected:
- std::vector ROI;
+// std::vector ROI;
+ std::vector DIGIT;
string cnnmodelfile;
int modelxsize, modelysize;
bool SaveAllFiles;
@@ -31,6 +39,7 @@ protected:
bool doNeuralNetwork(string time);
bool doAlignAndCut(string time);
+
void SetInitialParameter(void);
public:
@@ -40,9 +49,18 @@ public:
bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time);
string getHTMLSingleStep(string host);
- string getReadout();
+ string getReadout(int _digit);
std::vector 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 *_name_numbers);
+
void DrawROI(CImageBasis *_zw);
string name(){return "ClassFlowDigit";};
diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp
index e9d54cb0..25c8c684 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp
+++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp
@@ -1,8 +1,6 @@
#include "ClassFlowPostProcessing.h"
#include "Helper.h"
-#include "ClassFlowAnalog.h"
-#include "ClassFlowDigit.h"
#include "ClassFlowMakeImage.h"
#include "ClassLogFile.h"
@@ -18,130 +16,203 @@
#define PREVALUE_TIME_FORMAT_INPUT "%d-%d-%dT%d:%d:%d"
-string ClassFlowPostProcessing::GetPreValue()
+string ClassFlowPostProcessing::GetPreValue(std::string _number)
{
std::string result;
- bool isAnalog = false;
- bool isDigit = false;
+ int index = -1;
- int AnzahlAnalog = 0;
- result = RundeOutput(PreValue, -DecimalShift);
+ if (_number == "")
+ _number = "default";
- for (int i = 0; i < ListFlowControll->size(); ++i)
- {
- if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
- {
- isAnalog = true;
- AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
- }
- if (((*ListFlowControll)[i])->name().compare("ClassFlowDigit") == 0)
- {
- isDigit = true;
- }
- }
+ for (int i = 0; i < NUMBERS.size(); ++i)
+ if (NUMBERS[i]->name == _number)
+ index = i;
- if (isDigit && isAnalog)
- result = RundeOutput(PreValue, AnzahlAnalog - DecimalShift);
+ result = RundeOutput(NUMBERS[index]->PreValue, -NUMBERS[index]->DecimalShift);
+
+ if (NUMBERS[index]->digit_roi && NUMBERS[index]->analog_roi)
+ result = RundeOutput(NUMBERS[index]->PreValue, NUMBERS[index]->AnzahlAnalog - NUMBERS[index]->DecimalShift);
return result;
}
+void ClassFlowPostProcessing::SetPreValue(float zw, string _numbers)
+{
+ for (int j = 0; j < NUMBERS.size(); ++j)
+ {
+ if (NUMBERS[j]->name == _numbers)
+ NUMBERS[j]->PreValue = zw;
+ }
+ UpdatePreValueINI = true;
+ SavePreValue();
+}
+
+
bool ClassFlowPostProcessing::LoadPreValue(void)
{
+ std::vector zerlegt;
FILE* pFile;
char zw[1024];
- string zwtime, zwvalue;
+ string zwtime, zwvalue, name;
+ bool _done = false;
+
+ UpdatePreValueINI = false; // Konvertierung ins neue Format
+
pFile = fopen(FilePreValue.c_str(), "r");
if (pFile == NULL)
return false;
fgets(zw, 1024, pFile);
- printf("%s", zw);
+ printf("Read Zeile Prevalue.ini: %s", zw);
zwtime = trim(std::string(zw));
-
- fgets(zw, 1024, pFile);
- fclose(pFile);
- printf("%s", zw);
- zwvalue = trim(std::string(zw));
- PreValue = stof(zwvalue.c_str());
-
- time_t tStart;
- int yy, month, dd, hh, mm, ss;
- struct tm whenStart;
-
- sscanf(zwtime.c_str(), PREVALUE_TIME_FORMAT_INPUT, &yy, &month, &dd, &hh, &mm, &ss);
- whenStart.tm_year = yy - 1900;
- whenStart.tm_mon = month - 1;
- whenStart.tm_mday = dd;
- whenStart.tm_hour = hh;
- whenStart.tm_min = mm;
- whenStart.tm_sec = ss;
- whenStart.tm_isdst = -1;
-
- lastvalue = mktime(&whenStart);
-
- time(&tStart);
- localtime(&tStart);
- double difference = difftime(tStart, lastvalue);
- difference /= 60;
- if (difference > PreValueAgeStartup)
+ if (zwtime.length() == 0)
return false;
- Value = PreValue;
- ReturnValue = to_string(Value);
- ReturnValueNoError = ReturnValue;
-
- bool isAnalog = false;
- bool isDigit = false;
- int AnzahlAnalog = 0;
-
- for (int i = 0; i < ListFlowControll->size(); ++i)
+ zerlegt = HelperZerlegeZeile(zwtime, "\t");
+ if (zerlegt.size() > 1) // neues Format
{
- if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
- isAnalog = true;
- if (((*ListFlowControll)[i])->name().compare("ClassFlowDigit") == 0)
- isDigit = true;
- }
+ while ((zerlegt.size() > 1) && !_done)
+ {
+ name = trim(zerlegt[0]);
+ zwtime = trim(zerlegt[1]);
+ zwvalue = trim(zerlegt[2]);
- if (isDigit || isAnalog)
+ for (int j = 0; j < NUMBERS.size(); ++j)
+ {
+ if (NUMBERS[j]->name == name)
+ {
+ NUMBERS[j]->PreValue = stof(zwvalue.c_str());
+
+ time_t tStart;
+ int yy, month, dd, hh, mm, ss;
+ struct tm whenStart;
+
+ sscanf(zwtime.c_str(), PREVALUE_TIME_FORMAT_INPUT, &yy, &month, &dd, &hh, &mm, &ss);
+ whenStart.tm_year = yy - 1900;
+ whenStart.tm_mon = month - 1;
+ whenStart.tm_mday = dd;
+ whenStart.tm_hour = hh;
+ whenStart.tm_min = mm;
+ whenStart.tm_sec = ss;
+ whenStart.tm_isdst = -1;
+
+ NUMBERS[j]->lastvalue = mktime(&whenStart);
+
+ time(&tStart);
+ localtime(&tStart);
+ double difference = difftime(tStart, NUMBERS[j]->lastvalue);
+ difference /= 60;
+ if (difference > PreValueAgeStartup)
+ {
+ NUMBERS[j]->PreValueOkay = false;
+ }
+ else
+ {
+ NUMBERS[j]->PreValueOkay = true;
+ NUMBERS[j]->Value = NUMBERS[j]->PreValue;
+ NUMBERS[j]->ReturnValue = to_string(NUMBERS[j]->Value);
+ NUMBERS[j]->ReturnValueNoError = NUMBERS[j]->ReturnValue;
+
+ if (NUMBERS[j]->digit_roi || NUMBERS[j]->analog_roi)
+ {
+ NUMBERS[j]->ReturnValue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift);
+ NUMBERS[j]->ReturnValueNoError = NUMBERS[j]->ReturnValue;
+ }
+ }
+
+ }
+ }
+
+ if (!fgets(zw, 1024, pFile))
+ _done = true;
+ else
+ {
+ printf("Read Zeile Prevalue.ini: %s", zw);
+ zerlegt = HelperZerlegeZeile(trim(std::string(zw)), "\t");
+ if (zerlegt.size() > 1)
+ {
+ name = trim(zerlegt[0]);
+ zwtime = trim(zerlegt[1]);
+ zwvalue = trim(zerlegt[2]);
+ }
+ }
+ }
+ fclose(pFile);
+ }
+ else // altes Format
{
- ReturnValue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
- ReturnValueNoError = ReturnValue;
- }
-
+ fgets(zw, 1024, pFile);
+ fclose(pFile);
+ printf("%s", zw);
+ zwvalue = trim(std::string(zw));
+ NUMBERS[0]->PreValue = stof(zwvalue.c_str());
+
+ time_t tStart;
+ int yy, month, dd, hh, mm, ss;
+ struct tm whenStart;
+
+ sscanf(zwtime.c_str(), PREVALUE_TIME_FORMAT_INPUT, &yy, &month, &dd, &hh, &mm, &ss);
+ whenStart.tm_year = yy - 1900;
+ whenStart.tm_mon = month - 1;
+ whenStart.tm_mday = dd;
+ whenStart.tm_hour = hh;
+ whenStart.tm_min = mm;
+ whenStart.tm_sec = ss;
+ whenStart.tm_isdst = -1;
+
+ printf("TIME: %d, %d, %d, %d, %d, %d\n", whenStart.tm_year, whenStart.tm_mon, whenStart.tm_wday, whenStart.tm_hour, whenStart.tm_min, whenStart.tm_sec);
+
+ NUMBERS[0]->lastvalue = mktime(&whenStart);
+
+ time(&tStart);
+ localtime(&tStart);
+ double difference = difftime(tStart, NUMBERS[0]->lastvalue);
+ difference /= 60;
+ if (difference > PreValueAgeStartup)
+ return false;
+
+ NUMBERS[0]->Value = NUMBERS[0]->PreValue;
+ NUMBERS[0]->ReturnValue = to_string(NUMBERS[0]->Value);
+ NUMBERS[0]->ReturnValueNoError = NUMBERS[0]->ReturnValue;
+
+ if (NUMBERS[0]->digit_roi || NUMBERS[0]->analog_roi)
+ {
+ NUMBERS[0]->ReturnValue = RundeOutput(NUMBERS[0]->Value, NUMBERS[0]->AnzahlAnalog - NUMBERS[0]->DecimalShift);
+ NUMBERS[0]->ReturnValueNoError = NUMBERS[0]->ReturnValue;
+ }
+
+ UpdatePreValueINI = true; // Konvertierung ins neue Format
+ SavePreValue();
+ }
+
return true;
}
-void ClassFlowPostProcessing::SavePreValue(float value, string zwtime)
+void ClassFlowPostProcessing::SavePreValue()
{
FILE* pFile;
+ string _zw;
+
+ if (!UpdatePreValueINI) // PreValues unverändert --> File muss nicht neu geschrieben werden
+ return;
pFile = fopen(FilePreValue.c_str(), "w");
- if (strlen(zwtime.c_str()) == 0)
+ for (int j = 0; j < NUMBERS.size(); ++j)
{
- time_t rawtime;
- struct tm* timeinfo;
char buffer[80];
-
- time(&rawtime);
- timeinfo = localtime(&rawtime);
-
+ struct tm* timeinfo = localtime(&NUMBERS[j]->lastvalue);
strftime(buffer, 80, PREVALUE_TIME_FORMAT_OUTPUT, timeinfo);
- timeStamp = std::string(buffer);
- }
- else
- {
- timeStamp = zwtime;
+ NUMBERS[j]->timeStamp = std::string(buffer);
+
+ _zw = NUMBERS[j]->name + "\t" + NUMBERS[j]->timeStamp + "\t" + to_string(NUMBERS[j]->PreValue) + "\n";
+ printf("Write PreValue Zeile: %s\n", _zw.c_str());
+
+ fputs(_zw.c_str(), pFile);
}
- PreValue = value;
-
- fputs(timeStamp.c_str(), pFile);
- fputs("\n", pFile);
- fputs(to_string(value).c_str(), pFile);
- fputs("\n", pFile);
+ UpdatePreValueINI = false;
fclose(pFile);
}
@@ -149,22 +220,19 @@ void ClassFlowPostProcessing::SavePreValue(float value, string zwtime)
ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector* lfc)
{
- FlowRateAct = 0;
+// FlowRateAct = 0;
PreValueUse = false;
PreValueAgeStartup = 30;
- AllowNegativeRates = false;
- MaxRateValue = 0.1;
ErrorMessage = false;
ListFlowControll = NULL;
- PreValueOkay = false;
- useMaxRateValue = false;
- checkDigitIncreaseConsistency = false;
- DecimalShift = 0;
- ErrorMessageText = "";
- timeStamp = "";
+// PreValueOkay = false;
+// DecimalShift = 0;
+// ErrorMessageText = "";
+// timeStamp = "";
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
ListFlowControll = lfc;
flowMakeImage = NULL;
+ UpdatePreValueINI = false;
for (int i = 0; i < ListFlowControll->size(); ++i)
{
@@ -175,10 +243,35 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector* lfc)
}
}
+void ClassFlowPostProcessing::handleDecimalSeparator(string _decsep, string _value)
+{
+ string _digit, _decpos;
+ int _pospunkt = _decsep.find_first_of(".");
+// printf("Name: %s, Pospunkt: %d\n", _name.c_str(), _pospunkt);
+ if (_pospunkt > -1)
+ {
+ _digit = _decsep.substr(_pospunkt+1, _decsep.length() - _pospunkt - 1);
+ }
+ else
+ {
+ _digit = "default";
+ }
+
+ for (int j = 0; j < NUMBERS.size(); ++j)
+ {
+ if (_digit == "default") // erstmal auf default setzen (falls sonst nichts gesetzt)
+ NUMBERS[j]->DecimalShift = stoi(_value);
+
+ if (NUMBERS[j]->name == _digit)
+ NUMBERS[j]->DecimalShift = stoi(_value);
+ }
+}
+
bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
{
std::vector zerlegt;
+ int _n;
aktparamgraph = trim(aktparamgraph);
@@ -190,12 +283,15 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
if (aktparamgraph.compare("[PostProcessing]") != 0) // Paragraph passt nich zu MakeImage
return false;
+ InitNUMBERS();
+
+
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
{
zerlegt = this->ZerlegeZeile(aktparamgraph);
- if ((toUpper(zerlegt[0]) == "DECIMALSHIFT") && (zerlegt.size() > 1))
+ if ((toUpper(zerlegt[0].substr(0, 12)) == "DECIMALSHIFT") && (zerlegt.size() > 1))
{
- DecimalShift = stoi(zerlegt[1]);
+ handleDecimalSeparator(zerlegt[0], zerlegt[1]);
}
if ((toUpper(zerlegt[0]) == "PREVALUEUSE") && (zerlegt.size() > 1))
@@ -208,12 +304,14 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
if ((toUpper(zerlegt[0]) == "CHECKDIGITINCREASECONSISTENCY") && (zerlegt.size() > 1))
{
if (toUpper(zerlegt[1]) == "TRUE")
- checkDigitIncreaseConsistency = true;
+ for (_n = 0; _n < NUMBERS.size(); ++_n)
+ NUMBERS[_n]->checkDigitIncreaseConsistency = true;
}
if ((toUpper(zerlegt[0]) == "ALLOWNEGATIVERATES") && (zerlegt.size() > 1))
{
if (toUpper(zerlegt[1]) == "TRUE")
- AllowNegativeRates = true;
+ for (_n = 0; _n < NUMBERS.size(); ++_n)
+ NUMBERS[_n]->AllowNegativeRates = true;
}
if ((toUpper(zerlegt[0]) == "ERRORMESSAGE") && (zerlegt.size() > 1))
{
@@ -226,17 +324,103 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
}
if ((toUpper(zerlegt[0]) == "MAXRATEVALUE") && (zerlegt.size() > 1))
{
- useMaxRateValue = true;
- MaxRateValue = std::stof(zerlegt[1]);
+ for (_n = 0; _n < NUMBERS.size(); ++_n)
+ {
+ NUMBERS[_n]->useMaxRateValue = true;
+ NUMBERS[_n]->MaxRateValue = std::stof(zerlegt[1]);
+ }
}
}
if (PreValueUse) {
- PreValueOkay = LoadPreValue();
+ LoadPreValue();
}
+
return true;
}
+void ClassFlowPostProcessing::InitNUMBERS()
+{
+// ClassFlowDigit* _cdigit = NULL;
+// ClassFlowAnalog* _canalog = NULL;
+ int anzDIGIT = 0;
+ int anzANALOG = 0;
+ std::vector 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();
+ }
+ }
+
+ flowDigit->UpdateNameNumbers(&name_numbers);
+ flowAnalog->UpdateNameNumbers(&name_numbers);
+
+ printf("Anzahl NUMBERS: %d - DIGITS: %d, ANALOG: %d\n", name_numbers.size(), anzDIGIT, anzANALOG);
+
+ for (int _num = 0; _num < name_numbers.size(); ++_num)
+ {
+ NumberPost *_number = new NumberPost;
+
+ _number->name = name_numbers[_num];
+
+ _number->digit_roi = NULL;
+ if (flowDigit)
+ _number->digit_roi = flowDigit->FindDIGIT(name_numbers[_num]);
+
+ if (_number->digit_roi)
+ _number->AnzahlDigital = _number->digit_roi->ROI.size();
+ else
+ _number->AnzahlDigital = 0;
+
+ _number->analog_roi = NULL;
+ if (flowAnalog)
+ _number->analog_roi = flowAnalog->FindANALOG(name_numbers[_num]);
+
+
+ if (_number->analog_roi)
+ _number->AnzahlAnalog = _number->analog_roi->ROI.size();
+ else
+ _number->AnzahlAnalog = 0;
+
+ _number->ReturnRawValue = ""; // Rohwert (mit N & führenden 0)
+ _number->ReturnValue = ""; // korrigierter Rückgabewert, ggf. mit Fehlermeldung
+ _number->ReturnValueNoError = ""; // korrigierter Rückgabewert ohne Fehlermeldung
+ _number->ErrorMessageText = ""; // Fehlermeldung bei Consistency Check
+ _number->PreValueOkay = false;
+ _number->AllowNegativeRates = false;
+ _number->MaxRateValue = 0.1;
+ _number->useMaxRateValue = false;
+ _number->checkDigitIncreaseConsistency = false;
+ _number->PreValueOkay = false;
+ _number->useMaxRateValue = false;
+
+ _number->FlowRateAct = 0; // m3 / min
+ _number->PreValue = 0; // letzter Wert, der gut ausgelesen wurde
+ _number->Value = 0; // letzer ausgelesener Wert, inkl. Korrekturen
+ _number->ReturnRawValue = ""; // Rohwert (mit N & führenden 0)
+ _number->ReturnValue = ""; // korrigierter Rückgabewert, ggf. mit Fehlermeldung
+ _number->ReturnValueNoError = ""; // korrigierter Rückgabewert ohne Fehlermeldung
+ _number->ErrorMessageText = ""; // Fehlermeldung bei Consistency Check
+
+ NUMBERS.push_back(_number);
+ }
+
+ for (int i = 0; i < NUMBERS.size(); ++i)
+ printf("Number %s, Anz DIG: %d, Anz ANA %d\n", NUMBERS[i]->name.c_str(), NUMBERS[i]->AnzahlDigital, NUMBERS[i]->AnzahlAnalog);
+}
+
string ClassFlowPostProcessing::ShiftDecimal(string in, int _decShift){
if (_decShift == 0){
@@ -285,173 +469,125 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
string digit = "";
string analog = "";
string zwvalue;
- bool isdigit = false;
- bool isanalog = false;
- int AnzahlAnalog = 0;
string zw;
time_t imagetime = 0;
string rohwert;
- ErrorMessageText = "";
-
-
- for (int i = 0; i < ListFlowControll->size(); ++i)
- {
- if (((*ListFlowControll)[i])->name().compare("ClassFlowMakeImage") == 0)
- {
- imagetime = ((ClassFlowMakeImage*)(*ListFlowControll)[i])->getTimeImageTaken();
- }
- if (((*ListFlowControll)[i])->name().compare("ClassFlowDigit") == 0)
- {
- isdigit = true;
- digit = (*ListFlowControll)[i]->getReadout();
- }
- if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
- {
- isanalog = true;
- analog = (*ListFlowControll)[i]->getReadout();
- AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
- }
- }
+// ErrorMessageText = "";
+ imagetime = flowMakeImage->getTimeImageTaken();
if (imagetime == 0)
time(&imagetime);
struct tm* timeinfo;
timeinfo = localtime(&imagetime);
-
char strftime_buf[64];
strftime(strftime_buf, sizeof(strftime_buf), "%Y-%m-%dT%H:%M:%S", timeinfo);
zwtime = std::string(strftime_buf);
+ printf("Anzahl NUMBERS: %d\n", NUMBERS.size());
- // // TESTING ONLY////////////////////
- // isdigit = true; digit = "12N";
- // isanalog = true; analog = "456";
-
- ReturnRawValue = "";
-
- if (isdigit)
- ReturnRawValue = digit;
- if (isdigit && isanalog)
- ReturnRawValue = ReturnRawValue + ".";
- if (isanalog)
- ReturnRawValue = ReturnRawValue + analog;
-
-
- if (!isdigit)
+ for (int j = 0; j < NUMBERS.size(); ++j)
{
- AnzahlAnalog = 0;
- }
+ NUMBERS[j]->ReturnRawValue = "";
+ NUMBERS[j]->ErrorMessageText = "";
- ReturnRawValue = ShiftDecimal(ReturnRawValue, DecimalShift);
+ if (NUMBERS[j]->digit_roi)
+ NUMBERS[j]->ReturnRawValue = flowDigit->getReadout(j);
+ if (NUMBERS[j]->digit_roi && NUMBERS[j]->analog_roi)
+ NUMBERS[j]->ReturnRawValue = NUMBERS[j]->ReturnRawValue + ".";
+ if (NUMBERS[j]->analog_roi)
+ NUMBERS[j]->ReturnRawValue = NUMBERS[j]->ReturnRawValue + flowAnalog->getReadout(j);
- rohwert = ReturnRawValue;
+ NUMBERS[j]->ReturnRawValue = ShiftDecimal(NUMBERS[j]->ReturnRawValue, NUMBERS[j]->DecimalShift);
- if (!PreValueUse || !PreValueOkay)
- {
- ReturnValue = ReturnRawValue;
- ReturnValueNoError = ReturnRawValue;
+ rohwert = NUMBERS[j]->ReturnRawValue;
- if ((findDelimiterPos(ReturnValue, "N") == std::string::npos) && (ReturnValue.length() > 0))
+ if (!PreValueUse || !NUMBERS[j]->PreValueOkay)
{
- while ((ReturnValue.length() > 1) && (ReturnValue[0] == '0'))
- {
- ReturnValue.erase(0, 1);
- }
- Value = std::stof(ReturnValue);
- ReturnValueNoError = ReturnValue;
+ NUMBERS[j]->ReturnValue = NUMBERS[j]->ReturnRawValue;
+ NUMBERS[j]->ReturnValueNoError = NUMBERS[j]->ReturnRawValue;
- PreValueOkay = true;
- PreValue = Value;
- if (flowMakeImage)
+ if ((findDelimiterPos(NUMBERS[j]->ReturnValue, "N") == std::string::npos) && (NUMBERS[j]->ReturnValue.length() > 0))
{
- lastvalue = flowMakeImage->getTimeImageTaken();
- zwtime = ConvertTimeToString(lastvalue, PREVALUE_TIME_FORMAT_OUTPUT);
- }
- else
- {
- time(&lastvalue);
- localtime(&lastvalue);
- }
+ while ((NUMBERS[j]->ReturnValue.length() > 1) && (NUMBERS[j]->ReturnValue[0] == '0'))
+ {
+ NUMBERS[j]->ReturnValue.erase(0, 1);
+ }
+ NUMBERS[j]->Value = std::stof(NUMBERS[j]->ReturnValue);
+ NUMBERS[j]->ReturnValueNoError = NUMBERS[j]->ReturnValue;
- SavePreValue(Value, zwtime);
+ NUMBERS[j]->PreValueOkay = true;
+ NUMBERS[j]->PreValue = NUMBERS[j]->Value;
+ NUMBERS[j]->lastvalue = flowMakeImage->getTimeImageTaken();
+ zwtime = ConvertTimeToString(NUMBERS[j]->lastvalue, PREVALUE_TIME_FORMAT_OUTPUT);
+
+ UpdatePreValueINI = true;
+ SavePreValue();
+ }
+ }
+ else
+ {
+ zw = ErsetzteN(NUMBERS[j]->ReturnRawValue, NUMBERS[j]->PreValue);
+
+ NUMBERS[j]->Value = std::stof(zw);
+ if (NUMBERS[j]->checkDigitIncreaseConsistency)
+ {
+ NUMBERS[j]->Value = checkDigitConsistency(NUMBERS[j]->Value, NUMBERS[j]->DecimalShift, NUMBERS[j]->analog_roi != NULL, NUMBERS[j]->PreValue);
+ }
+
+ zwvalue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift);
+
+ if ((!NUMBERS[j]->AllowNegativeRates) && (NUMBERS[j]->Value < NUMBERS[j]->PreValue))
+ {
+ NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Neg. Rate - Read: " + zwvalue + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + std::to_string(NUMBERS[j]->Value) + " ";
+ NUMBERS[j]->Value = NUMBERS[j]->PreValue;
+ zwvalue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift);
+ }
+
+ if (NUMBERS[j]->useMaxRateValue && (abs(NUMBERS[j]->Value - NUMBERS[j]->PreValue) > NUMBERS[j]->MaxRateValue))
+ {
+ NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Rate too high - Read: " + zwvalue + " - Pre: " + RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift) + " ";
+ NUMBERS[j]->Value = NUMBERS[j]->PreValue;
+ zwvalue = RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->AnzahlAnalog - NUMBERS[j]->DecimalShift);
+ }
+
+ NUMBERS[j]->ReturnValueNoError = zwvalue;
+ NUMBERS[j]->ReturnValue = zwvalue;
+ if (NUMBERS[j]->ErrorMessage && (NUMBERS[j]->ErrorMessageText.length() > 0))
+ NUMBERS[j]->ReturnValue = NUMBERS[j]->ReturnValue + "\t" + NUMBERS[j]->ErrorMessageText;
+
+
+ double difference = difftime(imagetime, NUMBERS[j]->lastvalue); // in Sekunden
+ difference /= 60; // in Minuten
+ NUMBERS[j]->FlowRateAct = (NUMBERS[j]->Value - NUMBERS[j]->PreValue) / difference;
+ NUMBERS[j]->lastvalue = imagetime;
+
+ if (NUMBERS[j]->ErrorMessageText.length() == 0)
+ {
+ NUMBERS[j]->PreValue = NUMBERS[j]->Value;
+ NUMBERS[j]->ErrorMessageText = "no error";
+ UpdatePreValueINI = true;
+ }
}
- return true;
}
-
- zw = ErsetzteN(ReturnRawValue);
-
- Value = std::stof(zw);
- if (checkDigitIncreaseConsistency)
- {
- Value = checkDigitConsistency(Value, DecimalShift, isanalog);
- }
-
- zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
-
- if ((!AllowNegativeRates) && (Value < PreValue))
- {
- ErrorMessageText = ErrorMessageText + "Negative Rate - Returned old value - read value: " + zwvalue + " - raw value: " + ReturnRawValue + " - checked value: " + std::to_string(Value) + " ";
- Value = PreValue;
- zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
- }
-
- if (useMaxRateValue && (abs(Value - PreValue) > MaxRateValue))
- {
- ErrorMessageText = ErrorMessageText + "Rate too high - Returned old value - read value: " + zwvalue + " - checked value: " + RundeOutput(Value, AnzahlAnalog - DecimalShift) + " ";
- Value = PreValue;
- zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
- }
-
-
- ReturnValueNoError = zwvalue;
- ReturnValue = zwvalue;
- if (ErrorMessage && (ErrorMessageText.length() > 0))
- ReturnValue = ReturnValue + "\t" + ErrorMessageText;
-
- time_t currenttime;
- if (flowMakeImage)
- {
- currenttime = flowMakeImage->getTimeImageTaken();
- zwtime = ConvertTimeToString(currenttime, PREVALUE_TIME_FORMAT_OUTPUT);
- }
- else
- {
- time(¤ttime);
- localtime(¤ttime);
- }
-
- double difference = difftime(currenttime, lastvalue); // in Sekunden
- difference /= 60; // in Minuten
- FlowRateAct = (Value - PreValue) / difference;
- lastvalue = currenttime;
-// std::string _zw = "CalcRate: " + std::to_string(FlowRateAct) + " TimeDifference[min]: " + std::to_string(difference);
-// _zw = _zw + " Value: " + std::to_string(Value) + " PreValue: " + std::to_string(PreValue);
-// LogFile.WriteToFile(_zw);
-
- if (ErrorMessageText.length() == 0)
- {
- PreValue = Value;
- ErrorMessageText = "no error";
- SavePreValue(Value, zwtime);
- }
+ SavePreValue();
return true;
}
-string ClassFlowPostProcessing::getReadout()
+string ClassFlowPostProcessing::getReadout(int _number)
{
- return ReturnValue;
+ return NUMBERS[_number]->ReturnValue;
}
-string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror)
+string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror, int _number)
{
if (_rawValue)
- return ReturnRawValue;
+ return NUMBERS[_number]->ReturnRawValue;
if (_noerror)
- return ReturnValueNoError;
- return ReturnValue;
+ return NUMBERS[_number]->ReturnValueNoError;
+ return NUMBERS[_number]->ReturnValue;
}
string ClassFlowPostProcessing::RundeOutput(float _in, int _anzNachkomma){
@@ -478,7 +614,7 @@ string ClassFlowPostProcessing::RundeOutput(float _in, int _anzNachkomma){
}
-string ClassFlowPostProcessing::ErsetzteN(string input)
+string ClassFlowPostProcessing::ErsetzteN(string input, float _prevalue)
{
int posN, posPunkt;
int pot, ziffer;
@@ -499,7 +635,7 @@ string ClassFlowPostProcessing::ErsetzteN(string input)
pot = posPunkt - posN;
}
- zw = PreValue / pow(10, pot);
+ zw =_prevalue / pow(10, pot);
ziffer = ((int) zw) % 10;
input[posN] = ziffer + 48;
@@ -509,7 +645,7 @@ string ClassFlowPostProcessing::ErsetzteN(string input)
return input;
}
-float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamshift, bool _isanalog){
+float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamshift, bool _isanalog, float _preValue){
int aktdigit, olddigit;
int aktdigit_before, olddigit_before;
int pot, pot_max;
@@ -527,12 +663,12 @@ float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamsh
{
zw = input / pow(10, pot-1);
aktdigit_before = ((int) zw) % 10;
- zw = PreValue / pow(10, pot-1);
+ zw = _preValue / pow(10, pot-1);
olddigit_before = ((int) zw) % 10;
zw = input / pow(10, pot);
aktdigit = ((int) zw) % 10;
- zw = PreValue / pow(10, pot);
+ zw = _preValue / pow(10, pot);
olddigit = ((int) zw) % 10;
no_nulldurchgang = (olddigit_before <= aktdigit_before);
@@ -558,18 +694,18 @@ float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamsh
return input;
}
-string ClassFlowPostProcessing::getReadoutRate()
+string ClassFlowPostProcessing::getReadoutRate(int _number)
{
- return std::to_string(FlowRateAct);
+ return std::to_string(NUMBERS[_number]->FlowRateAct);
}
-string ClassFlowPostProcessing::getReadoutTimeStamp()
+string ClassFlowPostProcessing::getReadoutTimeStamp(int _number)
{
- return timeStamp;
+ return NUMBERS[_number]->timeStamp;
}
-string ClassFlowPostProcessing::getReadoutError()
+string ClassFlowPostProcessing::getReadoutError(int _number)
{
- return ErrorMessageText;
+ return NUMBERS[_number]->ErrorMessageText;
}
diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h
index 8a115705..4e8858ec 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h
+++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h
@@ -1,58 +1,98 @@
#pragma once
#include "ClassFlow.h"
#include "ClassFlowMakeImage.h"
+#include "ClassFlowAnalog.h"
+#include "ClassFlowDigit.h"
+
#include
+struct NumberPost {
+// int PreValueAgeStartup;
+ float MaxRateValue;
+ bool useMaxRateValue;
+ bool ErrorMessage;
+ bool PreValueOkay;
+ bool AllowNegativeRates;
+ bool checkDigitIncreaseConsistency;
+ time_t lastvalue;
+ string timeStamp;
+ float FlowRateAct; // m3 / min
+ float PreValue; // letzter Wert, der gut ausgelesen wurde
+ float Value; // letzer ausgelesener Wert, inkl. Korrekturen
+ string ReturnRawValue; // Rohwert (mit N & führenden 0)
+ string ReturnValue; // korrigierter Rückgabewert, ggf. mit Fehlermeldung
+ string ReturnValueNoError; // korrigierter Rückgabewert ohne Fehlermeldung
+ string ErrorMessageText; // Fehlermeldung bei Consistency Check
+ int AnzahlAnalog;
+ int AnzahlDigital;
+ int DecimalShift;
+// ClassFlowAnalog* ANALOG;
+// ClassFlowDigit* DIGIT;
+
+ digit *digit_roi;
+ analog *analog_roi;
+
+
+
+ string name;
+};
+
+
class ClassFlowPostProcessing :
public ClassFlow
{
protected:
+ std::vector NUMBERS;
+ bool UpdatePreValueINI;
+
bool PreValueUse;
int PreValueAgeStartup;
- bool AllowNegativeRates;
- float MaxRateValue;
- bool useMaxRateValue;
+// bool AllowNegativeRates;
+// float MaxRateValue;
+// bool useMaxRateValue;
bool ErrorMessage;
- bool PreValueOkay;
- bool checkDigitIncreaseConsistency;
- int DecimalShift;
- time_t lastvalue;
- float FlowRateAct; // m3 / min
+ // bool PreValueOkay;
+// bool checkDigitIncreaseConsistency;
+// int DecimalShift;
+// time_t lastvalue;
+// float FlowRateAct; // m3 / min
+
+ ClassFlowAnalog* flowAnalog;
+ ClassFlowDigit* flowDigit;
string FilePreValue;
- float PreValue; // letzter Wert, der gut ausgelesen wurde
- float Value; // letzer ausgelesener Wert, inkl. Korrekturen
- string ReturnRawValue; // Rohwert (mit N & führenden 0)
- string ReturnValue; // korrigierter Rückgabewert, ggf. mit Fehlermeldung
- string ReturnValueNoError; // korrigierter Rückgabewert ohne Fehlermeldung
- string ErrorMessageText; // Fehlermeldung bei Consistency Check
- string timeStamp;
ClassFlowMakeImage *flowMakeImage;
bool LoadPreValue(void);
string ShiftDecimal(string in, int _decShift);
- string ErsetzteN(string);
- float checkDigitConsistency(float input, int _decilamshift, bool _isanalog);
+ string ErsetzteN(string, float _prevalue);
+ float checkDigitConsistency(float input, int _decilamshift, bool _isanalog, float _preValue);
string RundeOutput(float _in, int _anzNachkomma);
+ void InitNUMBERS();
+ void handleDecimalSeparator(string _decsep, string _value);
+
+
public:
ClassFlowPostProcessing(std::vector* lfc);
bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time);
- string getReadout();
- string getReadoutParam(bool _rawValue, bool _noerror);
- string getReadoutError();
- string getReadoutRate();
- string getReadoutTimeStamp();
- void SavePreValue(float value, string time = "");
- string GetPreValue();
+ string getReadout(int _number);
+ string getReadoutParam(bool _rawValue, bool _noerror, int _number = 0);
+ string getReadoutError(int _number = 0);
+ string getReadoutRate(int _number = 0);
+ string getReadoutTimeStamp(int _number = 0);
+ void SavePreValue();
+ string GetPreValue(std::string _number = "");
+ void SetPreValue(float zw, string _numbers);
+ std::vector GetNumbers(){return NUMBERS;};
string name(){return "ClassFlowPostProcessing";};
};
diff --git a/code/components/jomjol_helper/Helper.cpp b/code/components/jomjol_helper/Helper.cpp
index 0a32b30e..fdbd8644 100644
--- a/code/components/jomjol_helper/Helper.cpp
+++ b/code/components/jomjol_helper/Helper.cpp
@@ -10,6 +10,7 @@
#include
#include
+
#include "ClassLogFile.h"
//#include "ClassLogFile.h"
@@ -358,3 +359,30 @@ int removeFolder(const char* folderPath, const char* logTag) {
return deleted;
}
+
+
+
+std::vector HelperZerlegeZeile(std::string input, std::string _delimiter = "")
+{
+ std::vector Output;
+ std::string delimiter = " =,";
+ if (_delimiter.length() > 0){
+ delimiter = _delimiter;
+ }
+
+ input = trim(input, delimiter);
+ size_t pos = findDelimiterPos(input, delimiter);
+ std::string token;
+ while (pos != std::string::npos) {
+ token = input.substr(0, pos);
+ token = trim(token, delimiter);
+ Output.push_back(token);
+ input.erase(0, pos + 1);
+ input = trim(input, delimiter);
+ pos = findDelimiterPos(input, delimiter);
+ }
+ Output.push_back(input);
+
+ return Output;
+}
+
diff --git a/code/components/jomjol_helper/Helper.h b/code/components/jomjol_helper/Helper.h
index 5ecf2f5f..ac6cccae 100644
--- a/code/components/jomjol_helper/Helper.h
+++ b/code/components/jomjol_helper/Helper.h
@@ -1,6 +1,7 @@
#pragma once
#include
#include
+#include
using namespace std;
@@ -30,6 +31,8 @@ time_t addDays(time_t startTime, int days);
void memCopyGen(uint8_t* _source, uint8_t* _target, int _size);
+std::vector HelperZerlegeZeile(std::string input, std::string _delimiter);
+
///////////////////////////
size_t getInternalESPHeapSize();
size_t getESPHeapSize();
diff --git a/code/components/jomjol_tfliteclass/server_tflite.cpp b/code/components/jomjol_tfliteclass/server_tflite.cpp
index f29e384c..3859fd98 100644
--- a/code/components/jomjol_tfliteclass/server_tflite.cpp
+++ b/code/components/jomjol_tfliteclass/server_tflite.cpp
@@ -18,7 +18,7 @@
#include "ClassLogFile.h"
-//#define DEBUG_DETAIL_ON
+// #define DEBUG_DETAIL_ON
ClassFlowControll tfliteflow;
@@ -196,6 +196,8 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
bool _rawValue = false;
bool _noerror = false;
+ bool _all = false;
+ std::string _type = "value";
string zw;
printf("handler_wasserzaehler uri:\n"); printf(req->uri); printf("\n");
@@ -206,6 +208,22 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
{
// printf("Query: "); printf(_query); printf("\n");
+ if (httpd_query_key_value(_query, "all", _size, 10) == ESP_OK)
+ {
+#ifdef DEBUG_DETAIL_ON
+ printf("all is found"); printf(_size); printf("\n");
+#endif
+ _all = true;
+ }
+
+ if (httpd_query_key_value(_query, "type", _size, 10) == ESP_OK)
+ {
+#ifdef DEBUG_DETAIL_ON
+ printf("all is found"); printf(_size); printf("\n");
+#endif
+ _type = std::string(_size);
+ }
+
if (httpd_query_key_value(_query, "rawvalue", _size, 10) == ESP_OK)
{
#ifdef DEBUG_DETAIL_ON
@@ -222,6 +240,29 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
}
}
+ httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
+
+ if (_all)
+ {
+ httpd_resp_set_type(req, "text/plain");
+ printf("TYPE: %s\n", _type.c_str());
+ int _intype = READOUT_TYPE_VALUE;
+ if (_type == "prevalue")
+ _intype = READOUT_TYPE_PREVALUE;
+ if (_type == "raw")
+ _intype = READOUT_TYPE_RAWVALUE;
+ if (_type == "error")
+ _intype = READOUT_TYPE_ERROR;
+
+
+ zw = tfliteflow.getReadoutAll(_intype);
+ printf("ZW: %s\n", zw.c_str());
+ if (zw.length() > 0)
+ httpd_resp_sendstr_chunk(req, zw.c_str());
+ httpd_resp_sendstr_chunk(req, NULL);
+ return ESP_OK;
+ }
+
zw = tfliteflow.getReadout(_rawValue, _noerror);
if (zw.length() > 0)
httpd_resp_sendstr_chunk(req, zw.c_str());
@@ -498,6 +539,7 @@ esp_err_t handler_prevalue(httpd_req_t *req)
char _query[100];
char _size[10] = "";
+ char _numbers[50] = "default";
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
{
@@ -511,15 +553,24 @@ esp_err_t handler_prevalue(httpd_req_t *req)
printf("Value: "); printf(_size); printf("\n");
#endif
}
+
+ httpd_query_key_value(_query, "numbers", _numbers, 50);
}
if (strlen(_size) == 0)
- zw = tfliteflow.GetPrevalue();
+ {
+ zw = tfliteflow.GetPrevalue(std::string(_numbers));
+ }
else
- zw = "SetPrevalue to " + tfliteflow.UpdatePrevalue(_size);
+ {
+ zw = "SetPrevalue to " + tfliteflow.UpdatePrevalue(_size, _numbers);
+ }
resp_str = zw.c_str();
+ httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
+
+
httpd_resp_send(req, resp_str, strlen(resp_str));
/* Respond with an empty chunk to signal HTTP response completion */
httpd_resp_send_chunk(req, NULL, 0);
diff --git a/code/components/jomjol_wlan/read_wlanini.cpp b/code/components/jomjol_wlan/read_wlanini.cpp
index dcf28a47..f7c7299c 100644
--- a/code/components/jomjol_wlan/read_wlanini.cpp
+++ b/code/components/jomjol_wlan/read_wlanini.cpp
@@ -70,7 +70,7 @@ void LoadWlanFromFile(std::string fn, char *&_ssid, char *&_password, char *&_ho
zerlegt = ZerlegeZeile(line, "=");
zerlegt[0] = trim(zerlegt[0], " ");
for (int i = 2; i < zerlegt.size(); ++i)
- zerlegt[1] = zerlegt[1] + zerlegt[i];
+ zerlegt[1] = zerlegt[1] + "=" + zerlegt[i];
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "HOSTNAME")){
hostname = trim(zerlegt[1]);
diff --git a/code/main/server_main.cpp b/code/main/server_main.cpp
index ba31c09c..ac119e22 100644
--- a/code/main/server_main.cpp
+++ b/code/main/server_main.cpp
@@ -234,7 +234,7 @@ esp_err_t img_tmp_handler(httpd_req_t *req)
filetosend = filetosend + "/img_tmp/" + std::string(filename);
printf("File to upload: %s\n", filetosend.c_str());
- esp_err_t res = send_file(req, filetosend);
+ esp_err_t res = send_file(req, filetosend);
if (res != ESP_OK)
return res;
diff --git a/code/main/version.cpp b/code/main/version.cpp
index e4bb3dac..d726cb9a 100644
--- a/code/main/version.cpp
+++ b/code/main/version.cpp
@@ -1,4 +1,4 @@
-const char* GIT_REV="a000252";
+const char* GIT_REV="8308f15";
const char* GIT_TAG="";
-const char* GIT_BRANCH="master";
-const char* BUILD_TIME="2021-05-28 19:54";
\ No newline at end of file
+const char* GIT_BRANCH="rolling";
+const char* BUILD_TIME="2021-06-05 09:51";
\ No newline at end of file
diff --git a/code/platformio.ini b/code/platformio.ini
index 50bf0706..be60a9b8 100644
--- a/code/platformio.ini
+++ b/code/platformio.ini
@@ -37,5 +37,7 @@ lib_deps =
jomjol_controlGPIO
monitor_speed = 115200
+monitor_rts = 0
+monitor_dtr = 0
debug_tool = esp-prog
diff --git a/code/sdkconfig.old b/code/sdkconfig.old
index 757645d9..bb4711dd 100644
--- a/code/sdkconfig.old
+++ b/code/sdkconfig.old
@@ -131,8 +131,8 @@ CONFIG_EXAMPLE_CONNECT_IPV6=y
#
# Compiler options
#
-CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
-# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set
+# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set
+CONFIG_COMPILER_OPTIMIZATION_SIZE=y
# CONFIG_COMPILER_OPTIMIZATION_PERF is not set
# CONFIG_COMPILER_OPTIMIZATION_NONE is not set
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
@@ -165,6 +165,8 @@ CONFIG_APPTRACE_LOCK_ENABLE=y
#
# CONFIG_BT_ENABLED is not set
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0
+CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0
+CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0
CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=0
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0
@@ -204,6 +206,12 @@ CONFIG_SPI_MASTER_ISR_IN_IRAM=y
CONFIG_SPI_SLAVE_ISR_IN_IRAM=y
# end of SPI configuration
+#
+# CAN configuration
+#
+# CONFIG_CAN_ISR_IN_IRAM is not set
+# end of CAN configuration
+
#
# UART configuration
#
@@ -239,6 +247,7 @@ CONFIG_ESP_TLS_USING_MBEDTLS=y
#
# ESP32-specific
#
+CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y
CONFIG_ESP32_REV_MIN_0=y
# CONFIG_ESP32_REV_MIN_1 is not set
# CONFIG_ESP32_REV_MIN_2 is not set
@@ -598,7 +607,6 @@ CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set
# CONFIG_FREERTOS_DEBUG_INTERNALS is not set
-CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set
CONFIG_FREERTOS_DEBUG_OCDAWARE=y
@@ -657,8 +665,10 @@ CONFIG_LWIP_SO_REUSE=y
CONFIG_LWIP_SO_REUSE_RXTOALL=y
# CONFIG_LWIP_SO_RCVBUF is not set
# CONFIG_LWIP_NETBUF_RECVINFO is not set
-CONFIG_LWIP_IP_FRAG=y
-# CONFIG_LWIP_IP_REASSEMBLY is not set
+CONFIG_LWIP_IP4_FRAG=y
+CONFIG_LWIP_IP6_FRAG=y
+# CONFIG_LWIP_IP4_REASSEMBLY is not set
+# CONFIG_LWIP_IP6_REASSEMBLY is not set
# CONFIG_LWIP_STATS is not set
# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set
CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
@@ -682,8 +692,10 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8
#
# TCP
#
+CONFIG_LWIP_TCP_ISN_HOOK=y
CONFIG_LWIP_MAX_ACTIVE_TCP=16
CONFIG_LWIP_MAX_LISTENING_TCP=16
+CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y
CONFIG_LWIP_TCP_MAXRTX=12
CONFIG_LWIP_TCP_SYNMAXRTX=6
CONFIG_LWIP_TCP_MSS=1440
@@ -698,6 +710,7 @@ CONFIG_LWIP_TCP_QUEUE_OOSEQ=y
CONFIG_LWIP_TCP_OVERSIZE_MSS=y
# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set
# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set
+CONFIG_LWIP_TCP_RTO_TIME=1500
# end of TCP
#
@@ -713,6 +726,8 @@ CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set
CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF
# CONFIG_LWIP_PPP_SUPPORT is not set
+CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3
+CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5
#
# ICMP
@@ -906,6 +921,7 @@ CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y
CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y
CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20
CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1
+# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set
#
# Auto-detect flash chips
@@ -913,6 +929,8 @@ CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1
CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y
CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y
# end of Auto-detect flash chips
+
+CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y
# end of SPI Flash driver
#
@@ -996,6 +1014,8 @@ CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30
#
CONFIG_WPA_MBEDTLS_CRYPTO=y
# CONFIG_WPA_TLS_V12 is not set
+# CONFIG_WPA_WPS_WARS is not set
+# CONFIG_WPA_DEBUG_PRINT is not set
# end of Supplicant
#
@@ -1020,3 +1040,152 @@ CONFIG_CAMERA_CORE0=y
#
# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set
# end of Compatibility options
+
+# Deprecated options for backward compatibility
+CONFIG_TOOLPREFIX="xtensa-esp32-elf-"
+# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set
+# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set
+# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set
+CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y
+# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set
+# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set
+CONFIG_LOG_BOOTLOADER_LEVEL=3
+# CONFIG_APP_ROLLBACK_ENABLE is not set
+# CONFIG_FLASH_ENCRYPTION_ENABLED is not set
+# CONFIG_FLASHMODE_QIO is not set
+# CONFIG_FLASHMODE_QOUT is not set
+CONFIG_FLASHMODE_DIO=y
+# CONFIG_FLASHMODE_DOUT is not set
+# CONFIG_MONITOR_BAUD_9600B is not set
+# CONFIG_MONITOR_BAUD_57600B is not set
+CONFIG_MONITOR_BAUD_115200B=y
+# CONFIG_MONITOR_BAUD_230400B is not set
+# CONFIG_MONITOR_BAUD_921600B is not set
+# CONFIG_MONITOR_BAUD_2MB is not set
+# CONFIG_MONITOR_BAUD_OTHER is not set
+CONFIG_MONITOR_BAUD_OTHER_VAL=115200
+CONFIG_MONITOR_BAUD=115200
+# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set
+CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y
+CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y
+# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set
+# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set
+# CONFIG_CXX_EXCEPTIONS is not set
+CONFIG_STACK_CHECK_NONE=y
+# CONFIG_STACK_CHECK_NORM is not set
+# CONFIG_STACK_CHECK_STRONG is not set
+# CONFIG_STACK_CHECK_ALL is not set
+# CONFIG_WARN_WRITE_STRINGS is not set
+# CONFIG_DISABLE_GCC8_WARNINGS is not set
+# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set
+CONFIG_ESP32_APPTRACE_DEST_NONE=y
+CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
+CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=0
+CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0
+CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0
+CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0
+CONFIG_ADC2_DISABLE_DAC=y
+CONFIG_SPIRAM_SUPPORT=y
+# CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is not set
+CONFIG_TRACEMEM_RESERVE_DRAM=0x0
+# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set
+CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y
+CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4
+# CONFIG_ULP_COPROC_ENABLED is not set
+CONFIG_ULP_COPROC_RESERVE_MEM=0
+CONFIG_BROWNOUT_DET=y
+CONFIG_BROWNOUT_DET_LVL_SEL_0=y
+# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set
+# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set
+# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set
+# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set
+# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set
+# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set
+# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set
+CONFIG_BROWNOUT_DET_LVL=0
+CONFIG_REDUCE_PHY_TX_POWER=y
+CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y
+# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set
+# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set
+# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set
+# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set
+# CONFIG_NO_BLOBS is not set
+# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set
+CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32
+CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304
+CONFIG_MAIN_TASK_STACK_SIZE=3584
+CONFIG_IPC_TASK_STACK_SIZE=1024
+CONFIG_TIMER_TASK_STACK_SIZE=3584
+CONFIG_CONSOLE_UART_DEFAULT=y
+# CONFIG_CONSOLE_UART_CUSTOM is not set
+# CONFIG_CONSOLE_UART_NONE is not set
+CONFIG_CONSOLE_UART_NUM=0
+CONFIG_CONSOLE_UART_BAUDRATE=115200
+CONFIG_INT_WDT=y
+CONFIG_INT_WDT_TIMEOUT_MS=300
+CONFIG_INT_WDT_CHECK_CPU1=y
+CONFIG_TASK_WDT=y
+# CONFIG_TASK_WDT_PANIC is not set
+CONFIG_TASK_WDT_TIMEOUT_S=3
+CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
+CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
+# CONFIG_EVENT_LOOP_PROFILING is not set
+CONFIG_POST_EVENTS_FROM_ISR=y
+CONFIG_POST_EVENTS_FROM_IRAM_ISR=y
+CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150
+CONFIG_MB_MASTER_DELAY_MS_CONVERT=200
+CONFIG_MB_QUEUE_LENGTH=20
+CONFIG_MB_SERIAL_TASK_STACK_SIZE=2048
+CONFIG_MB_SERIAL_BUF_SIZE=256
+CONFIG_MB_SERIAL_TASK_PRIO=10
+# CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT is not set
+CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20
+CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20
+CONFIG_MB_CONTROLLER_STACK_SIZE=4096
+CONFIG_MB_EVENT_QUEUE_TIMEOUT=20
+CONFIG_MB_TIMER_PORT_ENABLED=y
+CONFIG_MB_TIMER_GROUP=0
+CONFIG_MB_TIMER_INDEX=0
+CONFIG_SUPPORT_STATIC_ALLOCATION=y
+# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set
+CONFIG_TIMER_TASK_PRIORITY=1
+CONFIG_TIMER_TASK_STACK_DEPTH=2048
+CONFIG_TIMER_QUEUE_LENGTH=10
+# CONFIG_L2_TO_L3_COPY is not set
+# CONFIG_USE_ONLY_LWIP_SELECT is not set
+CONFIG_ESP_GRATUITOUS_ARP=y
+CONFIG_GARP_TMR_INTERVAL=60
+CONFIG_TCPIP_RECVMBOX_SIZE=32
+CONFIG_TCP_MAXRTX=12
+CONFIG_TCP_SYNMAXRTX=6
+CONFIG_TCP_MSS=1440
+CONFIG_TCP_MSL=60000
+CONFIG_TCP_SND_BUF_DEFAULT=5744
+CONFIG_TCP_WND_DEFAULT=5744
+CONFIG_TCP_RECVMBOX_SIZE=6
+CONFIG_TCP_QUEUE_OOSEQ=y
+# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set
+CONFIG_TCP_OVERSIZE_MSS=y
+# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set
+# CONFIG_TCP_OVERSIZE_DISABLE is not set
+CONFIG_UDP_RECVMBOX_SIZE=6
+CONFIG_TCPIP_TASK_STACK_SIZE=3072
+CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
+# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set
+# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set
+CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF
+# CONFIG_PPP_SUPPORT is not set
+CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5
+CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
+CONFIG_ESP32_PTHREAD_STACK_MIN=768
+CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y
+# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set
+# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set
+CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1
+CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread"
+CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y
+# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set
+# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set
+# CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT is not set
+CONFIG_SUPPORT_TERMIOS=y
+# End of deprecated options
diff --git a/code/version.cpp b/code/version.cpp
index 499917b1..d726cb9a 100644
--- a/code/version.cpp
+++ b/code/version.cpp
@@ -1,4 +1,4 @@
-const char* GIT_REV="a000252";
+const char* GIT_REV="8308f15";
const char* GIT_TAG="";
-const char* GIT_BRANCH="master";
-const char* BUILD_TIME="2021-05-28 19:53";
\ No newline at end of file
+const char* GIT_BRANCH="rolling";
+const char* BUILD_TIME="2021-06-05 09:51";
\ No newline at end of file
diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin
index 1ec39263..a20e7978 100644
Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ
diff --git a/firmware/firmware.bin b/firmware/firmware.bin
index b1346232..242ce28c 100644
Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ
diff --git a/firmware/html.zip b/firmware/html.zip
index d5078f8b..3fc4deee 100644
Binary files a/firmware/html.zip and b/firmware/html.zip differ
diff --git a/sd-card/config/config.ini b/sd-card/config/config.ini
index 9e06820d..6709a972 100644
--- a/sd-card/config/config.ini
+++ b/sd-card/config/config.ini
@@ -18,7 +18,7 @@ InitialMirror= false
AlignmentAlgo = Default
[Digits]
-Model = /config/dig0870s3q.tflite
+Model = /config/dig0901s1q.tflite
;LogImageLocation = /log/digit
;LogfileRetentionInDays = 3
ModelInputSize = 20 32
diff --git a/sd-card/config/dig0900s1q.tflite b/sd-card/config/dig0900s1q.tflite
new file mode 100644
index 00000000..83f7d055
Binary files /dev/null and b/sd-card/config/dig0900s1q.tflite differ
diff --git a/sd-card/config/dig0901s1q.tflite b/sd-card/config/dig0901s1q.tflite
new file mode 100644
index 00000000..d4780032
Binary files /dev/null and b/sd-card/config/dig0901s1q.tflite differ
diff --git a/sd-card/html/edit_alignment.html b/sd-card/html/edit_alignment.html
index 96d0e302..8fa933fb 100644
--- a/sd-card/html/edit_alignment.html
+++ b/sd-card/html/edit_alignment.html
@@ -61,7 +61,7 @@ select {
- Storage Path/Name: |
+ Storage Path/Name: |
| x: |
@@ -90,9 +90,8 @@ select {
-
-
+
-
-
-
-
+
+
+
+
diff --git a/sd-card/html/edit_config_param.html b/sd-card/html/edit_config_param.html
index 867ba103..574c2ee9 100644
--- a/sd-card/html/edit_config_param.html
+++ b/sd-card/html/edit_config_param.html
@@ -362,20 +362,6 @@ textarea {
PostProcessing |
-
- |
-
- |
-
- DecimalShift
- |
-
-
- |
-
- shift the digit separator within the digital digits (positiv and negativ)
- |
-
|
@@ -473,6 +459,34 @@ textarea {
|
+
+
+
+ Postprocessing Individual Paramters:
+
+ |
+
+
+ |
+
+ |
+
+ DecimalShift
+ |
+
+
+ |
+
+ shift the digit separator within the digital digits (positiv and negativ)
+ |
+
+
+
+
MQTT |
@@ -730,6 +744,8 @@ textarea {
basepath = "http://192.168.178.22";
param;
category;
+ NUNBERSAkt = -1;
+ NUMBERS;
function LoadConfigNeu() {
@@ -749,12 +765,32 @@ function LoadConfigNeu() {
loadConfig(basepath);
ParseConfig();
param = getConfigParameters();
- category = getConfigCategory();
+ category = getConfigCategory();
+ InitIndivParameter();
+
UpdateInput();
+ UpdateInputIndividual();
UpdateExpertModus();
document.getElementById("divall").style.display = '';
}
+function InitIndivParameter()
+{
+ NUMBERS = getNUMBERInfo();
+
+ var _index = document.getElementById("Numbers_value1");
+ while (_index.length)
+ _index.remove(0);
+
+ for (var i = 0; i < NUMBERS.length; ++i){
+ var option = document.createElement("option");
+ option.text = NUMBERS[i]["name"];
+ option.value = i;
+ _index.add(option);
+ }
+ _index.selectedIndex = 0;
+}
+
function getParameterByName(name, url = window.location.href) {
name = name.replace(/[\[\]]/g, '\\$&');
@@ -765,43 +801,78 @@ function getParameterByName(name, url = window.location.href) {
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
-function WriteParameter(_param, _category, _cat, _name, _optional, _select = false, _anzpara = 1){
- if (_param[_cat][_name]["found"]){
- if (_optional) {
- document.getElementById(_cat+"_"+_name+"_enabled").checked = _param[_cat][_name]["enabled"];
- for (var j = 1; j <= _anzpara; ++j) {
- document.getElementById(_cat+"_"+_name+"_value"+j).disabled = !_param[_cat][_name]["enabled"];
- }
- }
- document.getElementById(_cat+"_"+_name+"_text").style="color:black;"
- if (_select) {
- var textToFind = _param[_cat][_name]["value1"];
- var dd = document.getElementById(_cat+"_"+_name+"_value1");
- for (var i = 0; i < dd.options.length; i++) {
- if (dd.options[i].text.toLowerCase() === textToFind.toLowerCase()) {
- dd.selectedIndex = i;
- break;
+function WriteParameter(_param, _category, _cat, _name, _optional, _select = false, _anzpara = 1, _number = -1){
+ if (_number > -1)
+ {
+ if (NUMBERS[_number][_cat][_name]["found"]){
+ if (_optional) {
+ document.getElementById(_cat+"_"+_name+"_enabled").checked = _param[_cat][_name]["enabled"];
+ for (var j = 1; j <= _anzpara; ++j)
+ document.getElementById(_cat+"_"+_name+"_value"+j).disabled = NUMBERS[_number][_cat][_name]["enabled"];
+ }
+ document.getElementById(_cat+"_"+_name+"_text").style="color:black;"
+ if (_select) {
+ var textToFind;
+ textToFind = NUMBERS[_number][_cat][_name]["value1"];
+ var dd = document.getElementById(_cat+"_"+_name+"_value1");
+ for (var i = 0; i < dd.options.length; i++) {
+ if (dd.options[i].text.toLowerCase() === textToFind.toLowerCase()) {
+ dd.selectedIndex = i;
+ break;
+ }
}
}
+ else {
+ for (var j = 1; j <= _anzpara; ++j)
+ document.getElementById(_cat+"_"+_name+"_value"+j).value = NUMBERS[_number][_cat][_name]["value"+j];
+ }
}
else {
- for (var j = 1; j <= _anzpara; ++j) {
- document.getElementById(_cat+"_"+_name+"_value"+j).value = _param[_cat][_name]["value"+j];
+ if (_optional) {
+ document.getElementById(_cat+"_"+_name+"_enabled").disabled = true;
+ for (var j = 1; j <= _anzpara; ++j) {
+ document.getElementById(_cat+"_"+_name+"_value"+j).disabled = true;
+ }
+ }
+ document.getElementById(_cat+"_"+_name+"_text").style="color:lightgrey;"
+ }
+ }
+ else
+ {
+ if (_param[_cat][_name]["found"]){
+ if (_optional) {
+ document.getElementById(_cat+"_"+_name+"_enabled").checked = _param[_cat][_name]["enabled"];
+ for (var j = 1; j <= _anzpara; ++j)
+ document.getElementById(_cat+"_"+_name+"_value"+j).disabled = !_param[_cat][_name]["enabled"];
+ }
+ document.getElementById(_cat+"_"+_name+"_text").style="color:black;"
+ if (_select) {
+ var textToFind;
+ textToFind = _param[_cat][_name]["value1"];
+ var dd = document.getElementById(_cat+"_"+_name+"_value1");
+ for (var i = 0; i < dd.options.length; i++) {
+ if (dd.options[i].text.toLowerCase() === textToFind.toLowerCase()) {
+ dd.selectedIndex = i;
+ break;
+ }
+ }
+ }
+ else {
+ for (var j = 1; j <= _anzpara; ++j)
+ document.getElementById(_cat+"_"+_name+"_value"+j).value = _param[_cat][_name]["value"+j];
}
}
-
- }
- else {
- if (_optional) {
- document.getElementById(_cat+"_"+_name+"_enabled").disabled = true;
- for (var j = 1; j <= _anzpara; ++j) {
- document.getElementById(_cat+"_"+_name+"_value"+j).disabled = true;
- }
+ else {
+ if (_optional) {
+ document.getElementById(_cat+"_"+_name+"_enabled").disabled = true;
+ for (var j = 1; j <= _anzpara; ++j) {
+ document.getElementById(_cat+"_"+_name+"_value"+j).disabled = true;
+ }
+ }
+ document.getElementById(_cat+"_"+_name+"_text").style="color:lightgrey;"
}
- document.getElementById(_cat+"_"+_name+"_text").style="color:lightgrey;"
}
-
///////////////// am Ende, falls Kategorie als gesamtes nicht ausgewählt --> deaktivieren
if (_category[_cat]["enabled"] == false)
{
@@ -813,6 +884,7 @@ function WriteParameter(_param, _category, _cat, _name, _optional, _select = fal
}
document.getElementById(_cat+"_"+_name+"_text").style="color:lightgrey;"
}
+
EnDisableItem(_category[_cat]["enabled"], _param, _category, _cat, _name, _optional);
}
@@ -843,7 +915,7 @@ function InvertEnableItem(_cat, _param)
}
-function EnDisableItem(_status, _param, _category, _cat, _name, _optional)
+function EnDisableItem(_status, _param, _category, _cat, _name, _optional, _number = -1)
{
_status = _param[_cat][_name]["found"] && _category[_cat]["enabled"];
@@ -857,10 +929,18 @@ function EnDisableItem(_status, _param, _category, _cat, _name, _optional)
document.getElementById(_cat+"_"+_name+"_enabled").style=_color;
}
- if (!_param[_cat][_name]["enabled"]) {
- _status = false;
- _color = "color:lightgrey;";
+ if (_number == -1){
+ if (!_param[_cat][_name]["enabled"]) {
+ _status = false;
+ _color = "color:lightgrey;";
+ }
}
+ else
+ if (!NUMBERS[_number][_cat][_name]["enabled"]) {
+ _status = false;
+ _color = "color:lightgrey;";
+ }
+
document.getElementById(_cat+"_"+_name+"_text").disabled = !_status;
document.getElementById(_cat+"_"+_name+"_text").style = _color;
@@ -877,21 +957,58 @@ function EnDisableItem(_status, _param, _category, _cat, _name, _optional)
}
-function ReadParameter(_param, _cat, _name, _optional, _select = false){
- if (_param[_cat][_name]["found"]){
- if (_optional) {
- _param[_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
- }
- if (_select) {
- var sel = document.getElementById(_cat+"_"+_name+"_value1");
- _param[_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
- }
- else {
- for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
- _param[_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
+function ReadParameter(_param, _cat, _name, _optional, _select = false, _number = -1){
+ if (_number > -1)
+ {
+ if (_cat == "Digits")
+ _cat = "digit"
+ if (_cat == "Analog")
+ _cat = "analog"
+
+ if (NUMBERS[_number][_cat][_name]["found"]){
+ if (_optional) {
+ NUMBERS[_number][_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
+ }
+ if (_select) {
+ var sel = document.getElementById(_cat+"_"+_name+"_value1");
+ NUMBERS[_number][_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
+ }
+ else {
+ for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
+ NUMBERS[_number][_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
+ }
}
}
}
+ else
+ {
+ if (_param[_cat][_name]["found"]){
+ if (_optional) {
+ _param[_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
+ }
+ if (_select) {
+ var sel = document.getElementById(_cat+"_"+_name+"_value1");
+ _param[_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
+ }
+ else {
+ for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
+ _param[_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
+ }
+ }
+ }
+ }
+}
+
+function UpdateInputIndividual()
+{
+ if (NUNBERSAkt != -1)
+ {
+ ReadParameter(param, "PostProcessing", "DecimalShift", true, false, NUNBERSAkt)
+ }
+
+ var sel = document.getElementById("Numbers_value1");
+ NUNBERSAkt = sel.selectedIndex;
+ WriteParameter(param, category, "PostProcessing", "DecimalShift", true, false, 1, NUNBERSAkt);
}
function UpdateInput() {
@@ -924,7 +1041,6 @@ function UpdateInput() {
WriteParameter(param, category, "Analog", "ExtendedResolution", true, true);
WriteParameter(param, category, "Analog", "ModelInputSize", false, false, 2);
- WriteParameter(param, category, "PostProcessing", "DecimalShift", true);
WriteParameter(param, category, "PostProcessing", "PreValueUse", true, true);
WriteParameter(param, category, "PostProcessing", "PreValueAgeStartup", true);
WriteParameter(param, category, "PostProcessing", "AllowNegativeRates", true, true);
@@ -975,15 +1091,14 @@ function ReadParameterAll()
ReadParameter(param, "Digits", "Model", false);
ReadParameter(param, "Digits", "LogImageLocation", true);
ReadParameter(param, "Digits", "LogfileRetentionInDays", true);
- ReadParameter(param, "Digits", "ModelInputSize", false, false, 2);
+ ReadParameter(param, "Digits", "ModelInputSize", false, false);
ReadParameter(param, "Analog", "Model", false);
ReadParameter(param, "Analog", "LogImageLocation", true);
ReadParameter(param, "Analog", "LogfileRetentionInDays", true);
ReadParameter(param, "Analog", "ExtendedResolution", true, true);
- ReadParameter(param, "Analog", "ModelInputSize", false, false, 2);
+ ReadParameter(param, "Analog", "ModelInputSize", false, false);
- ReadParameter(param, "PostProcessing", "DecimalShift", true);
ReadParameter(param, "PostProcessing", "PreValueUse", true, true);
ReadParameter(param, "PostProcessing", "PreValueAgeStartup", true);
ReadParameter(param, "PostProcessing", "AllowNegativeRates", true, true);
@@ -1009,6 +1124,8 @@ function ReadParameterAll()
ReadParameter(param, "System", "TimeZone", true);
ReadParameter(param, "System", "Hostname", true);
ReadParameter(param, "System", "TimeServer", true);
+
+ UpdateInputIndividual();
FormatDecimalValue(param, "PostProcessing", "MaxRateValue");
}
@@ -1031,6 +1148,7 @@ function UpdateAfterCategoryCheck() {
category["Analog"]["enabled"] = document.getElementById("Category_Analog_enabled").checked;
category["Digits"]["enabled"] = document.getElementById("Category_Digits_enabled").checked;
UpdateInput();
+ UpdateInputIndividual();
}
function UpdateExpertModus()
@@ -1055,9 +1173,13 @@ function UpdateExpertModus()
function saveTextAsFile()
{
if (confirm("Are you sure you want to update \"config.ini\"?")) {
- var textToSave = WriteConfig();
- FileDeleteOnServer("/config/config.ini", basepath);
- FileSendContent(textToSave, "/config/config.ini", basepath);
+ ReadParameterAll();
+ WriteConfigININew();
+ SaveConfigToServer(basepath);
+
+// var textToSave = WriteConfig();
+// FileDeleteOnServer("/config/config.ini", basepath);
+// FileSendContent(textToSave, "/config/config.ini", basepath);
}
}
@@ -1080,6 +1202,11 @@ function editConfigDirect() {
window.location.replace(stringota);
}
}
+
+function numberChanged()
+{
+ UpdateInputIndividual();
+}
LoadConfigNeu();
diff --git a/sd-card/html/edit_digits.html b/sd-card/html/edit_digits.html
index 647850ed..26f09a9d 100644
--- a/sd-card/html/edit_digits.html
+++ b/sd-card/html/edit_digits.html
@@ -59,6 +59,21 @@ th, td {
Edit Digits
+
+
+
@@ -67,6 +82,9 @@ th, td {
-
-
+
+
+
+Current
+
+
+ |
+ Last restart:
+ |
+
+
+
+
+ |
+
+
+
+
+
Host Info
+
diff --git a/sd-card/html/prevalue_set.html b/sd-card/html/prevalue_set.html
index 87fa5f8d..fa599f3b 100644
--- a/sd-card/html/prevalue_set.html
+++ b/sd-card/html/prevalue_set.html
@@ -36,33 +36,23 @@ input[type=number] {
-
-
-
-
-
Set the previous value for consistency check and substitution for NaN
+Choose Number:
+
+
+
+
- Current Value:
+ Current Value:
-
-
- Set Value:
+ Set Value:
Input (Format = 123.456):
PreValue:
Set PreValue
- Result:
+ Result:
- |