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_
deleted file mode 100644
index 08a29be7..00000000
--- a/code/components/jomjol_flowcontroll/ClassFlowAnalog._h_
+++ /dev/null
@@ -1,48 +0,0 @@
-#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/ClassFlowMQTT.cpp b/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp
index 54a11004..4748b0d7 100644
--- a/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp
+++ b/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp
@@ -174,6 +174,15 @@ bool ClassFlowMQTT::doFlow(string zwtime)
zw = namenumber + "timestamp";
MQTTPublish(zw, resulttimestamp);
+
+
+ std::string json="{\"value\":"+result;
+ json += ",\"error\":\""+resulterror;
+ json += "\",\"rate\":"+resultrate;
+ json += ",\"timestamp\":\""+resulttimestamp+"\"}";
+
+ zw = namenumber + "json";
+ MQTTPublish(zw, json);
}
}
else
diff --git a/code/main/server_main.cpp b/code/main/server_main.cpp
index 79b405e7..de2683e3 100644
--- a/code/main/server_main.cpp
+++ b/code/main/server_main.cpp
@@ -406,7 +406,8 @@ httpd_handle_t start_webserver(void)
config.global_transport_ctx = NULL;
config.global_transport_ctx_free_fn = NULL;
config.open_fn = NULL;
- config.close_fn = NULL;
+ config.close_fn = NULL;
+ config.lru_purge_enable = true; // neu, um schlechte Serverbindung zu verhindern
// config.uri_match_fn = NULL;
config.uri_match_fn = httpd_uri_match_wildcard;
diff --git a/code/main/version.cpp b/code/main/version.cpp
index c52e97ed..357a686b 100644
--- a/code/main/version.cpp
+++ b/code/main/version.cpp
@@ -1,4 +1,4 @@
-const char* GIT_REV="5414a4c";
+const char* GIT_REV="08b0b25";
const char* GIT_TAG="";
const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-07-07 22:14";
\ No newline at end of file
+const char* BUILD_TIME="2021-07-08 21:42";
diff --git a/code/version.cpp b/code/version.cpp
index c52e97ed..357a686b 100644
--- a/code/version.cpp
+++ b/code/version.cpp
@@ -1,4 +1,4 @@
-const char* GIT_REV="5414a4c";
+const char* GIT_REV="08b0b25";
const char* GIT_TAG="";
const char* GIT_BRANCH="rolling";
-const char* BUILD_TIME="2021-07-07 22:14";
\ No newline at end of file
+const char* BUILD_TIME="2021-07-08 21:42";
diff --git a/sd-card/config/config.ini b/sd-card/config/config.ini
index 4d5a14a3..7cbcc5ec 100644
--- a/sd-card/config/config.ini
+++ b/sd-card/config/config.ini
@@ -20,7 +20,7 @@ AlignmentAlgo = Default
/config/ref1.jpg 442 142
[Digits]
-Model = /config/dig1030s1q.tflite
+Model = /config/dig1040s1q.tflite
;LogImageLocation = /log/digit
;LogfileRetentionInDays = 3
ModelInputSize = 20 32
@@ -29,7 +29,7 @@ main.digit2 340 120 37 67
main.digit3 389 120 37 67
[Analog]
-Model = /config/ana0630s2.tflite
+Model = /config/ana0700s1lq.tflite
;LogImageLocation = /log/analog
;LogfileRetentionInDays = 3
ModelInputSize = 32 32
diff --git a/sd-card/config/dig1040s1q.tflite b/sd-card/config/dig1040s1q.tflite
new file mode 100644
index 00000000..30fcb4d8
Binary files /dev/null and b/sd-card/config/dig1040s1q.tflite differ
diff --git a/sd-card/html/edit_analog.html b/sd-card/html/edit_analog.html
index b5d421bc..e9a0d55d 100644
--- a/sd-card/html/edit_analog.html
+++ b/sd-card/html/edit_analog.html
@@ -447,6 +447,26 @@ function removeNumber(){
context.drawImage(imageObj, 0, 0);
if (document.getElementById("Category_Analog_enabled").checked)
{
+ var sel = document.getElementById("index");
+ var _number = sel.selectedIndex;
+ for (var _nb = 0; _nb < ROIInfo.length; _nb++)
+ {
+ if (_nb != _number)
+ {
+ lw = 1;
+ context.lineWidth = lw;
+ context.strokeStyle = "#990000";
+ var x0 = parseInt(ROIInfo[_nb].x) - parseInt(lw/2);
+ var y0 = parseInt(ROIInfo[_nb].y) - parseInt(lw/2);
+ var dx = parseInt(ROIInfo[_nb].dx) + parseInt(lw);
+ var dy = parseInt(ROIInfo[_nb].dy) + parseInt(lw);
+ context.strokeRect(x0, y0, dx, dy);
+ }
+
+ }
+
+
+
lw = 4
context.lineWidth = lw;
context.strokeStyle = "#FF0000";
diff --git a/sd-card/html/edit_digits.html b/sd-card/html/edit_digits.html
index d15bdb3e..39f0ed67 100644
--- a/sd-card/html/edit_digits.html
+++ b/sd-card/html/edit_digits.html
@@ -439,6 +439,24 @@ function draw() {
context.drawImage(imageObj, 0, 0);
if (document.getElementById("Category_Digits_enabled").checked)
{
+ var sel = document.getElementById("index");
+ var _number = sel.selectedIndex;
+ for (var _nb = 0; _nb < ROIInfo.length; _nb++)
+ {
+ if (_nb != _number)
+ {
+ lw = 2;
+ context.lineWidth = lw;
+ context.strokeStyle = "#990000";
+ var x0 = parseInt(ROIInfo[_nb].x) - parseInt(lw/2);
+ var y0 = parseInt(ROIInfo[_nb].y) - parseInt(lw/2);
+ var dx = parseInt(ROIInfo[_nb].dx) + parseInt(lw);
+ var dy = parseInt(ROIInfo[_nb].dy) + parseInt(lw);
+ context.strokeRect(x0, y0, dx, dy);
+ }
+
+ }
+
lw = 4
context.lineWidth = lw;
context.strokeStyle = "#FF0000";
diff --git a/sd-card/html/explain_3.html b/sd-card/html/explain_3.html
index 077a6a9e..ff1ae887 100644
--- a/sd-card/html/explain_3.html
+++ b/sd-card/html/explain_3.html
@@ -22,7 +22,7 @@ p {font-size: 1em;}
Define Digits
-Here you define your digits you want to read.
+Here you define your digits you want to read. If you have more than one number on the reading you can define several numbers with the "Number" selector. There you can also define new numbers.
With the drop down menue "ROI x" you can change between the different digits. Mark them with the mouse or the coordinates.
diff --git a/sd-card/html/explain_4.html b/sd-card/html/explain_4.html
index 546376a3..862bfaf9 100644
--- a/sd-card/html/explain_4.html
+++ b/sd-card/html/explain_4.html
@@ -22,7 +22,7 @@ p {font-size: 1em;}
Define Digits
-Here you define your analog counters you want to read. If you do not have analog counters delete all ROIs.
+Here you define your analog counters you want to read. If you have more than one number on the reading you can define several numbers with the "Number" selector. There you can also define new numbers. If you do not have analog counters delete all ROIs.
With the drop down menue "ROI x" you can change between the different counters. Mark them with the mouse or the coordinates.
diff --git a/sd-card/html/version.txt b/sd-card/html/version.txt
index 47da986f..deeb3d66 100644
--- a/sd-card/html/version.txt
+++ b/sd-card/html/version.txt
@@ -1 +1 @@
-9.1.0
+9.2.0