Update Rolling

This commit is contained in:
jomjol
2021-01-17 12:44:20 +01:00
parent 9bb715fcb2
commit c65de27e9d
21 changed files with 248 additions and 94 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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