mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 20:46:52 +03:00
Update 20200925
This commit is contained in:
11
README.md
11
README.md
@@ -27,10 +27,17 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### Rolling - (2020-09-23)
|
##### Rolling - (2020-09-25)
|
||||||
|
|
||||||
|
* Reduce logging to minimum to reduce `log.txt`. Extended logging can be enabled via `config.ini`: `Logfile = True`
|
||||||
|
* Update default CNN for digits to v6.4.0
|
||||||
|
* Improvement HTML
|
||||||
|
* Bug fixing: Parameter `PreValueAgeStartup` not correctly used
|
||||||
|
* Mechanism for reducing spontaneous reboots further
|
||||||
|
|
||||||
|
2020-09-23
|
||||||
|
|
||||||
* Error Correction for Chrome and Firefox Support
|
* Error Correction for Chrome and Firefox Support
|
||||||
|
|
||||||
* Update CNN for digits to v6.4.0 (**Update of `config.ini` and upload of `dig0640s3.tflite` necessary)
|
* Update CNN for digits to v6.4.0 (**Update of `config.ini` and upload of `dig0640s3.tflite` necessary)
|
||||||
|
|
||||||
2020-09-21
|
2020-09-21
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include "CTfLiteClass.h"
|
#include "CTfLiteClass.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "ClassLogFile.h"
|
||||||
|
|
||||||
ClassFlowAnalog::ClassFlowAnalog()
|
ClassFlowAnalog::ClassFlowAnalog()
|
||||||
{
|
{
|
||||||
isLogImage = false;
|
isLogImage = false;
|
||||||
@@ -140,7 +142,10 @@ string ClassFlowAnalog::getHTMLSingleStep(string host)
|
|||||||
|
|
||||||
bool ClassFlowAnalog::doFlow(string time)
|
bool ClassFlowAnalog::doFlow(string time)
|
||||||
{
|
{
|
||||||
doAlignAndCut(time);
|
if (!doAlignAndCut(time)){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
doNeuralNetwork(time);
|
doNeuralNetwork(time);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -160,6 +165,12 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
|
|||||||
CImageBasis *img_roi = NULL;
|
CImageBasis *img_roi = NULL;
|
||||||
CAlignAndCutImage *caic = new CAlignAndCutImage(input);
|
CAlignAndCutImage *caic = new CAlignAndCutImage(input);
|
||||||
|
|
||||||
|
if (!caic->ImageOkay()){
|
||||||
|
LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut not okay!");
|
||||||
|
delete caic;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (input_roi.length() > 0)
|
if (input_roi.length() > 0)
|
||||||
img_roi = new CImageBasis(input_roi);
|
img_roi = new CImageBasis(input_roi);
|
||||||
|
|
||||||
|
|||||||
294
code/lib/jomjol_flowcontroll/ClassFlowControll._c_pp
Normal file
294
code/lib/jomjol_flowcontroll/ClassFlowControll._c_pp
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
#include "ClassFlowControll.h"
|
||||||
|
|
||||||
|
#include "ClassLogFile.h"
|
||||||
|
#include "time_sntp.h"
|
||||||
|
#include "Helper.h"
|
||||||
|
#include "server_ota.h"
|
||||||
|
|
||||||
|
std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _host){
|
||||||
|
bool found = false;
|
||||||
|
std::string _classname = "";
|
||||||
|
std::string result = "";
|
||||||
|
if (_stepname.compare("[MakeImage]") == 0){
|
||||||
|
_classname = "ClassFlowMakeImage";
|
||||||
|
}
|
||||||
|
if (_stepname.compare("[Alignment]") == 0){
|
||||||
|
_classname = "ClassFlowAlignment";
|
||||||
|
}
|
||||||
|
if (_stepname.compare("[Digits]") == 0){
|
||||||
|
_classname = "ClassFlowDigit";
|
||||||
|
}
|
||||||
|
if (_stepname.compare("[Analog]") == 0){
|
||||||
|
_classname = "ClassFlowAnalog";
|
||||||
|
}
|
||||||
|
// std::string zw = "Classname: " + _classname + "\n";
|
||||||
|
// printf(zw.c_str());
|
||||||
|
|
||||||
|
for (int i = 0; i < FlowControll.size(); ++i)
|
||||||
|
if (FlowControll[i]->name().compare(_classname) == 0){
|
||||||
|
// printf(FlowControll[i]->name().c_str()); printf("\n");
|
||||||
|
FlowControll[i]->doFlow("");
|
||||||
|
result = FlowControll[i]->getHTMLSingleStep(_host);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < FlowControll.size(); ++i)
|
||||||
|
if (FlowControll[i]->name().compare("ClassFlowDigit") == 0)
|
||||||
|
return ((ClassFlowDigit*) (FlowControll[i]))->GetHTMLInfo();
|
||||||
|
|
||||||
|
std::vector<HTMLInfo*> empty;
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<HTMLInfo*> ClassFlowControll::GetAllAnalog()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < FlowControll.size(); ++i)
|
||||||
|
if (FlowControll[i]->name().compare("ClassFlowAnalog") == 0)
|
||||||
|
return ((ClassFlowAnalog*) (FlowControll[i]))->GetHTMLInfo();
|
||||||
|
|
||||||
|
std::vector<HTMLInfo*> empty;
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ClassFlowControll::SetInitialParameter(void)
|
||||||
|
{
|
||||||
|
AutoStart = false;
|
||||||
|
AutoIntervall = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ClassFlowControll::isAutoStart(long &_intervall)
|
||||||
|
{
|
||||||
|
_intervall = AutoIntervall * 60 * 1000; // AutoIntervall: Minuten -> ms
|
||||||
|
return AutoStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
||||||
|
{
|
||||||
|
ClassFlow* cfc = NULL;
|
||||||
|
|
||||||
|
_type = trim(_type);
|
||||||
|
|
||||||
|
if (_type.compare("[MakeImage]") == 0)
|
||||||
|
cfc = new ClassFlowMakeImage(&FlowControll);
|
||||||
|
if (_type.compare("[Alignment]") == 0)
|
||||||
|
cfc = new ClassFlowAlignment(&FlowControll);
|
||||||
|
if (_type.compare("[Analog]") == 0)
|
||||||
|
cfc = new ClassFlowAnalog(&FlowControll);
|
||||||
|
if (_type.compare("[Digits]") == 0)
|
||||||
|
cfc = new ClassFlowDigit(&FlowControll);
|
||||||
|
if (_type.compare("[PostProcessing]") == 0)
|
||||||
|
{
|
||||||
|
cfc = new ClassFlowPostProcessing(&FlowControll);
|
||||||
|
flowpostprocessing = (ClassFlowPostProcessing*) cfc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cfc) // Wird nur angehangen, falls es nicht [AutoTimer] ist, denn dieses ist für FlowControll
|
||||||
|
FlowControll.push_back(cfc);
|
||||||
|
|
||||||
|
if (_type.compare("[AutoTimer]") == 0)
|
||||||
|
cfc = this;
|
||||||
|
|
||||||
|
if (_type.compare("[Debug]") == 0)
|
||||||
|
cfc = this;
|
||||||
|
|
||||||
|
return cfc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClassFlowControll::InitFlow(std::string config)
|
||||||
|
{
|
||||||
|
string line;
|
||||||
|
|
||||||
|
flowpostprocessing = NULL;
|
||||||
|
|
||||||
|
ClassFlow* cfc;
|
||||||
|
FILE* pFile;
|
||||||
|
config = FormatFileName(config);
|
||||||
|
pFile = fopen(config.c_str(), "r");
|
||||||
|
|
||||||
|
line = "";
|
||||||
|
|
||||||
|
char zw[1024];
|
||||||
|
if (pFile != NULL)
|
||||||
|
{
|
||||||
|
fgets(zw, 1024, pFile);
|
||||||
|
printf("%s", zw);
|
||||||
|
line = std::string(zw);
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((line.size() > 0) && !(feof(pFile)))
|
||||||
|
{
|
||||||
|
cfc = CreateClassFlow(line);
|
||||||
|
if (cfc)
|
||||||
|
{
|
||||||
|
cfc->ReadParameter(pFile, line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fgets(zw, 1024, pFile);
|
||||||
|
printf("%s", zw);
|
||||||
|
line = std::string(zw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(pFile);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ClassFlowControll::getActStatus(){
|
||||||
|
return aktstatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ClassFlowControll::doFlow(string time)
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
std::string zw_time;
|
||||||
|
int repeat = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < FlowControll.size(); ++i)
|
||||||
|
{
|
||||||
|
zw_time = gettimestring("%Y%m%d-%H%M%S");
|
||||||
|
aktstatus = zw_time + ": " + FlowControll[i]->name();
|
||||||
|
string zw = "FlowControll.doFlow - " + FlowControll[i]->name();
|
||||||
|
LogFile.WriteToFile(zw);
|
||||||
|
if (!FlowControll[i]->doFlow(time)){
|
||||||
|
repeat++;
|
||||||
|
LogFile.WriteToFile("Fehler im vorheriger Schritt - wird zum " + to_string(repeat) + ". Mal wiederholt");
|
||||||
|
i = -1; // Soll wieder bei i = 0 anfangen ==> komplett von vorne !!!
|
||||||
|
result = false;
|
||||||
|
if (repeat > 5) {
|
||||||
|
LogFile.WriteToFile("Wiederholung 5x nicht erfolgreich --> reboot");
|
||||||
|
doReboot();
|
||||||
|
// Schritt wurde 5x wiederholt --> reboot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zw_time = gettimestring("%Y%m%d-%H%M%S");
|
||||||
|
aktstatus = zw_time + ": Flow is done";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false)
|
||||||
|
{
|
||||||
|
if (flowpostprocessing)
|
||||||
|
return flowpostprocessing->getReadoutParam(_rawvalue, _noerror);
|
||||||
|
|
||||||
|
string zw = "";
|
||||||
|
string result = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < FlowControll.size(); ++i)
|
||||||
|
{
|
||||||
|
zw = FlowControll[i]->getReadout();
|
||||||
|
if (zw.length() > 0)
|
||||||
|
{
|
||||||
|
if (result.length() == 0)
|
||||||
|
result = zw;
|
||||||
|
else
|
||||||
|
result = result + "\t" + zw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ClassFlowControll::GetPrevalue()
|
||||||
|
{
|
||||||
|
if (flowpostprocessing)
|
||||||
|
{
|
||||||
|
return flowpostprocessing->GetPreValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ClassFlowControll::UpdatePrevalue(std::string _newvalue)
|
||||||
|
{
|
||||||
|
float zw;
|
||||||
|
char* p;
|
||||||
|
|
||||||
|
_newvalue = trim(_newvalue);
|
||||||
|
// printf("Input UpdatePreValue: %s\n", _newvalue.c_str());
|
||||||
|
|
||||||
|
if (_newvalue.compare("0.0") == 0)
|
||||||
|
{
|
||||||
|
zw = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
zw = strtof(_newvalue.c_str(), &p);
|
||||||
|
if (zw == 0)
|
||||||
|
return "- Error in String to Value Conversion!!! Must be of format value=123.456";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (flowpostprocessing)
|
||||||
|
{
|
||||||
|
flowpostprocessing->SavePreValue(zw);
|
||||||
|
return to_string(zw);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||||
|
{
|
||||||
|
std::vector<string> zerlegt;
|
||||||
|
|
||||||
|
aktparamgraph = trim(aktparamgraph);
|
||||||
|
|
||||||
|
if (aktparamgraph.size() == 0)
|
||||||
|
if (!this->GetNextParagraph(pfile, aktparamgraph)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if ((aktparamgraph.compare("[Autotimer]") != 0) && (aktparamgraph.compare("[Debug]") != 0)) // Paragraph passt nich zu MakeImage
|
||||||
|
if (aktparamgraph.compare("[Autotimer]") != 0) // Paragraph passt nich zu MakeImage
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// if ((toUpper(aktparamgraph) != "[AUTOTIMER]") && (toUpper(aktparamgraph) != ("[DEBUG]"))) // Paragraph passt nich zu MakeImage
|
||||||
|
// return false;
|
||||||
|
|
||||||
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||||
|
{
|
||||||
|
zerlegt = this->ZerlegeZeile(aktparamgraph);
|
||||||
|
if ((toUpper(zerlegt[0]) == "AUTOSTART") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(zerlegt[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
AutoStart = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((toUpper(zerlegt[0]) == "INTERVALL") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
AutoIntervall = std::stof(zerlegt[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ((toUpper(zerlegt[0]) == "LOGFILE") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(zerlegt[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
LogFile.SwitchOnOff(true);
|
||||||
|
printf("TurnLogFile On\n");
|
||||||
|
}
|
||||||
|
if (toUpper(zerlegt[1]) == "FALSE")
|
||||||
|
{
|
||||||
|
LogFile.SwitchOnOff(false);
|
||||||
|
printf("TurnLogFile Off\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -74,15 +74,15 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
|||||||
|
|
||||||
_type = trim(_type);
|
_type = trim(_type);
|
||||||
|
|
||||||
if (_type.compare("[MakeImage]") == 0)
|
if (toUpper(_type).compare("[MAKEIMAGE]") == 0)
|
||||||
cfc = new ClassFlowMakeImage(&FlowControll);
|
cfc = new ClassFlowMakeImage(&FlowControll);
|
||||||
if (_type.compare("[Alignment]") == 0)
|
if (toUpper(_type).compare("[ALIGNMENT]") == 0)
|
||||||
cfc = new ClassFlowAlignment(&FlowControll);
|
cfc = new ClassFlowAlignment(&FlowControll);
|
||||||
if (_type.compare("[Analog]") == 0)
|
if (toUpper(_type).compare("[ANALOG]") == 0)
|
||||||
cfc = new ClassFlowAnalog(&FlowControll);
|
cfc = new ClassFlowAnalog(&FlowControll);
|
||||||
if (_type.compare("[Digits]") == 0)
|
if (toUpper(_type).compare("[DIGITS]") == 0)
|
||||||
cfc = new ClassFlowDigit(&FlowControll);
|
cfc = new ClassFlowDigit(&FlowControll);
|
||||||
if (_type.compare("[PostProcessing]") == 0)
|
if (toUpper(_type).compare("[POSTPROCESSING]") == 0)
|
||||||
{
|
{
|
||||||
cfc = new ClassFlowPostProcessing(&FlowControll);
|
cfc = new ClassFlowPostProcessing(&FlowControll);
|
||||||
flowpostprocessing = (ClassFlowPostProcessing*) cfc;
|
flowpostprocessing = (ClassFlowPostProcessing*) cfc;
|
||||||
@@ -91,7 +91,10 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
|||||||
if (cfc) // Wird nur angehangen, falls es nicht [AutoTimer] ist, denn dieses ist für FlowControll
|
if (cfc) // Wird nur angehangen, falls es nicht [AutoTimer] ist, denn dieses ist für FlowControll
|
||||||
FlowControll.push_back(cfc);
|
FlowControll.push_back(cfc);
|
||||||
|
|
||||||
if (_type.compare("[AutoTimer]") == 0)
|
if (toUpper(_type).compare("[AUTOTIMER]") == 0)
|
||||||
|
cfc = this;
|
||||||
|
|
||||||
|
if (toUpper(_type).compare("[DEBUG]") == 0)
|
||||||
cfc = this;
|
cfc = this;
|
||||||
|
|
||||||
return cfc;
|
return cfc;
|
||||||
@@ -230,7 +233,7 @@ std::string ClassFlowControll::UpdatePrevalue(std::string _newvalue)
|
|||||||
if (flowpostprocessing)
|
if (flowpostprocessing)
|
||||||
{
|
{
|
||||||
flowpostprocessing->SavePreValue(zw);
|
flowpostprocessing->SavePreValue(zw);
|
||||||
return to_string(zw);
|
return _newvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::string();
|
return std::string();
|
||||||
@@ -247,23 +250,34 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if (aktparamgraph.compare("[AutoTimer]") != 0) // Paragraph passt nich zu MakeImage
|
if ((toUpper(aktparamgraph).compare("[AUTOTIMER]") != 0) && (toUpper(aktparamgraph).compare("[DEBUG]") != 0)) // Paragraph passt nicht zu MakeImage
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||||
{
|
{
|
||||||
zerlegt = this->ZerlegeZeile(aktparamgraph);
|
zerlegt = this->ZerlegeZeile(aktparamgraph);
|
||||||
if ((zerlegt[0] == "AutoStart") && (zerlegt.size() > 1))
|
if ((toUpper(zerlegt[0]) == "AUTOSTART") && (zerlegt.size() > 1))
|
||||||
{
|
{
|
||||||
if (toUpper(zerlegt[1]) == "TRUE")
|
if (toUpper(zerlegt[1]) == "TRUE")
|
||||||
{
|
{
|
||||||
AutoStart = true;
|
AutoStart = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((zerlegt[0] == "Intervall") && (zerlegt.size() > 1))
|
if ((toUpper(zerlegt[0]) == "INTERVALL") && (zerlegt.size() > 1))
|
||||||
{
|
{
|
||||||
AutoIntervall = std::stof(zerlegt[1]);
|
AutoIntervall = std::stof(zerlegt[1]);
|
||||||
}
|
}
|
||||||
|
if ((toUpper(zerlegt[0]) == "LOGFILE") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(zerlegt[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
LogFile.SwitchOnOff(true);
|
||||||
|
}
|
||||||
|
if (toUpper(zerlegt[1]) == "FALSE")
|
||||||
|
{
|
||||||
|
LogFile.SwitchOnOff(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
// #include "bitmap_image.hpp"
|
// #include "bitmap_image.hpp"
|
||||||
|
|
||||||
|
#include "ClassLogFile.h"
|
||||||
|
|
||||||
ClassFlowDigit::ClassFlowDigit()
|
ClassFlowDigit::ClassFlowDigit()
|
||||||
{
|
{
|
||||||
isLogImage = false;
|
isLogImage = false;
|
||||||
@@ -119,7 +121,10 @@ string ClassFlowDigit::getHTMLSingleStep(string host)
|
|||||||
|
|
||||||
bool ClassFlowDigit::doFlow(string time)
|
bool ClassFlowDigit::doFlow(string time)
|
||||||
{
|
{
|
||||||
doAlignAndCut(time);
|
if (!doAlignAndCut(time)){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
doNeuralNetwork(time);
|
doNeuralNetwork(time);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -138,6 +143,11 @@ bool ClassFlowDigit::doAlignAndCut(string time)
|
|||||||
CResizeImage *rs;
|
CResizeImage *rs;
|
||||||
CImageBasis *img_roi = NULL;
|
CImageBasis *img_roi = NULL;
|
||||||
CAlignAndCutImage *caic = new CAlignAndCutImage(input);
|
CAlignAndCutImage *caic = new CAlignAndCutImage(input);
|
||||||
|
if (!caic->ImageOkay()){
|
||||||
|
LogFile.WriteToFile("ClassFlowDigit::doAlignAndCut not okay!");
|
||||||
|
delete caic;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (input_roi.length() > 0)
|
if (input_roi.length() > 0)
|
||||||
img_roi = new CImageBasis(input_roi);
|
img_roi = new CImageBasis(input_roi);
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ void ClassLogFile::WriteToDedicatedFile(std::string _fn, std::string info, bool
|
|||||||
FILE* pFile;
|
FILE* pFile;
|
||||||
std::string zwtime;
|
std::string zwtime;
|
||||||
|
|
||||||
|
if (!doLogFile){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pFile = fopen(_fn.c_str(), "a+");
|
pFile = fopen(_fn.c_str(), "a+");
|
||||||
|
|
||||||
if (_time)
|
if (_time)
|
||||||
@@ -30,6 +34,11 @@ void ClassLogFile::WriteToDedicatedFile(std::string _fn, std::string info, bool
|
|||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClassLogFile::SwitchOnOff(bool _doLogFile){
|
||||||
|
doLogFile = _doLogFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void ClassLogFile::WriteToFile(std::string info, bool _time)
|
void ClassLogFile::WriteToFile(std::string info, bool _time)
|
||||||
{
|
{
|
||||||
WriteToDedicatedFile(logfile, info, _time);
|
WriteToDedicatedFile(logfile, info, _time);
|
||||||
@@ -38,4 +47,5 @@ void ClassLogFile::WriteToFile(std::string info, bool _time)
|
|||||||
ClassLogFile::ClassLogFile(std::string _logfile)
|
ClassLogFile::ClassLogFile(std::string _logfile)
|
||||||
{
|
{
|
||||||
logfile = _logfile;
|
logfile = _logfile;
|
||||||
|
doLogFile = true;
|
||||||
}
|
}
|
||||||
@@ -6,9 +6,12 @@ class ClassLogFile
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::string logfile;
|
std::string logfile;
|
||||||
|
bool doLogFile;
|
||||||
public:
|
public:
|
||||||
ClassLogFile(std::string _logfile);
|
ClassLogFile(std::string _logfile);
|
||||||
|
|
||||||
|
void SwitchOnOff(bool _doLogFile);
|
||||||
|
|
||||||
void WriteToFile(std::string info, bool _time = true);
|
void WriteToFile(std::string info, bool _time = true);
|
||||||
void WriteToDedicatedFile(std::string _fn, std::string info, bool _time = true);
|
void WriteToDedicatedFile(std::string _fn, std::string info, bool _time = true);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -107,31 +107,31 @@ extern "C" void app_main()
|
|||||||
{
|
{
|
||||||
printf("Do Reset Camera\n");
|
printf("Do Reset Camera\n");
|
||||||
PowerResetCamera();
|
PowerResetCamera();
|
||||||
// LogFile.WriteToFile("Startsequence 01");
|
|
||||||
Init_NVS_SDCard();
|
Init_NVS_SDCard();
|
||||||
LogFile.WriteToFile("Startsequence 02");
|
// LogFile.WriteToFile("Startsequence 02");
|
||||||
CheckOTAUpdate();
|
CheckOTAUpdate();
|
||||||
LogFile.WriteToFile("Startsequence 03");
|
// LogFile.WriteToFile("Startsequence 03");
|
||||||
std::string ssid = "";
|
std::string ssid = "";
|
||||||
std::string password = "";
|
std::string password = "";
|
||||||
std::string hostname = "";
|
std::string hostname = "";
|
||||||
|
|
||||||
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname);
|
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname);
|
||||||
LogFile.WriteToFile("Startsequence 04");
|
// LogFile.WriteToFile("Startsequence 04");
|
||||||
printf("To use WLan: %s, %s\n", ssid.c_str(), password.c_str());
|
printf("To use WLan: %s, %s\n", ssid.c_str(), password.c_str());
|
||||||
printf("To set Hostename: %s\n", hostname.c_str());
|
printf("To set Hostename: %s\n", hostname.c_str());
|
||||||
|
|
||||||
initialise_wifi(ssid, password, hostname);
|
initialise_wifi(ssid, password, hostname);
|
||||||
LogFile.WriteToFile("Startsequence 05");
|
// LogFile.WriteToFile("Startsequence 05");
|
||||||
|
|
||||||
TickType_t xDelay;
|
TickType_t xDelay;
|
||||||
xDelay = 2000 / portTICK_PERIOD_MS;
|
xDelay = 2000 / portTICK_PERIOD_MS;
|
||||||
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
|
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
|
||||||
LogFile.WriteToFile("Startsequence 06");
|
// LogFile.WriteToFile("Startsequence 06");
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay( xDelay );
|
||||||
LogFile.WriteToFile("Startsequence 07");
|
// LogFile.WriteToFile("Startsequence 07");
|
||||||
setup_time();
|
setup_time();
|
||||||
LogFile.WriteToFile("======================== Main Started ================================");
|
LogFile.WriteToFile("======================== Main Started ================================");
|
||||||
|
LogFile.SwitchOnOff(false);
|
||||||
|
|
||||||
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
||||||
printf("time %s\n", zw.c_str());
|
printf("time %s\n", zw.c_str());
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -11,6 +11,7 @@ InitalRotate=180
|
|||||||
SearchFieldX = 20
|
SearchFieldX = 20
|
||||||
SearchFieldY = 20
|
SearchFieldY = 20
|
||||||
|
|
||||||
|
|
||||||
[Digits]
|
[Digits]
|
||||||
Model=/config/dig0640s3.tflite
|
Model=/config/dig0640s3.tflite
|
||||||
LogImageLocation = /log/digit
|
LogImageLocation = /log/digit
|
||||||
@@ -42,4 +43,7 @@ CheckDigitIncreaseConsistency = True
|
|||||||
AutoStart= True
|
AutoStart= True
|
||||||
Intervall = 4.85
|
Intervall = 4.85
|
||||||
|
|
||||||
|
[Debug]
|
||||||
|
Logfile = True
|
||||||
|
|
||||||
[Ende]
|
[Ende]
|
||||||
Binary file not shown.
Binary file not shown.
@@ -29,12 +29,15 @@ textarea {
|
|||||||
<tr><td><h2>Config.ini:</h2></td></tr>
|
<tr><td><h2>Config.ini:</h2></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<textarea id="inputTextToSave" cols="117" rows="38"></textarea>
|
<textarea id="inputTextToSave" cols="100" rows="33"></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><button class="button" onclick="saveTextAsFile()">Update Config.ini</button></td>
|
<td><button class="button" onclick="saveTextAsFile()">Update Config.ini</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate updates</button></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script type="text/javascript" src="./gethost.js"></script>
|
<script type="text/javascript" src="./gethost.js"></script>
|
||||||
@@ -60,6 +63,17 @@ function saveTextAsFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doReboot() {
|
||||||
|
if (confirm("Are you sure you want to reboot the ESP32?")) {
|
||||||
|
var stringota = "/reboot";
|
||||||
|
window.location = stringota;
|
||||||
|
window.location.href = stringota;
|
||||||
|
window.location.assign(stringota);
|
||||||
|
window.location.replace(stringota);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LoadConfigNeu();
|
LoadConfigNeu();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user