rolling 20210823

This commit is contained in:
jomjol
2021-08-23 18:57:48 +02:00
parent f6b1a41a0b
commit 0dac0e87e4
18 changed files with 160 additions and 38 deletions

View File

@@ -45,7 +45,12 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated! **General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
##### Rolling (2021-08-23)
* Improved server responsiveness
* Added flow status to overview (lower left)
* Aligned MQTT and prevalue handling, including status of prevalue if not valid/used
* based on v8.1.0
##### 8.1.0 - Multi Meter Support (2021-08-12) ##### 8.1.0 - Multi Meter Support (2021-08-12)

View File

@@ -12,6 +12,9 @@
#include "Helper.h" #include "Helper.h"
#include "server_ota.h" #include "server_ota.h"
//#include "CImg.h"
#include "server_help.h" #include "server_help.h"
//#define DEBUG_DETAIL_ON //#define DEBUG_DETAIL_ON
@@ -51,6 +54,25 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
return result; return result;
} }
std::string ClassFlowControll::TranslateAktstatus(std::string _input)
{
if (_input.compare("ClassFlowMakeImage") == 0)
return ("Take Image");
if (_input.compare("ClassFlowAlignment") == 0)
return ("Aligning");
if (_input.compare("ClassFlowAnalog") == 0)
return ("Analog ROIs");
if (_input.compare("ClassFlowDigit") == 0)
return ("Digital ROIs");
if (_input.compare("ClassFlowMQTT") == 0)
return ("Sending MQTT");
if (_input.compare("ClassFlowPostProcessing") == 0)
return ("Processing");
return "Unkown Status";
}
std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital() std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital()
{ {
for (int i = 0; i < FlowControll.size(); ++i) for (int i = 0; i < FlowControll.size(); ++i)
@@ -95,7 +117,7 @@ void ClassFlowControll::SetInitialParameter(void)
flowpostprocessing = NULL; flowpostprocessing = NULL;
disabled = false; disabled = false;
aktRunNr = 0; aktRunNr = 0;
aktstatus = "Startup"; aktstatus = "Booting ...";
} }
@@ -209,9 +231,9 @@ void ClassFlowControll::doFlowMakeImageOnly(string time){
for (int i = 0; i < FlowControll.size(); ++i) for (int i = 0; i < FlowControll.size(); ++i)
{ {
if (FlowControll[i]->name() == "ClassFlowMakeImage") { if (FlowControll[i]->name() == "ClassFlowMakeImage") {
zw_time = gettimestring("%Y%m%d-%H%M%S"); // zw_time = gettimestring("%Y%m%d-%H%M%S");
aktstatus = zw_time + ": " + FlowControll[i]->name(); zw_time = gettimestring("%H:%M:%S");
string zw = "FlowControll.doFlowMakeImageOnly - " + FlowControll[i]->name(); aktstatus = TranslateAktstatus(FlowControll[i]->name()) + "(" + zw_time + ")";
FlowControll[i]->doFlow(time); FlowControll[i]->doFlow(time);
} }
} }
@@ -231,8 +253,11 @@ bool ClassFlowControll::doFlow(string time)
for (int i = 0; i < FlowControll.size(); ++i) for (int i = 0; i < FlowControll.size(); ++i)
{ {
zw_time = gettimestring("%Y%m%d-%H%M%S"); zw_time = gettimestring("%H:%M:%S");
aktstatus = zw_time + ": " + FlowControll[i]->name(); aktstatus = TranslateAktstatus(FlowControll[i]->name()) + "(" + zw_time + ")";
// zw_time = gettimestring("%Y%m%d-%H%M%S");
// aktstatus = zw_time + ": " + FlowControll[i]->name();
string zw = "FlowControll.doFlow - " + FlowControll[i]->name(); string zw = "FlowControll.doFlow - " + FlowControll[i]->name();
@@ -259,25 +284,11 @@ bool ClassFlowControll::doFlow(string time)
#endif #endif
} }
zw_time = gettimestring("%Y%m%d-%H%M%S"); zw_time = gettimestring("%H:%M:%S");
aktstatus = zw_time + ": Flow is done"; aktstatus = "Flow finished (" + zw_time + ")";
return result; 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::getReadoutAll(int _type) string ClassFlowControll::getReadoutAll(int _type)
{ {
@@ -289,10 +300,18 @@ string ClassFlowControll::getReadoutAll(int _type)
out = out + numbers[i]->name + "\t"; out = out + numbers[i]->name + "\t";
switch (_type) { switch (_type) {
case READOUT_TYPE_VALUE: case READOUT_TYPE_VALUE:
out = out + numbers[i]->ReturnValue; out = out + numbers[i]->ReturnValueNoError;
break; break;
case READOUT_TYPE_PREVALUE: case READOUT_TYPE_PREVALUE:
out = out + numbers[i]->ReturnPreValue; if (flowpostprocessing->PreValueUse)
{
if (numbers[i]->PreValueOkay)
out = out + numbers[i]->ReturnPreValue;
else
out = out + "PreValue too old";
}
else
out = out + "PreValue deactivated";
break; break;
case READOUT_TYPE_RAWVALUE: case READOUT_TYPE_RAWVALUE:
out = out + numbers[i]->ReturnRawValue; out = out + numbers[i]->ReturnRawValue;
@@ -523,6 +542,18 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
flowalignment->DrawRef(_imgzw); flowalignment->DrawRef(_imgzw);
if (flowdigit) flowdigit->DrawROI(_imgzw); if (flowdigit) flowdigit->DrawROI(_imgzw);
if (flowanalog) flowanalog->DrawROI(_imgzw); if (flowanalog) flowanalog->DrawROI(_imgzw);
/*/////////////////////////////////////
cimg_library::CImg<unsigned char> cimg(_imgzw->rgb_image, _imgzw->bpp, _imgzw->width, _imgzw->height, 1);
//Convert cimg type
// cimg.permute_axes("yzcx");
cimg.draw_text(300, 300, "Dies ist ein Test", "black");
//Convert back to stb type to save
// cimg.permute_axes("cxyz");
*////////////////////////////////////
_send = _imgzw; _send = _imgzw;
Dodelete = true; Dodelete = true;
} }

View File

@@ -36,8 +36,6 @@ protected:
std::string aktstatus; std::string aktstatus;
int aktRunNr; int aktRunNr;
void UpdateAktStatus(std::string _flow);
public: public:
void InitFlow(std::string config); void InitFlow(std::string config);
bool doFlow(string time); bool doFlow(string time);
@@ -49,6 +47,8 @@ public:
string GetPrevalue(std::string _number = ""); string GetPrevalue(std::string _number = "");
bool ReadParameter(FILE* pfile, string& aktparamgraph); bool ReadParameter(FILE* pfile, string& aktparamgraph);
string TranslateAktstatus(std::string _input);
string GetMQTTMainTopic(); string GetMQTTMainTopic();
esp_err_t GetJPGStream(std::string _fn, httpd_req_t *req); esp_err_t GetJPGStream(std::string _fn, httpd_req_t *req);

View File

@@ -28,6 +28,7 @@ void ClassFlowDigit::SetInitialParameter(void)
disabled = false; disabled = false;
DecimalShift = 0; DecimalShift = 0;
DecimalShiftEnabled = false; DecimalShiftEnabled = false;
isLogImageSelect = false;
} }
ClassFlowDigit::ClassFlowDigit() : ClassFlowImage(TAG) ClassFlowDigit::ClassFlowDigit() : ClassFlowImage(TAG)
@@ -119,6 +120,13 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
LogImageLocation = "/sdcard" + zerlegt[1]; LogImageLocation = "/sdcard" + zerlegt[1];
isLogImage = true; isLogImage = true;
} }
if ((zerlegt[0] == "LogImageSelect") && (zerlegt.size() > 1))
{
LogImageSelect = zerlegt[1];
isLogImageSelect = true;
}
if ((zerlegt[0] == "Model") && (zerlegt.size() > 1)) if ((zerlegt[0] == "Model") && (zerlegt.size() > 1))
{ {
cnnmodelfile = zerlegt[1]; cnnmodelfile = zerlegt[1];
@@ -328,7 +336,17 @@ bool ClassFlowDigit::doNeuralNetwork(string time)
if (isLogImage) if (isLogImage)
{ {
LogImage(logPath, DIGIT[_dig]->ROI[i]->name, NULL, &DIGIT[_dig]->ROI[i]->resultklasse, time, DIGIT[_dig]->ROI[i]->image_org); if (isLogImageSelect)
{
if (LogImageSelect.find(DIGIT[_dig]->ROI[i]->name) != std::string::npos)
{
LogImage(logPath, DIGIT[_dig]->ROI[i]->name, NULL, &DIGIT[_dig]->ROI[i]->resultklasse, time, DIGIT[_dig]->ROI[i]->image_org);
}
}
else
{
LogImage(logPath, DIGIT[_dig]->ROI[i]->name, NULL, &DIGIT[_dig]->ROI[i]->resultklasse, time, DIGIT[_dig]->ROI[i]->image_org);
}
} }
} }
#ifndef OHNETFLITE #ifndef OHNETFLITE

