update noerror=true

This commit is contained in:
jomjol
2020-09-10 17:38:05 +02:00
parent ac3edc9bec
commit 186a500a1e
9 changed files with 19 additions and 7 deletions

View File

@@ -31,9 +31,10 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
##### Rolling - (2020-09-10) ##### Rolling - (2020-09-10)
* additional parameter in `wasserzahler.html?noerror=true` to suppress an potential error message in case of consitency check (is equal to `ErrorMessage` = False in `config.ini`)
* update ROI-configurator, in case of no ROIs defined * update ROI-configurator, in case of no ROIs defined
2020-09-10 2020-09-09
* Update to new and modern layout (thanks to michaeljoos in iobroker-thread) * Update to new and modern layout (thanks to michaeljoos in iobroker-thread)
* incorporated "Take Picture" to make new reference image * incorporated "Take Picture" to make new reference image

View File

@@ -157,10 +157,10 @@ bool ClassFlowControll::doFlow(string time)
return result; return result;
} }
string ClassFlowControll::getReadout(bool _rawvalue = false) string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false)
{ {
if (flowpostprocessing) if (flowpostprocessing)
return flowpostprocessing->getReadoutParam(_rawvalue); return flowpostprocessing->getReadoutParam(_rawvalue, _noerror);
string zw = ""; string zw = "";
string result = ""; string result = "";

View File

@@ -27,7 +27,7 @@ protected:
public: public:
void InitFlow(std::string config); void InitFlow(std::string config);
bool doFlow(string time); bool doFlow(string time);
string getReadout(bool _rawvalue); string getReadout(bool _rawvalue, bool _noerror);
string UpdatePrevalue(std::string _newvalue); string UpdatePrevalue(std::string _newvalue);
string GetPrevalue(); string GetPrevalue();
bool ReadParameter(FILE* pfile, string& aktparamgraph); bool ReadParameter(FILE* pfile, string& aktparamgraph);

View File

@@ -154,6 +154,7 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
std::stringstream stream; std::stringstream stream;
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value; stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
ReturnValue = stream.str(); ReturnValue = stream.str();
ReturnValueNoError = ReturnValue;
} }
} }
} }
@@ -304,6 +305,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
zwvalue = stream.str(); zwvalue = stream.str();
} }
ReturnValueNoError = zwvalue;
ReturnValue = zwvalue; ReturnValue = zwvalue;
if (ErrorMessage && (error.length() > 0)) if (ErrorMessage && (error.length() > 0))
ReturnValue = ReturnValue + "\t" + error; ReturnValue = ReturnValue + "\t" + error;
@@ -319,10 +321,12 @@ string ClassFlowPostProcessing::getReadout()
return ReturnValue; return ReturnValue;
} }
string ClassFlowPostProcessing::getReadoutParam(bool _rawValue) string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror)
{ {
if (_rawValue) if (_rawValue)
return ReturnRawValue; return ReturnRawValue;
if (_noerror)
return ReturnValueNoError;
return ReturnValue; return ReturnValue;
} }

View File

@@ -22,6 +22,7 @@ protected:
float Value; float Value;
string ReturnValue; string ReturnValue;
string ReturnRawValue; string ReturnRawValue;
string ReturnValueNoError;
bool LoadPreValue(void); bool LoadPreValue(void);
@@ -34,7 +35,7 @@ public:
bool ReadParameter(FILE* pfile, string& aktparamgraph); bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time); bool doFlow(string time);
string getReadout(); string getReadout();
string getReadoutParam(bool _rawValue); string getReadoutParam(bool _rawValue, bool _noerror);
void SavePreValue(float value, string time = ""); void SavePreValue(float value, string time = "");
string GetPreValue(); string GetPreValue();

View File

@@ -131,6 +131,7 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
{ {
LogFile.WriteToFile("handler_wasserzaehler"); LogFile.WriteToFile("handler_wasserzaehler");
bool _rawValue = false; bool _rawValue = false;
bool _noerror = false;
string zw; string zw;
printf("handler_wasserzaehler uri:\n"); printf(req->uri); printf("\n"); printf("handler_wasserzaehler uri:\n"); printf(req->uri); printf("\n");
@@ -146,9 +147,14 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
printf("rawvalue is found"); printf(_size); printf("\n"); printf("rawvalue is found"); printf(_size); printf("\n");
_rawValue = true; _rawValue = true;
} }
if (httpd_query_key_value(_query, "noerror", _size, 10) == ESP_OK)
{
printf("noerror is found"); printf(_size); printf("\n");
_noerror = true;
}
} }
zw = tfliteflow.getReadout(_rawValue); zw = tfliteflow.getReadout(_rawValue, _noerror);
if (zw.length() > 0) if (zw.length() > 0)
httpd_resp_sendstr_chunk(req, zw.c_str()); httpd_resp_sendstr_chunk(req, zw.c_str());

Binary file not shown.

Binary file not shown.

Binary file not shown.