View File

@@ -33,6 +33,9 @@ protected:
int DecimalShift; int DecimalShift;
bool DecimalShiftEnabled; bool DecimalShiftEnabled;
bool isLogImageSelect;
string LogImageSelect;
ClassFlowAlignment* flowpostalignment; ClassFlowAlignment* flowpostalignment;

View File

@@ -51,7 +51,6 @@ protected:
std::vector<NumberPost*> NUMBERS; std::vector<NumberPost*> NUMBERS;
bool UpdatePreValueINI; bool UpdatePreValueINI;
bool PreValueUse;
int PreValueAgeStartup; int PreValueAgeStartup;
bool ErrorMessage; bool ErrorMessage;
@@ -77,6 +76,8 @@ protected:
public: public:
bool PreValueUse;
ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc); ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc);
bool ReadParameter(FILE* pfile, string& aktparamgraph); bool ReadParameter(FILE* pfile, string& aktparamgraph);
bool doFlow(string time); bool doFlow(string time);

View File

@@ -17,6 +17,7 @@ float CTfLiteClass::GetOutputValue(int nr)
return output2->data.f[nr]; return output2->data.f[nr];
} }
int CTfLiteClass::GetClassFromImageBasis(CImageBasis *rs) int CTfLiteClass::GetClassFromImageBasis(CImageBasis *rs)
{ {
if (!LoadInputImageBasis(rs)) if (!LoadInputImageBasis(rs))

View File

@@ -64,6 +64,7 @@ class CTfLiteClass
void GetOutPut(); void GetOutPut();
int GetOutClassification(); int GetOutClassification();
int GetClassFromImageBasis(CImageBasis *rs); int GetClassFromImageBasis(CImageBasis *rs);
std::string GetStatusFlow();
float GetOutputValue(int nr); float GetOutputValue(int nr);
void GetInputDimension(bool silent); void GetInputDimension(bool silent);

View File

@@ -530,6 +530,36 @@ esp_err_t handler_editflow(httpd_req_t *req)
}; };
esp_err_t handler_statusflow(httpd_req_t *req)
{
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_prevalue - Start");
#endif
const char* resp_str;
string zw;
#ifdef DEBUG_DETAIL_ON
printf("handler_prevalue:\n"); printf(req->uri); printf("\n");
#endif
zw = tfliteflow.getActStatus();
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);
#ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("handler_prevalue - Start");
#endif
return ESP_OK;
};
esp_err_t handler_prevalue(httpd_req_t *req) esp_err_t handler_prevalue(httpd_req_t *req)
{ {
#ifdef DEBUG_DETAIL_ON #ifdef DEBUG_DETAIL_ON
@@ -684,6 +714,10 @@ void register_server_tflite_uri(httpd_handle_t server)
camuri.user_ctx = (void*) "Light Off"; camuri.user_ctx = (void*) "Light Off";
httpd_register_uri_handler(server, &camuri); httpd_register_uri_handler(server, &camuri);
camuri.uri = "/statusflow.html";
camuri.handler = handler_statusflow;
camuri.user_ctx = (void*) "Light Off";
httpd_register_uri_handler(server, &camuri);
camuri.uri = "/editflow.html"; camuri.uri = "/editflow.html";
camuri.handler = handler_editflow; camuri.handler = handler_editflow;

View File

@@ -131,6 +131,16 @@ esp_err_t info_get_handler(httpd_req_t *req)
return ESP_OK; return ESP_OK;
} }
if (_task.compare("FlowStatus") == 0)
{
std::string zw;
zw = std::string("FlowStatus");
httpd_resp_sendstr_chunk(req, zw.c_str());
httpd_resp_sendstr_chunk(req, NULL);
return ESP_OK;
}
#ifdef DEBUG_DETAIL_ON #ifdef DEBUG_DETAIL_ON
LogFile.WriteHeapInfo("info_get_handler - Done"); LogFile.WriteHeapInfo("info_get_handler - Done");
#endif #endif
@@ -398,7 +408,7 @@ httpd_handle_t start_webserver(void)
config.max_uri_handlers = 24; config.max_uri_handlers = 24;
config.max_resp_headers = 8; config.max_resp_headers = 8;
config.backlog_conn = 5; config.backlog_conn = 5;
config.lru_purge_enable = false; config.lru_purge_enable = true; // dadurch werden alter Verbindungen gekappt, falls neue benögt werden.
config.recv_wait_timeout = 30; // default: 5 config.recv_wait_timeout = 30; // default: 5
config.send_wait_timeout = 30; // default: 5 config.send_wait_timeout = 30; // default: 5
config.global_user_ctx = NULL; config.global_user_ctx = NULL;

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="e529af0"; const char* GIT_REV="f6b1a41";
const char* GIT_TAG=""; const char* GIT_TAG="";
const char* GIT_BRANCH="rolling"; const char* GIT_BRANCH="rolling";
const char* BUILD_TIME="2021-08-12 07:18"; const char* BUILD_TIME="2021-08-23 18:44";

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="e529af0"; const char* GIT_REV="f6b1a41";
const char* GIT_TAG=""; const char* GIT_TAG="";
const char* GIT_BRANCH="rolling"; const char* GIT_BRANCH="rolling";
const char* BUILD_TIME="2021-08-12 07:18"; const char* BUILD_TIME="2021-08-23 18:44";

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -9,7 +9,7 @@ function getbasepath(){
{ {
// host = "http://192.168.2.219"; // jomjol interner test // host = "http://192.168.2.219"; // jomjol interner test
// host = "http://192.168.178.46"; // jomjol interner test // host = "http://192.168.178.46"; // jomjol interner test
host = "http://192.168.178.22"; // jomjol interner Real host = "http://192.168.178.64"; // jomjol interner Real
// host = "http://192.168.43.191"; // host = "http://192.168.43.191";
// host = "."; // jomjol interner localhost // host = "."; // jomjol interner localhost

View File

@@ -1 +1 @@
9.6.0 9.7.0

View File

@@ -55,12 +55,11 @@
<tr> <tr>
<td class="tg-3"> <td class="tg-3">
<div id="timestamp" ></div> <div id="timestamp" ></div>
<div id="statusflow" ></div>
</td> </td>
</tr> </tr>
</table> </table>
</body>
</html>
<script src="/jquery-3.6.0.min.js"></script> <script src="/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="./gethost.js"></script> <script type="text/javascript" src="./gethost.js"></script>
@@ -82,10 +81,11 @@ function addZero(i) {
$('#img').html('<img src="/img_tmp/alg_roi.jpg" style="max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>'); $('#img').html('<img src="/img_tmp/alg_roi.jpg" style="max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s)); $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
loadStatus();
refresh(); refresh();
}); });
function refresh() { function refresh() {
setTimeout (function() { setTimeout (function() {
var time = new Date(); var time = new Date();
var timestamp = new Date().getTime(); var timestamp = new Date().getTime();
@@ -96,6 +96,7 @@ function addZero(i) {
// reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp // reassign the url to be like alg_roi.jpg?timestamp=456784512 based on timestamp
$('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'"max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>'); $('#img').html('<img src="/img_tmp/alg_roi.jpg?timestamp='+ timestamp +'"max-height:555px; display:block; margin-left:auto; margin-right:auto;"></img>');
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s)); $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
loadStatus();
init(); init();
refresh(); refresh();
}, 300000); }, 300000);
@@ -104,6 +105,20 @@ function addZero(i) {
var basepath = "http://192.168.178.22"; var basepath = "http://192.168.178.22";
function loadStatus() {
url = basepath + '/statusflow.html';
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var _rsp = xhttp.responseText;
_rsp = "Status: " + _rsp;
$('#statusflow').html(_rsp);
}
}
xhttp.open("GET", url, true);
xhttp.send();
}
function loadValue(_type, _div, _style) { function loadValue(_type, _div, _style) {
url = basepath + '/wasserzaehler.html?all=true&type=' + _type; url = basepath + '/wasserzaehler.html?all=true&type=' + _type;
var xhttp = new XMLHttpRequest(); var xhttp = new XMLHttpRequest();
@@ -150,8 +165,11 @@ function addZero(i) {
loadValue("raw", "raw"); loadValue("raw", "raw");
loadValue("prevalue", "prevalue"); loadValue("prevalue", "prevalue");
loadValue("error", "error", "font-size:8px"); loadValue("error", "error", "font-size:8px");
loadStatus();
} }
init(); init();
</script> </script>
</body>
</html>