Compare commits

..

42 Commits

Author SHA1 Message Date
jomjol
480da7c38b Merge pull request #28 from jomjol/rolling
Rolling
2020-09-25 19:16:52 +02:00
jomjol
d428abc12f Update to v2.1.0 2020-09-25 19:15:59 +02:00
jomjol
a08144cc9f Update 20200925 2020-09-25 08:42:45 +02:00
jomjol
0868c22ac6 Merge pull request #27 from michaeljoos72/rolling
HTML Update
2020-09-24 20:37:16 +02:00
michaeljoos72
8ff17650dd HTML Update
- Direkt Dropdown-Link "System --> Log Viewer"
- Small text corrections
- Avoid Scrollbars in Overview in case picture was not loaded
2020-09-24 18:39:18 +02:00
michaeljoos72
5e037d7ab9 Merge pull request #1 from jomjol/rolling
Update Rolling
2020-09-23 23:06:16 +02:00
jomjol
8d2ddc2f22 Update README.md 2020-09-23 21:12:10 +02:00
jomjol
7963474bf0 Update 20200923 2020-09-23 21:01:40 +02:00
jomjol
a8aa6d6329 Update 2020-09-21 22:36:57 +02:00
jomjol
5b52b806ae Error Correction 2020-09-21 22:36:47 +02:00
jomjol
b059713df5 Update 2020-09-21 22:15:11 +02:00
jomjol
48ec76ab38 Update 2020-09-21 2020-09-21 22:12:51 +02:00
jomjol
fe446d60d7 Merge pull request #25 from phlupp/rolling
Update Rolling CPU Temp - Sysinfo - Duplikate
2020-09-21 20:42:22 +02:00
Philipp Harsch
9e2e0d4591 update 2020-09-20 22:33:33 +02:00
phlupp
87935a23d4 Add CPU Temp to log - add sysinfo handler 2020-09-20 20:53:53 +02:00
phlupp
2b178dcbd7 add CPU Temp 2020-09-20 20:47:52 +02:00
phlupp
05cdc99079 add CPU Temp 2020-09-20 20:47:18 +02:00
phlupp
51bca222c0 Delete Helper.h
Duplikat
2020-09-20 20:44:17 +02:00
phlupp
61bbe57018 Delete Helper.cpp
Duplikat
2020-09-20 20:43:52 +02:00
phlupp
9997539736 Merge pull request #2 from jomjol/rolling
Update Rolling
2020-09-20 20:40:08 +02:00
jomjol
d142917afc Update HTML 2020-09-20 17:04:50 +02:00
jomjol
41c1316575 Merge pull request #24 from michaeljoos72/rolling
Update HTML / Autorefresh (JQuery)
2020-09-20 17:02:49 +02:00
michaeljoos72
d4be57f59e Update reboot_page.html 2020-09-20 08:47:53 +02:00
phlupp
6a047d14a0 Merge pull request #1 from jomjol/rolling
Rolling
2020-09-20 01:21:03 +02:00
michaeljoos72
0d1b58542b Update HTML / Autorefresh
- Update HTML-Content (SD-Card)
- Implementation of Auto-Refresh (Picture & Values)  on Overview-Page (300s)
- Implementation of "jquery-3.5.1.min.js"
2020-09-19 19:07:26 +02:00
jomjol
bb05957d33 update rolling 2020-09-16 07:04:12 +02:00
jomjol
157b071a78 Merge pull request #19 from phlupp/patch-4
update Hostname
2020-09-16 06:58:21 +02:00
jomjol
927b5e6e38 Merge pull request #20 from phlupp/patch-3
update hostname, aufgeräumt und std wert auf "watermeter" gesetzt
2020-09-16 06:57:49 +02:00
phlupp
fb0fb551ff update Hostname, aufgeräumt und optimiert, Standar auf "watermeter" gesetzt 2020-09-15 22:26:59 +02:00
phlupp
db02a306e9 Hostname aus ini an console 2020-09-15 22:18:30 +02:00
phlupp
7d84891813 HostName Änderungen aufgeräumt und standard Hostname auf "watermeter" gesetzt 2020-09-15 22:12:35 +02:00
jomjol
e1a33003f0 Update firmware.bin 2020-09-15 06:57:26 +02:00
jomjol
64c7a171ae Merge pull request #18 from phlupp/patch-2
update hostname
2020-09-15 06:55:07 +02:00
phlupp
6a3cb6d9d9 update hostname 2020-09-15 00:10:06 +02:00
jomjol
efed040e9e Update firmware.bin 2020-09-14 21:10:14 +02:00
jomjol
2148f1031f Merge pull request #17 from phlupp/patch-1
Hostname
2020-09-14 21:07:52 +02:00
phlupp
6659456cb3 Hostname 2020-09-14 21:02:57 +02:00
jomjol
207cc585d9 Bug fix, Hostname 2020-09-14 19:43:32 +02:00
jomjol
df80124c57 Bug fix DecimalShift 2020-09-13 21:23:11 +02:00
jomjol
dd1155dc89 Bug fixing 2020-09-13 20:27:21 +02:00
jomjol
4bbed42fb8 Update README.md 2020-09-13 14:01:34 +02:00
jomjol
d70beb57fc Implementation of DecimalShift 2020-09-13 13:53:00 +02:00
44 changed files with 1873 additions and 1088 deletions

View File

@@ -19,9 +19,7 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
### Known Issues ### Known Issues
* Parts of the web page only works correctly in **Firefox** and Chrome! * spontaneous reboot, especially in case of intensive web server access (improved since v2.1.0)
With **Edge** not all parts (especially the configuration) are **not full functional**.
* spontaneous reboot, especially in case of intensive web server access (improved since v2.0.0)
------ ------
@@ -29,9 +27,27 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
##### Rolling - (2020-09-12) ##### Rolling - (2020-09-25)
* based on v2.0.0 (2020-09-12) * based on v2.1.0 (2020-09-25)
##### 2.1.0 Layout update (2020-09-25)
* Implementation of Decimal Shift
* Update default CNN for digits to v6.4.0
* Improvement HTML
* Support for Chrome and Firefox
* Reduce logging to minimum - extended logging on demand
* Implementation of hostname in wlan.ini (`hostname = "HOSTNAME")`
* Bug fixing, code corrections

View File

@@ -21,6 +21,9 @@ static const char *MAIN_TAG = "connect_wlan";
std::string ssid; std::string ssid;
std::string passphrase; std::string passphrase;
std::string hostname;
std::string std_hostname = "watermeter";
static EventGroupHandle_t wifi_event_group; static EventGroupHandle_t wifi_event_group;
@@ -100,33 +103,36 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
return ESP_OK; return ESP_OK;
} }
void initialise_wifi(std::string _ssid, std::string _passphrase) void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname)
{ {
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL) ); ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL) );
wifi_event_group = xEventGroupCreate(); wifi_event_group = xEventGroupCreate();
ssid = _ssid; ssid = _ssid;
passphrase = _passphrase; passphrase = _passphrase;
hostname = _hostname;
esp_log_level_set("wifi", ESP_LOG_NONE); // disable wifi driver logging esp_log_level_set("wifi", ESP_LOG_NONE); // disable wifi driver logging
tcpip_adapter_init(); tcpip_adapter_init();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK( esp_wifi_start() ); ESP_ERROR_CHECK( esp_wifi_start() );
esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA ,"icircuit"); esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA , hostname.c_str());
if(ret != ESP_OK ){ if(ret != ESP_OK ){
ESP_LOGE(MAIN_TAG,"failed to set hostname:%d",ret); ESP_LOGE(MAIN_TAG,"failed to set hostname:%d",ret);
} }
xEventGroupWaitBits(wifi_event_group,CONNECTED_BIT,true,true,portMAX_DELAY); xEventGroupWaitBits(wifi_event_group,CONNECTED_BIT,true,true,portMAX_DELAY);
tcpip_adapter_ip_info_t ip_info; tcpip_adapter_ip_info_t ip_info;
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info)); ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
printf("IP : %s\n", ip4addr_ntoa(&ip_info.ip)); printf("IPv4 : %s\n", ip4addr_ntoa(&ip_info.ip));
printf("HostName : %s\n", hostname.c_str());
} }
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase) void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname)
{ {
string line = ""; string line = "";
std::vector<string> zerlegt; std::vector<string> zerlegt;
_hostname = std_hostname;
FILE* pFile; FILE* pFile;
fn = FormatFileName(fn); fn = FormatFileName(fn);
@@ -145,13 +151,26 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
// printf("%s", line.c_str()); // printf("%s", line.c_str());
zerlegt = ZerlegeZeile(line, "="); zerlegt = ZerlegeZeile(line, "=");
zerlegt[0] = trim(zerlegt[0], " "); zerlegt[0] = trim(zerlegt[0], " ");
zerlegt[1] = trim(zerlegt[1], " "); zerlegt[1] = trim(zerlegt[1], " ");
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "HOSTNAME")){
_hostname = zerlegt[1];
if ((_hostname[0] == '"') && (_hostname[_hostname.length()-1] == '"')){
_hostname = _hostname.substr(1, _hostname.length()-2);
}
// Check if Hostname was empty in .ini if yes set to std_hostname
if(_hostname.length() <= 0){
_hostname = std_hostname;
}
}
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID")){ if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID")){
_ssid = zerlegt[1]; _ssid = zerlegt[1];
if ((_ssid[0] == '"') && (_ssid[_ssid.length()-1] == '"')){ if ((_ssid[0] == '"') && (_ssid[_ssid.length()-1] == '"')){
_ssid = _ssid.substr(1, _ssid.length()-2); _ssid = _ssid.substr(1, _ssid.length()-2);
} }
} }
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "PASSWORD")){ if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "PASSWORD")){
_passphrase = zerlegt[1]; _passphrase = zerlegt[1];
if ((_passphrase[0] == '"') && (_passphrase[_passphrase.length()-1] == '"')){ if ((_passphrase[0] == '"') && (_passphrase[_passphrase.length()-1] == '"')){

View File

@@ -6,8 +6,8 @@
const int CONNECTED_BIT = BIT0; const int CONNECTED_BIT = BIT0;
void initialise_wifi(std::string _ssid, std::string _passphrase); void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _hostname);
void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase); void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphrase, std::string &_hostname);
#endif #endif

View File

@@ -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);

View 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;
}

View File

@@ -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,9 +91,12 @@ 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; cfc = this;
if (toUpper(_type).compare("[DEBUG]") == 0)
cfc = this;
return cfc; return cfc;
} }
@@ -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;
} }

View File

@@ -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);

View File

@@ -19,10 +19,8 @@ string ClassFlowPostProcessing::GetPreValue()
{ {
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0) if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
{ {
int AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs(); int AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
std::stringstream stream; result = RundeOutput(PreValue, AnzahlAnalog - DecimalShift);
stream << std::fixed << std::setprecision(AnzahlNachkomma) << PreValue;
result = stream.str();
} }
} }
@@ -80,14 +78,11 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
{ {
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0) if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
{ {
int AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs(); int AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
std::stringstream stream; ReturnValue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
ReturnValue = stream.str();
ReturnValueNoError = ReturnValue; ReturnValueNoError = ReturnValue;
} }
} }
return true; return true;
} }
@@ -135,6 +130,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing()
PreValueOkay = false; PreValueOkay = false;
useMaxRateValue = false; useMaxRateValue = false;
checkDigitIncreaseConsistency = false; checkDigitIncreaseConsistency = false;
DecimalShift = 0;
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini"); FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
} }
@@ -148,11 +144,13 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
ListFlowControll = NULL; ListFlowControll = NULL;
PreValueOkay = false; PreValueOkay = false;
useMaxRateValue = false; useMaxRateValue = false;
checkDigitIncreaseConsistency = false; checkDigitIncreaseConsistency = false;
DecimalShift = 0;
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini"); FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
ListFlowControll = lfc; ListFlowControll = lfc;
} }
bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph) bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
{ {
std::vector<string> zerlegt; std::vector<string> zerlegt;
@@ -170,42 +168,92 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
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] == "PreValueUse") && (zerlegt.size() > 1)) if ((toUpper(zerlegt[0]) == "DECIMALSHIFT") && (zerlegt.size() > 1))
{ {
if ((zerlegt[1] == "True") || (zerlegt[1] == "true")) DecimalShift = stoi(zerlegt[1]);
}
if ((toUpper(zerlegt[0]) == "PREVALUEUSE") && (zerlegt.size() > 1))
{
if (toUpper(zerlegt[1]) == "TRUE")
{ {
PreValueUse = true; PreValueUse = true;
PreValueOkay = LoadPreValue();
} }
} }
if ((zerlegt[0] == "CheckDigitIncreaseConsistency") && (zerlegt.size() > 1)) if ((toUpper(zerlegt[0]) == "CHECKDIGITINCREASECONSISTENCY") && (zerlegt.size() > 1))
{ {
if (toUpper(zerlegt[1]) == "TRUE") if (toUpper(zerlegt[1]) == "TRUE")
checkDigitIncreaseConsistency = true; checkDigitIncreaseConsistency = true;
} }
if ((zerlegt[0] == "AllowNegativeRates") && (zerlegt.size() > 1)) if ((toUpper(zerlegt[0]) == "ALLOWNEGATIVERATES") && (zerlegt.size() > 1))
{ {
if (toUpper(zerlegt[1]) == "TRUE") if (toUpper(zerlegt[1]) == "TRUE")
AllowNegativeRates = true; AllowNegativeRates = true;
} }
if ((zerlegt[0] == "ErrorMessage") && (zerlegt.size() > 1)) if ((toUpper(zerlegt[0]) == "ERRORMESSAGE") && (zerlegt.size() > 1))
{ {
if (toUpper(zerlegt[1]) == "TRUE") if (toUpper(zerlegt[1]) == "TRUE")
ErrorMessage = true; ErrorMessage = true;
} }
if ((zerlegt[0] == "PreValueAgeStartup") && (zerlegt.size() > 1)) if ((toUpper(zerlegt[0]) == "PREVALUEAGESTARTUP") && (zerlegt.size() > 1))
{ {
PreValueAgeStartup = std::stoi(zerlegt[1]); PreValueAgeStartup = std::stoi(zerlegt[1]);
} }
if ((zerlegt[0] == "MaxRateValue") && (zerlegt.size() > 1)) if ((toUpper(zerlegt[0]) == "MAXRATEVALUE") && (zerlegt.size() > 1))
{ {
useMaxRateValue = true; useMaxRateValue = true;
MaxRateValue = std::stof(zerlegt[1]); MaxRateValue = std::stof(zerlegt[1]);
} }
} }
if (PreValueUse) {
PreValueOkay = LoadPreValue();
}
return true; return true;
} }
string ClassFlowPostProcessing::ShiftDecimal(string in, int _decShift){
if (_decShift == 0){
return in;
}
int _pos_dec_org, _pos_dec_neu;
_pos_dec_org = findDelimiterPos(in, ".");
if (_pos_dec_org == std::string::npos) {
_pos_dec_org = in.length();
}
else
{
in = in.erase(_pos_dec_org, 1);
}
_pos_dec_neu = _pos_dec_org + _decShift;
if (_pos_dec_neu <= 0) { // Komma ist vor der ersten Ziffer
for (int i = 0; i > _pos_dec_neu; --i){
in = in.insert(0, "0");
}
in = "0." + in;
return in;
}
if (_pos_dec_neu > in.length()){ // Komma soll hinter String (123 --> 1230)
for (int i = in.length(); i < _pos_dec_neu; ++i){
in = in.insert(in.length(), "0");
}
return in;
}
string zw;
zw = in.substr(0, _pos_dec_neu);
zw = zw + ".";
zw = zw + in.substr(_pos_dec_neu, in.length() - _pos_dec_neu);
return zw;
}
bool ClassFlowPostProcessing::doFlow(string zwtime) bool ClassFlowPostProcessing::doFlow(string zwtime)
{ {
string result = ""; string result = "";
@@ -214,7 +262,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
string zwvalue; string zwvalue;
bool isdigit = false; bool isdigit = false;
bool isanalog = false; bool isanalog = false;
int AnzahlNachkomma = 0; int AnzahlAnalog = 0;
string zw; string zw;
string error = ""; string error = "";
time_t imagetime = 0; time_t imagetime = 0;
@@ -234,7 +282,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
{ {
isanalog = true; isanalog = true;
analog = (*ListFlowControll)[i]->getReadout(); analog = (*ListFlowControll)[i]->getReadout();
AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs(); AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
} }
} }
@@ -258,7 +306,9 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
if (isdigit && isanalog) if (isdigit && isanalog)
ReturnRawValue = ReturnRawValue + "."; ReturnRawValue = ReturnRawValue + ".";
if (isanalog) if (isanalog)
ReturnRawValue = ReturnRawValue + analog; ReturnRawValue = ReturnRawValue + analog;
ReturnRawValue = ShiftDecimal(ReturnRawValue, DecimalShift);
if (!PreValueUse || !PreValueOkay) if (!PreValueUse || !PreValueOkay)
{ {
@@ -279,33 +329,16 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
return true; return true;
} }
if (isdigit) zw = ErsetzteN(ReturnRawValue);
{
int lastanalog = -1;
if (isanalog)
lastanalog = analog[0] - 48;
digit = ErsetzteN(digit, lastanalog);
zw = digit;
}
if (isdigit && isanalog)
zw = zw + ".";
if (isanalog)
zw = zw + analog;
Value = std::stof(zw); Value = std::stof(zw);
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
std::stringstream stream;
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
zwvalue = stream.str();
if ((!AllowNegativeRates) && (Value < PreValue)) if ((!AllowNegativeRates) && (Value < PreValue))
{ {
error = "Negative Rate - Returned old value - read value: " + zwvalue; error = "Negative Rate - Returned old value - read value: " + zwvalue;
Value = PreValue; Value = PreValue;
stream.str(""); zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
zwvalue = stream.str();
} }
else else
{ {
@@ -313,9 +346,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
{ {
error = "Rate too high - Returned old value - read value: " + zwvalue; error = "Rate too high - Returned old value - read value: " + zwvalue;
Value = PreValue; Value = PreValue;
stream.str(""); zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
zwvalue = stream.str();
} }
} }
@@ -344,19 +375,34 @@ string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror)
return ReturnValue; return ReturnValue;
} }
string ClassFlowPostProcessing::RundeOutput(float _in, int _anzNachkomma){
std::stringstream stream;
stream << std::fixed << std::setprecision(_anzNachkomma) << _in;
return stream.str();
}
string ClassFlowPostProcessing::ErsetzteN(string input, int lastvalueanalog = -1)
string ClassFlowPostProcessing::ErsetzteN(string input)
{ {
int posN, posPunkt; int posN, posPunkt;
int pot, ziffer; int pot, ziffer;
float zw; float zw;
posN = findDelimiterPos(input, "N"); posN = findDelimiterPos(input, "N");
posPunkt = input.length(); posPunkt = findDelimiterPos(input, ".");
if (posPunkt == std::string::npos){
posPunkt = input.length();
}
while (posN != std::string::npos) while (posN != std::string::npos)
{ {
pot = posPunkt - posN - 1; if (posN < posPunkt) {
pot = posPunkt - posN - 1;
}
else {
pot = posPunkt - posN;
}
zw = PreValue / pow(10, pot); zw = PreValue / pow(10, pot);
ziffer = ((int) zw) % 10; ziffer = ((int) zw) % 10;
input[posN] = ziffer + 48; input[posN] = ziffer + 48;
@@ -364,17 +410,15 @@ string ClassFlowPostProcessing::ErsetzteN(string input, int lastvalueanalog = -1
posN = findDelimiterPos(input, "N"); posN = findDelimiterPos(input, "N");
} }
///////////////////////////// TestCode return input;
/* }
input = "10";
posPunkt = input.length(); string ClassFlowPostProcessing::checkDigitConsistency(string input, int _decilamshift, int lastvalueanalog){
PreValue = 9.5; /*
lastvalueanalog = 7;
*/
if (checkDigitIncreaseConsistency && lastvalueanalog > -1) if (checkDigitIncreaseConsistency && lastvalueanalog > -1)
{ {
int zifferIST; int zifferIST;
int substrakt = 0; // int substrakt = 0;
bool lastcorrected = false; bool lastcorrected = false;
for (int i = input.length() - 1; i >= 0; --i) for (int i = input.length() - 1; i >= 0; --i)
{ {
@@ -401,7 +445,7 @@ string ClassFlowPostProcessing::ErsetzteN(string input, int lastvalueanalog = -1
} }
} }
*/
return input; return input;
} }

View File

@@ -16,6 +16,7 @@ protected:
bool ErrorMessage; bool ErrorMessage;
bool PreValueOkay; bool PreValueOkay;
bool checkDigitIncreaseConsistency; bool checkDigitIncreaseConsistency;
int DecimalShift;
string FilePreValue; string FilePreValue;
float PreValue; // letzter Wert, der gut ausgelesen wurde float PreValue; // letzter Wert, der gut ausgelesen wurde
@@ -25,8 +26,11 @@ protected:
string ReturnValueNoError; // korrigierter Rückgabewert ohne Fehlermeldung string ReturnValueNoError; // korrigierter Rückgabewert ohne Fehlermeldung
bool LoadPreValue(void); bool LoadPreValue(void);
string ShiftDecimal(string in, int _decShift);
string ErsetzteN(string, int lastvalueanalog); string ErsetzteN(string);
string checkDigitConsistency(string, int _decilamshift, int lastvalueanalog = -1);
string RundeOutput(float _in, int _anzNachkomma);
public: public:
ClassFlowPostProcessing(); ClassFlowPostProcessing();

View File

@@ -1,157 +0,0 @@
//#pragma warning(disable : 4996)
#include "Helper.h"
//#define ISWINDOWS_TRUE
using namespace std;
std::string FormatFileName(std::string input)
{
#ifdef ISWINDOWS_TRUE
input.erase(0, 1);
std::string os = "/";
std::string ns = "\\";
FindReplace(input, os, ns);
#endif
return input;
}
void FindReplace(std::string& line, std::string& oldString, std::string& newString) {
const size_t oldSize = oldString.length();
// do nothing if line is shorter than the string to find
if (oldSize > line.length()) return;
const size_t newSize = newString.length();
for (size_t pos = 0; ; pos += newSize) {
// Locate the substring to replace
pos = line.find(oldString, pos);
if (pos == std::string::npos) return;
if (oldSize == newSize) {
// if they're same size, use std::string::replace
line.replace(pos, oldSize, newString);
}
else {
// if not same size, replace by erasing and inserting
line.erase(pos, oldSize);
line.insert(pos, newString);
}
}
}
bool ctype_space(const char c, string adddelimiter)
{
if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == 11)
{
return true;
}
if (adddelimiter.find(c) != string::npos)
return true;
return false;
}
string trim(string istring, string adddelimiter)
{
bool trimmed = false;
if (ctype_space(istring[istring.length() - 1], adddelimiter))
{
istring.erase(istring.length() - 1);
trimmed = true;
}
if (ctype_space(istring[0], adddelimiter))
{
istring.erase(0, 1);
trimmed = true;
}
if ((trimmed == false) || (istring.size() == 0))
{
return istring;
}
else
{
return trim(istring, adddelimiter);
}
}
size_t findDelimiterPos(string input, string delimiter)
{
size_t pos = std::string::npos;
size_t zw;
string akt_del;
for (int anz = 0; anz < delimiter.length(); ++anz)
{
akt_del = delimiter[anz];
if ((zw = input.find(akt_del)) != std::string::npos)
{
if (pos != std::string::npos)
{
if (zw < pos)
pos = zw;
}
else
pos = zw;
}
}
return pos;
}
void CopyFile(string input, string output)
{
input = FormatFileName(input);
output = FormatFileName(output);
char cTemp;
FILE* fpSourceFile = fopen(input.c_str(), "rb");
FILE* fpTargetFile = fopen(output.c_str(), "wb");
// Code Section
// Read From The Source File - "Copy"
while (fread(&cTemp, 1, 1, fpSourceFile) == 1)
{
// Write To The Target File - "Paste"
fwrite(&cTemp, 1, 1, fpTargetFile);
}
// Close The Files
fclose(fpSourceFile);
fclose(fpTargetFile);
}
string getFileType(string filename)
{
int lastpos = filename.find(".", 0);
int neu_pos;
while ((neu_pos = filename.find(".", lastpos + 1)) > -1)
{
lastpos = neu_pos;
}
string zw = filename.substr(lastpos + 1, filename.size() - lastpos);
return zw;
}
string toUpper(string in)
{
for (int i = 0; i < in.length(); ++i)
in[i] = toupper(in[i]);
return in;
}

View File

@@ -1,22 +0,0 @@
#pragma once
#include <string>
#include <fstream>
using namespace std;
std::string FormatFileName(std::string input);
void FindReplace(std::string& line, std::string& oldString, std::string& newString);
void CopyFile(string input, string output);
size_t findDelimiterPos(string input, string delimiter);
//string trim(string istring);
string trim(string istring, string adddelimiter = "");
bool ctype_space(const char c, string adddelimiter);
string getFileType(string filename);
string toUpper(string in);

View File

@@ -167,3 +167,9 @@ string toUpper(string in)
return in; return in;
} }
// CPU Temp
extern "C" uint8_t temprature_sens_read();
float temperatureRead()
{
return (temprature_sens_read() - 32) / 1.8;
}

View File

@@ -19,4 +19,4 @@ string getFileType(string filename);
string toUpper(string in); string toUpper(string in);
float temperatureRead();

View File

@@ -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);
@@ -37,5 +46,6 @@ void ClassLogFile::WriteToFile(std::string info, bool _time)
ClassLogFile::ClassLogFile(std::string _logfile) ClassLogFile::ClassLogFile(std::string _logfile)
{ {
logfile = _logfile; logfile = _logfile;
doLogFile = true;
} }

View File

@@ -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);
}; };

View File

@@ -74,8 +74,8 @@ CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y CONFIG_PARTITION_TABLE_MD5=y
CONFIG_EXAMPLE_CONNECT_WIFI=y CONFIG_EXAMPLE_CONNECT_WIFI=y
# CONFIG_EXAMPLE_CONNECT_ETHERNET is not set # CONFIG_EXAMPLE_CONNECT_ETHERNET is not set
CONFIG_EXAMPLE_WIFI_SSID="SSID" CONFIG_EXAMPLE_WIFI_SSID="myssid"
CONFIG_EXAMPLE_WIFI_PASSWORD="passwd" CONFIG_EXAMPLE_WIFI_PASSWORD="mypassword"
CONFIG_EXAMPLE_CONNECT_IPV6=y CONFIG_EXAMPLE_CONNECT_IPV6=y
CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y
# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set # CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set
@@ -240,8 +240,8 @@ CONFIG_ESP_EVENT_POST_FROM_ISR=y
CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set # CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
CONFIG_HTTPD_MAX_REQ_HDR_LEN=512 CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024
CONFIG_HTTPD_MAX_URI_LEN=512 CONFIG_HTTPD_MAX_URI_LEN=1024
CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_ERR_RESP_NO_DELAY=y
CONFIG_HTTPD_PURGE_BUF_LEN=32 CONFIG_HTTPD_PURGE_BUF_LEN=32
# CONFIG_HTTPD_LOG_PURGE_DATA is not set # CONFIG_HTTPD_LOG_PURGE_DATA is not set

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,11 @@
# This file was automatically generated for projects # This file was automatically generated for projects
# without default 'CMakeLists.txt' file. # without default 'CMakeLists.txt' file.
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*) FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
# idf_component_register(SRCS ${app_sources}) # idf_component_register(SRCS ${app_sources})
idf_component_register(SRCS ${app_sources} idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "." INCLUDE_DIRS ".")
EMBED_FILES "favicon.ico")

24
code/src/gitversion.cmake Normal file
View File

@@ -0,0 +1,24 @@
# cmake/gitversion.cmake
cmake_minimum_required(VERSION 3.0.0)
message(STATUS "Resolving GIT Version")
set(_build_version "unknown")
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${local_dir}"
OUTPUT_VARIABLE _build_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message( STATUS "GIT hash: ${_build_version}")
else()
message(STATUS "GIT not found")
endif()
string(TIMESTAMP _time_stamp)
configure_file(${local_dir}/cmake/gitversion.h.in ${output_dir}/gitversion.h @ONLY)

View File

@@ -5,6 +5,7 @@
#include "driver/gpio.h" #include "driver/gpio.h"
#include "sdkconfig.h" #include "sdkconfig.h"
//#include "version.h"
#include "ClassLogFile.h" #include "ClassLogFile.h"
@@ -106,28 +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 = "";
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password); std::string hostname = "";
LogFile.WriteToFile("Startsequence 04");
printf("WLan: %s, %s\n", ssid.c_str(), password.c_str()); LoadWlanFromFile("/sdcard/wlan.ini", ssid, password, hostname);
// LogFile.WriteToFile("Startsequence 04");
printf("To use WLan: %s, %s\n", ssid.c_str(), password.c_str());
printf("To set Hostename: %s\n", hostname.c_str());
initialise_wifi(ssid, password); 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());

View File

@@ -411,6 +411,35 @@ esp_err_t handler_prevalue(httpd_req_t *req)
}; };
esp_err_t handler_sysinfo(httpd_req_t *req)
{
LogFile.WriteToFile("handler_sysinfo");
const char* resp_str;
string zw;
string cputemp = std::to_string(temperatureRead());
zw = "[\
{\
\"firmware\" : \"2.0.0\",\
\"html\" : \"1.0.1\",\
\"cputemp\" : \"" + cputemp + "\",\
\"hostname\" : \"host\",\
\"IPv4\" : \"IP\"\
}\
]";
resp_str = zw.c_str();
httpd_resp_set_type(req, "application/json");
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);
return ESP_OK;
};
void task_autodoFlow(void *pvParameter) void task_autodoFlow(void *pvParameter)
{ {
int64_t fr_start, fr_delta_ms; int64_t fr_start, fr_delta_ms;
@@ -436,7 +465,11 @@ void task_autodoFlow(void *pvParameter)
doflow(); doflow();
} }
LogFile.WriteToFile("task_autodoFlow - round done"); LogFile.WriteToFile("task_autodoFlow - round done");
//CPU Temp
float cputmp = temperatureRead();
LogFile.WriteToFile("CPU Temperature: %.2f", cputmp);
printf("CPU Temperature: %.2f\n", cputmp);
fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000; fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS; const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
printf("Autoflow: sleep for : %ldms\n", (long) xDelay); printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
@@ -484,5 +517,10 @@ void register_server_tflite_uri(httpd_handle_t server)
camuri.uri = "/wasserzaehler.html"; camuri.uri = "/wasserzaehler.html";
camuri.handler = handler_wasserzaehler; camuri.handler = handler_wasserzaehler;
camuri.user_ctx = (void*) "Wasserzaehler"; camuri.user_ctx = (void*) "Wasserzaehler";
httpd_register_uri_handler(server, &camuri); httpd_register_uri_handler(server, &camuri);
camuri.uri = "/sysinfo";
camuri.handler = handler_sysinfo;
camuri.user_ctx = (void*) "Sysinfo";
httpd_register_uri_handler(server, &camuri);
} }

43
code/src/version.cmake Normal file
View File

@@ -0,0 +1,43 @@
execute_process(COMMAND git log --pretty=format:'%h' -n 1
OUTPUT_VARIABLE GIT_REV
ERROR_QUIET)
# Check whether we got any revision (which isn't
# always the case, e.g. when someone downloaded a zip
# file from Github instead of a checkout)
if ("${GIT_REV}" STREQUAL "")
set(GIT_REV "N/A")
set(GIT_DIFF "")
set(GIT_TAG "N/A")
set(GIT_BRANCH "N/A")
else()
execute_process(
COMMAND bash -c "git diff --quiet --exit-code || echo +"
OUTPUT_VARIABLE GIT_DIFF)
execute_process(
COMMAND git describe --exact-match --tags
OUTPUT_VARIABLE GIT_TAG ERROR_QUIET)
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE GIT_BRANCH)
string(STRIP "${GIT_REV}" GIT_REV)
string(SUBSTRING "${GIT_REV}" 1 7 GIT_REV)
string(STRIP "${GIT_DIFF}" GIT_DIFF)
string(STRIP "${GIT_TAG}" GIT_TAG)
string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
endif()
set(VERSION "const char* GIT_REV=\"${GIT_REV}${GIT_DIFF}\";
const char* GIT_TAG=\"${GIT_TAG}\";
const char* GIT_BRANCH=\"${GIT_BRANCH}\";")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp VERSION_)
else()
set(VERSION_ "")
endif()
if (NOT "${VERSION}" STREQUAL "${VERSION_}")
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp "${VERSION}")
endif()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -11,9 +11,9 @@ InitalRotate=180
SearchFieldX = 20 SearchFieldX = 20
SearchFieldY = 20 SearchFieldY = 20
[Digits] [Digits]
;Model=/config/dig0622.tfl Model=/config/dig0640s3.tflite
Model=/config/dig0630s3.tflite
LogImageLocation = /log/digit LogImageLocation = /log/digit
ModelInputSize 20, 32 ModelInputSize 20, 32
digit1, 306, 120, 37, 67 digit1, 306, 120, 37, 67
@@ -21,7 +21,6 @@ digit2, 355, 120, 37, 67
digit3, 404, 120, 37, 67 digit3, 404, 120, 37, 67
[Analog] [Analog]
;Model=/config/ana0622.tfl
Model=/config/ana0630s2.tflite Model=/config/ana0630s2.tflite
LogImageLocation = /log/analog LogImageLocation = /log/analog
ModelInputSize 32, 32 ModelInputSize 32, 32
@@ -31,6 +30,7 @@ analog3, 294, 369, 92, 92
analog4, 168, 326, 92, 92 analog4, 168, 326, 92, 92
[PostProcessing] [PostProcessing]
DecimalShift = 0
PreValueUse = True PreValueUse = True
PreValueAgeStartup = 30 PreValueAgeStartup = 30
AllowNegativeRates = False AllowNegativeRates = False
@@ -43,4 +43,7 @@ CheckDigitIncreaseConsistency = True
AutoStart= True AutoStart= True
Intervall = 4.85 Intervall = 4.85
[Debug]
Logfile = False
[Ende] [Ende]

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,101 +1,98 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"/> <title>Make Alignment</title>
<title>Make Alignment</title> <meta charset="utf-8"/>
<style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
input[type=number] {
width: 100px;
margin-right: 10px;
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
input[type=text] {
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
select {
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
margin-right: 10px;
}
.button {
padding: 5px 10px;
width: 210px;
font-size: 16px;
}
</style>
</head> </head>
<div class="body-content" style="font-family: arial"> <body style="font-family: arial; padding: 0px 10px;">
<div id="createrefernce"> <h2>Define Alignment Structure in Reference Image</h2>
<div style="padding-left: 30px">
<h3>Define Alignment Structure in Reference Image</h3>
<div style="padding-left: 30px">
<table>
<tr>
<td>
<canvas id="canvas" crossorigin></canvas>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<tr>
<td>
<select id="index" name="reference" onchange="ChangeSelection()">
<option value="0" selected>Reference 0</option>
<option value="1" >Reference 1</option>
</select>
Storage path/name: <input type="text" name="name" id="name">
</td>
</tr>
<td> <table>
<table> <tr>
<tr> <td><canvas id="canvas" crossorigin></canvas></td>
<td> </tr>
x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()"> </table>
</td>
<td>
dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchanged()">
</td>
</tr>
<tr>
<td>
y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()">
</td>
<td>
dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()">
</td>
</tr>
<tr>
<td>
<input type="button" value="Update Reference" onclick="CutOutReference()">
</td>
</tr>
</table>
</td>
</tr>
<table>
<tr>
<td>
Original Image
</td>
<td>
Reference Image
</td>
</tr>
<tr>
<td>
<img id="img_ref_org" src = "/img_tmp/ref_zw_org.jpg">
</td>
<td>
<img id="img_ref" src = "/img_tmp/ref_zw.jpg">
</td>
<td>
<input type="button" id="enhancecontrast" value="Enhance Contrast" onclick="EnhanceContrast()">
</td>
</tr>
</table>
<tr>
<td>
<input type="submit" name="saveroi" onclick="SaveToConfig()" value="Save to Config.ini">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<script type="text/javascript" src="./gethost.js"></script> <table>
<script type="text/javascript" src="./readconfig.js"></script> <tr>
<td>Select Reference:
<select id="index" name="reference" onchange="ChangeSelection()">
<option value="0" selected>Reference 0</option>
<option value="1" >Reference 1</option>
</select>
</td>
<td colspan="2">Storage Path/Name: <input type="text" name="name" id="name"></td>
</tr>
<tr>
<td style="padding-top: 10px">x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()"></td>
<td style="padding-top: 10px">dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchanged()"></td>
<td rowspan="2" style="padding-top: 10px"><input class="button" type="button" value="Update Reference" onclick="CutOutReference()"></td>
</tr>
<tr>
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()"></td>
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()"></td>
</tr>
<tr>
<td style="padding-top: 10px">Original Image:</td>
<td style="padding-top: 10px">Reference Image:</td>
<td rowspan="2"><input class="button" type="button" id="enhancecontrast" value="Enhance Contrast" onclick="EnhanceContrast()"></td>
</tr>
<tr>
<td><img id="img_ref_org" src = "/img_tmp/ref_zw_org.jpg"></td>
<td><img id="img_ref" src = "/img_tmp/ref_zw.jpg"></td>
</tr>
</table>
<script language="JavaScript"> <table>
<tr>
<td colspan="2"><input class="button" type="submit" name="saveroi" onclick="SaveToConfig()" value="Save to Config.ini"></td>
</tr>
</table>
<script type="text/javascript" src="./gethost.js"></script>
<script type="text/javascript" src="./readconfig.js"></script>
<script language="JavaScript">
var canvas = document.getElementById('canvas'), var canvas = document.getElementById('canvas'),
ctx = canvas.getContext('2d'), ctx = canvas.getContext('2d'),
imageObj = new Image(), imageObj = new Image(),
@@ -364,7 +361,5 @@ function dataURLtoBlob(dataurl) {
init(); init();
</script> </script>
</div>
</body> </body>
</html> </html>

View File

@@ -1,87 +1,108 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>Make Alignment</title> <title>Make Analog Alignment</title>
<style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
input[type=number] {
width: 100px;
margin-right: 10px;
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
input[type=text] {
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
select {
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
margin-right: 10px;
}
.button {
padding: 5px 10px;
width: 210px;
font-size: 16px;
}
.move {
padding: 4px 4px;
width: 100px;
font-size: 12px;
}
th, td {
padding: 5px 5px 5px 0px;
}
</style>
</head> </head>
<div class="body-content" style="font-family: arial"> <body style="font-family: arial; padding: 0px 10px;">
<div id="createrefernce">
<div style="padding-left: 30px">
<h3>Edit Analog</h3>
<div style="padding-left: 30px">
<table>
<tr>
<td>
<canvas id="canvas" crossorigin></canvas>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<input type="submit" id= "newROI" name="newROI" onclick="newROI()" value="New ROI (after current)">
<input type="submit" id= "deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI">
</td>
</tr>
<tr>
<tr>
<td>
<select id="index" name="index" onchange="ChangeSelection()">
<option value="0" selected>ROI 0</option>
<option value="1" >ROI 1</option>
</select>
name: <input type="text" name="name" id="name" onchange="onNameChange()">
<input type="submit" id="moveNext" onclick="moveNext()" value="move Next">
<input type="submit" id="movePrevious" onclick="movePrevious()" value="move Previous">
</td>
</tr>
<td> <h2>Edit Analog</h2>
<table>
<tr>
<td>
x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()">
</td>
<td>
dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()">
</td>
<td>
<input type="checkbox" id="lockAR" name="lockAR" value="1" onclick="changelockAR()" checked>
<label for="lockAR"> lock aspect ratio</label><br>
</td>
</tr>
<tr>
<td>
y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()">
</td>
<td>
dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<input type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<script type="text/javascript" src="./gethost.js"></script> <table>
<script type="text/javascript" src="./readconfig.js"></script> <tr>
<td><canvas id="canvas" crossorigin></canvas></td>
</tr>
</table>
<table>
<tr>
<td><input class="button" type="submit" id= "newROI" name="newROI" onclick="newROI()" value="New ROI (after current)"></td>
<td><input class="button" type="submit" id= "deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI"></td>
<td></td>
</tr>
<tr>
<td>
<select id="index" name="index" onchange="ChangeSelection()">
<option value="0" selected>ROI 0</option>
<option value="1" >ROI 1</option>
</select>
</td>
<td>Name: <input type="text" name="name" id="name" onchange="onNameChange()" size="13"></td>
<td>
<input class="move" type="submit" id="moveNext" onclick="moveNext()" value="move Next">
<input class="move" type="submit" id="movePrevious" onclick="movePrevious()" value="move Previous">
</td>
</tr>
<tr>
<td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()"></td>
<td>dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()"></td>
<td rowspan="2"><label for="lockAR"> Lock aspect ratio: </label><input type="checkbox" id="lockAR" name="lockAR" value="1" onclick="changelockAR()" checked></td>
</tr>
<tr>
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()"></td>
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()"></td>
</tr>
</table>
<table>
<tr>
<td><input class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini"></td>
</tr>
</table>
<script language="JavaScript"> <script type="text/javascript" src="./gethost.js"></script>
<script type="text/javascript" src="./readconfig.js"></script>
<script language="JavaScript">
var canvas = document.getElementById('canvas'), var canvas = document.getElementById('canvas'),
ctx = canvas.getContext('2d'), ctx = canvas.getContext('2d'),
imageObj = new Image(), imageObj = new Image(),
@@ -391,8 +412,6 @@ function ParseIni(_basepath) {
init(); init();
</script> </script>
</div>
</body> </body>
</html> </html>

View File

@@ -1,26 +1,49 @@
<!DOCTYPE html>
<html> <html>
<head>
<meta charset="utf-8"/>
<title>Check</title>
<style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
.button {
padding: 5px 10px;
width: 210px;
font-size: 16px;
}
</style>
</head>
<body style="font-family: arial"> <body style="font-family: arial">
<table> <table>
<tr><td>Result:</td></tr> <tr><td colspan="2">Result:</td></tr>
<tr> <tr>
<td> <td>
<iframe name="maincontent" id ="maincontent" width="800px" height="800px"></iframe> <iframe name="maincontent" id ="maincontent" width="700px" height="700px"></iframe>
</td> </td>
<td> <td style="padding-left: 15px;">
<p> <p>
<input type="submit" id="take" onclick="doTake()" value="1. Take Picture"> <input class="button" type="submit" id="take" onclick="doTake()" value="1. Take Picture">
</p>
<p>
<input class="button" type="submit" id="align" onclick="doAlign()" value="2. Align Image"><br>
</p> </p>
<p> <p>
<input type="submit" id="align" onclick="doAlign()" value="2. Align Image"><br>
Takes up to 2 Minutes! Takes up to 2 Minutes!
</p> </p>
Digits and Analog recognition not yet implemented. Digits and Analog recognition not yet implemented.
<p> <p>
<input type="submit" id="digits" onclick="doDigits()" value="3a. Analyse Digits"> <input class="button" type="submit" id="digits" onclick="doDigits()" value="3a. Analyse Digits">
</p> </p>
<p> <p>
<input type="submit" id="analog" onclick="doAnalog()" value="3b Analyse Analog"> <input class="button" type="submit" id="analog" onclick="doAnalog()" value="3b Analyse Analog">
</p> </p>
</td> </td>
</tr> </tr>

View File

@@ -1,16 +1,43 @@
<!DOCTYPE html>
<html> <html>
<body style="font-family: arial"> <head>
<title>Edit Config</title>
<meta charset="utf-8">
<style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
.button {
padding: 5px 20px;
width: 211px;
font-size: 16px;
}
textarea {
font-size: 14px;
}
</style>
</head>
<body style="font-family: arial; padding: 0px 10px;">
<table> <table>
<tr><td>Config.ini:</td></tr> <tr><td><h2>Config.ini:</h2></td></tr>
<tr> <tr>
<td colspan="3"> <td colspan="3">
<textarea id="inputTextToSave" cols="100" rows="40"></textarea> <textarea id="inputTextToSave" cols="100" rows="33"></textarea>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><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>
@@ -35,6 +62,17 @@ function saveTextAsFile()
FileSendContent(textToSave, "/config/config.ini", basepath); FileSendContent(textToSave, "/config/config.ini", basepath);
} }
} }
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();

View File

@@ -1,87 +1,108 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>Make Alignment</title> <title>Make Digital Alignment</title>
<style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
input[type=number] {
width: 100px;
margin-right: 10px;
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
input[type=text] {
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
select {
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
margin-right: 10px;
}
.button {
padding: 5px 10px;
width: 210px;
font-size: 16px;
}
.move {
padding: 4px 4px;
width: 100px;
font-size: 12px;
}
th, td {
padding: 5px 5px 5px 0px;
}
</style>
</head> </head>
<div class="body-content" style="font-family: arial"> <body style="font-family: arial; padding: 0px 10px;">
<div id="createrefernce">
<div style="padding-left: 30px">
<h3>Edit Digits</h3>
<div style="padding-left: 30px">
<table>
<tr>
<td>
<canvas id="canvas" crossorigin></canvas>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<input type="submit" id="newROI" name="newROI" onclick="newROI()" value="New ROI (after current)">
<input type="submit" id="deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI">
</td>
</tr>
<tr>
<tr>
<td>
<select id="index" name="index" onchange="ChangeSelection()">
<option value="0" selected>ROI 0</option>
<option value="1" >ROI 1</option>
</select>
name: <input type="text" name="name" id="name" onchange="onNameChange()">
<input type="submit" id="moveNext" onclick="moveNext()" value="move Next">
<input type="submit" id="movePrevious" onclick="movePrevious()" value="move Previous">
</td>
</tr>
<td> <h2>Edit Digits</h2>
<table>
<tr>
<td>
x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()">
</td>
<td>
dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()">
</td>
<td>
<input type="checkbox" id="lockAR" name="lockAR" value="1" onclick="changelockAR()" checked>
<label for="lockAR"> lock aspect ratio</label><br>
</td>
</tr>
<tr>
<td>
y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()">
</td>
<td>
dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<input type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini">
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<script type="text/javascript" src="./gethost.js"></script> <table>
<script type="text/javascript" src="./readconfig.js"></script> <tr>
<canvas id="canvas" crossorigin></canvas>
</tr>
</table>
<table>
<tr>
<td><input class="button" type="submit" id="newROI" name="newROI" onclick="newROI()" value="New ROI (after current)"></td>
<td><input class="button" type="submit" id="deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI"></td>
<td></td>
</tr>
<tr>
<td>
<select id="index" name="index" onchange="ChangeSelection()">
<option value="0" selected>ROI 0</option>
<option value="1" >ROI 1</option>
</select>
</td>
<td>Name: <input type="text" name="name" id="name" onchange="onNameChange()" size="13"></td>
<td>
<input class="move" type="submit" id="moveNext" onclick="moveNext()" value="move Next">
<input class="move" type="submit" id="movePrevious" onclick="movePrevious()" value="move Previous">
</td>
</tr>
<tr>
<td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()"></td>
<td>dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()"></td>
<td rowspan="2"><label for="lockAR"> Lock aspect ratio </label><input type="checkbox" id="lockAR" name="lockAR" value="1" onclick="changelockAR()" checked></td>
</tr>
<tr>
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()"></td>
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()"></td>
</tr>
</table>
<table>
<tr>
<td><input class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini"></td>
</tr>
</table>
<script language="JavaScript"> <script type="text/javascript" src="./gethost.js"></script>
<script type="text/javascript" src="./readconfig.js"></script>
<script language="JavaScript">
var canvas = document.getElementById('canvas'), var canvas = document.getElementById('canvas'),
ctx = canvas.getContext('2d'), ctx = canvas.getContext('2d'),
imageObj = new Image(), imageObj = new Image(),
@@ -390,8 +411,7 @@ function ParseIni(_basepath) {
init(); init();
</script> </script>
</div>
</body> </body>
</html> </html>

View File

@@ -1,75 +1,69 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"/> <title>Make Reference</title>
<title>Make refernce</title> <meta charset="utf-8"/>
<style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
input[type=number] {
width: 100px;
margin-right: 10px;
padding: 3px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
.button {
padding: 5px 10px;
width: 210px;
font-size: 16px;
}
table {
padding: 5px;
}
</style>
</head> </head>
<body style="font-family: arial"> <body style="font-family: arial; padding: 0px 10px;">
<h3>Create Reference out of Raw Image</h3> <h2>Create Reference out of Raw Image</h2>
<div style="padding-left: 30px">
<table> <table>
<tr> <tr>
<td> <td><input class="button" type="button" value="Show Actual Reference" onclick="showReference()"></td>
<input type="button" value="Show actual Reference" onclick="showReference()"> <td><input class="button" type="button" value="Create New Reference" onclick="loadRawImage()"></td>
</td> <td><input class="button" type="submit" id="take" onclick="doTake()" value="New Raw Image (raw.jpg)"></td>
<td> </tr>
<input type="button" value="Create new Reference" onclick="loadRawImage()"> <tr>
</td> <td style="padding-top: 10px"><label for="mirror">Mirror Image:</label></td>
</tr> <td style="padding-top: 10px"><input type="checkbox" id="mirror" name="mirror" value="1" onchange="drawRotated()"></td>
<tr> </tr>
<td> <tr>
<td><label for="mirror">Pre-rotate Angle:</label></td>
<td><input type="number" id="prerotateangle" name="prerotateangle" value=0 min="-360" max="360" onchange="drawRotated()">Degrees</td>
</tr>
<tr>
<td><label for="mirror">Fine Alignment:</label></td>
<td><input type="number" id="finerotate" name="finerotate" value=0.0 min="-1" max="1" step="0.2" onchange="drawRotated()">Degrees</td>
</tr>
</table>
<table> <table>
<tr> <tr>
<td> <td><canvas id="canvas"></canvas></td>
<input type="submit" id="take" onclick="doTake()" value="Make new raw image (raw.jpg)"> </tr>
</td> <tr>
</tr> <td><input class="button" type="button" id="updatereferenceimage" value="Update Reference Image" onclick="SaveReference()"></td>
<tr> </tr>
<td> </table>
<label for="mirror">Mirror image</label>
</td>
<td>
<input type="checkbox" id="mirror" name="mirror" value="1" onchange="drawRotated()">
</td>
</tr>
<tr>
<td>
Pre-rotate Angle
</td>
<td>
<input type="number" id="prerotateangle" name="prerotateangle" value=0 min="-360" max="360" onchange="drawRotated()">°
</td>
</tr>
<tr>
<td>
Fine Alignment
</td>
<td>
<input type="number" id="finerotate" name="finerotate" value=0.0 min="-1" max="1" step="0.2" onchange="drawRotated()">°
</td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td>
<canvas id="canvas"></canvas>
</td>
</tr>
<tr>
<td>
<input type="button" id="updatereferenceimage" value="Update Reference Image" onclick="SaveReference()">
</td>
</tr>
</table>
</div>
<script type="text/javascript" src="./gethost.js"></script> <script type="text/javascript" src="./gethost.js"></script>
<script type="text/javascript" src="./readconfig.js"></script> <script type="text/javascript" src="./readconfig.js"></script>

View File

@@ -1,12 +1,17 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html style="width: fit-content">
<head> <head>
<style> <title>jomjol - AI on the edge</title>
.h_iframe iframe {width:995px;height:700px;} <meta charset="utf-8">
.h_iframe {width:995px;height:700px;} <meta name="viewport" content="width=device-width, initial-scale=1.0">
h1 {font-size: 2em;} <style>
h2 {font-size: 1.5em;} .h_iframe iframe {width:995px;height:605px;}
.h_iframe {width:995px;height:605px;}
h1 {font-size: 2em; margin-block-end: 0.3em;}
h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;} p {font-size: 1em;}
ul { ul {
@@ -80,18 +85,19 @@ li.dropdown {
<a href="index_configure.html">Edit Configuration</a> <a href="index_configure.html">Edit Configuration</a>
</div> </div>
</li> </li>
<li><a href="#"onclick="document.getElementById('maincontent').src = '/wasserzaehler.html?full';">Watermeter</a></li> <li><a href="#"onclick="document.getElementById('maincontent').src = '/wasserzaehler.html?full';">Recognition</a></li>
<li><a href="#"onclick="document.getElementById('maincontent').src = '/fileserver/';">File Server</a></li> <li><a href="#"onclick="document.getElementById('maincontent').src = '/fileserver/';">File Server</a></li>
<li class="dropdown"> <li class="dropdown">
<a href="javascript:void(0)" class="dropbtn">System</a> <a href="javascript:void(0)" class="dropbtn">System</a>
<div class="dropdown-content"> <div class="dropdown-content">
<a href="#"onclick="document.getElementById('maincontent').src = '/ota_page.html';">OTA Update</a> <a href="#"onclick="document.getElementById('maincontent').src = '/ota_page.html';">OTA Update</a>
<a href="#"onclick="document.getElementById('maincontent').src = '/fileserver/log.txt';">Log Viewer</a>
<a href="#"onclick="document.getElementById('maincontent').src = '/reboot_page.html';">Reboot</a> <a href="#"onclick="document.getElementById('maincontent').src = '/reboot_page.html';">Reboot</a>
</div> </div>
</ul> </ul>
<p> <p>
<div class="h_iframe"> <div class="h_iframe">
<iframe width="1020px" height="650px" name="maincontent" id ="maincontent" src="/wasserzaehler_roi.html" title="fileserver" allowfullscreen></iframe> <iframe name="maincontent" id ="maincontent" src="/wasserzaehler_roi.html" title="fileserver" allowfullscreen></iframe>
</div> </div>
</body> </body>

View File

@@ -1,77 +1,74 @@
<html><head> <!DOCTYPE html>
<title>jomjol - AI on the edge</title> <html>
<meta charset="utf-8"> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <title>jomjol - AI on the edge</title>
<style> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.h_iframe iframe {width:995px;height:765px;}
.h_iframe {width:995px;height:765px;}
.h_iframe iframe {width:995px;height:760px;} h1 {font-size: 2em; margin-block-end: 0.3em;}
.h_iframe {width:995px;height:760px;} h2 {font-size: 1.5em;margin-block-start: 0.3em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
h1 {font-size: 2em;} ul {
h2 {font-size: 1.5em;} list-style-type: none;
p {font-size: 1em;} margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
width:1000px;
}
ul { li {
list-style-type: none; float: left;
margin: 0; font-family: arial;
padding: 0; font-size: 18px;
overflow: hidden; }
background-color: #333;
width:1000px;
}
li { li a, .dropbtn {
float: left; display: inline-block;
font-family: arial; color: white;
font-size: 18px; text-align: center;
} padding: 14px 16px;
text-decoration: none;
}
li a, .dropbtn { li a:hover, .dropdown:hover .dropbtn {
display: inline-block; background-color: red;
color: white; }
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn { li.dropdown {
background-color: red; display: inline-block;
} }
li.dropdown { .dropdown-content {
display: inline-block; display: none;
} position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
font-family: arial;
}
.dropdown-content { .dropdown-content a {
display: none; color: black;
position: absolute; padding: 12px 16px;
background-color: #f9f9f9; text-decoration: none;
min-width: 160px; display: block;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); text-align: left;
z-index: 1; }
font-family: arial;
}
.dropdown-content a { .dropdown-content a:hover {background-color: #f1f1f1;}
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1;} .dropdown:hover .dropdown-content {
display: block;
.dropdown:hover .dropdown-content { }
display: block; </style>
}
</style>
<script type="text/javascript">
//<![CDATA[
//]]>
</script>
</head>
<body style="font-family: arial"> <body style="font-family: arial">

2
sd-card/html/jquery-3.5.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,15 +1,33 @@
<html><head> <!DOCTYPE html>
<title>jomjol - AI on the edge</title> <html>
<meta charset="utf-8"> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <title>OTA Update</title>
<script type="text/javascript"> <meta charset="utf-8">
//<![CDATA[
//]]> <style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
input[type=number] {
width: 138px;
padding: 10px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
.button {
padding: 10px 20px;
width: 211px;
font-size: 16px;
}
</style>
</script>
</head> </head>
<body style="font-family: arial"> <body style="font-family: arial; padding: 0px 10px;">
<h3>It is strongly recommended to update firmware and content of /html directory on SD-card at the same time!</h3> <h3>It is strongly recommended to update firmware and content of /html directory on SD-card at the same time!</h3>
<h2>1. Firmware Update</h2> <h2>1. Firmware Update</h2>
<table class="fixed" border="0"> <table class="fixed" border="0">
@@ -17,8 +35,8 @@
<td> <td>
<table border="0"> <table border="0">
<tr> <tr>
<td> <td style="width: 230px">
<label for="newfile">Select the firmware file</label> <label for="newfile">Select the firmware file:</label>
</td> </td>
<td colspan="2"> <td colspan="2">
<input id="newfile" type="file" onchange="setpath()" style="width:100%;"> <input id="newfile" type="file" onchange="setpath()" style="width:100%;">
@@ -26,7 +44,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="filepath">Set path on server</label> <label for="filepath">Set path on server:</label>
</td> </td>
<td> <td>
<input id="filepath" type="text" style="width:100%;" readonly> <input id="filepath" type="text" style="width:100%;" readonly>
@@ -40,19 +58,28 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<button id="doUpdate" type="button" onclick="doUpdate()">Flash the firmware</button> (Takes about 60s) <table border="0">
<tr>
<td style="width: 230px">
<button class="button" id="doUpdate" type="button" onclick="doUpdate()">Flash the firmware</button>
</td>
<td>
(Takes about 60s)
</td>
</tr>
</table>
</td> </td>
</tr> </tr>
</table> </table>
<h2>2. Update /html directory</h2> <h2>2. Update "/html" directory</h2>
<table class="fixed" border="0"> <table class="fixed" border="0">
<tr> <tr>
<td> <td>
<table border="0"> <table border="0">
<tr> <tr>
<td> <td style="width: 230px">
<label for="newfilehtml">Select the zipped /html content</label> <label for="newfilehtml">Select the zipped /html content:</label>
</td> </td>
<td colspan="2"> <td colspan="2">
<input id="newfilehtml" type="file" onchange="setpathhtml()" style="width:100%;"> <input id="newfilehtml" type="file" onchange="setpathhtml()" style="width:100%;">
@@ -60,7 +87,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="filepathhtml">Set path on server</label> <label for="filepathhtml">Set path on server:</label>
</td> </td>
<td> <td>
<input id="filepathhtml" type="text" style="width:100%;" readonly> <input id="filepathhtml" type="text" style="width:100%;" readonly>
@@ -74,7 +101,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<button id="doUpdatehtml" type="button" onclick="doUpdatehtml()">Update "/html" directory</button> <button class="button" id="doUpdatehtml" type="button" onclick="doUpdatehtml()">Update "/html" directory</button>
</td> </td>
</tr> </tr>
</table> </table>
@@ -82,7 +109,7 @@
<table class="fixed" border="0"> <table class="fixed" border="0">
<tr> <tr>
<td> <td>
<button id="reboot" type="button" onclick="doReboot()">Reboot to activate updates</button> <button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate updates</button>
</td> </td>
</tr> </tr>
</table> </table>
@@ -317,6 +344,5 @@ function uploadhtml() {
init(); init();
</script> </script>
</body>
</html>
</body></html>

View File

@@ -1,72 +1,48 @@
<html><head> <!DOCTYPE html>
<title>jomjol - AI on the edge</title> <html>
<meta charset="utf-8"> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <title>Set PreValue</title>
<script type="text/javascript"> <meta charset="utf-8">
//<![CDATA[
//]]>
</script>
</head>
<style> <style>
h1 {font-size: 2em;} h1 {font-size: 2em;}
h2 {font-size: 1.5em;} h2 {font-size: 1.5em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;} p {font-size: 1em;}
</style>
<script> div {
function includeHTML() { width: 200px;
var z, i, elmnt, file, xhttp; padding: 10px 5px;
/* Loop through a collection of all HTML elements: */ display: inline-block;
z = document.getElementsByTagName("*"); border: 1px solid #ccc;
for (i = 0; i < z.length; i++) { font-size: 16px;
elmnt = z[i]; max-height: 35px;
/*search for elements with a certain atrribute:*/
file = elmnt.getAttribute("w3-include-html");
if (file) {
/* Make an HTTP request using the attribute value as the file name: */
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {elmnt.innerHTML = this.responseText;}
if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
/* Remove the attribute, and call this function once more: */
elmnt.removeAttribute("w3-include-html");
includeHTML();
}
}
xhttp.open("GET", file, true);
xhttp.send();
/* Exit the function: */
return;
}
}
} }
input[type=number] {
width: 125px;
padding: 10px 5px;
display: inline-block;
border: 1px solid #ccc;
font-size: 16px;
}
.button {
padding: 10px 20px;
width: 211px;
font-size: 16px;
}
</style>
</head>
<script src="/jquery-3.5.1.min.js"></script>
<script>
$ (document).ready(function() {
$("#prevalue").load("/setPreValue.html");
});
</script> </script>
<body style="font-family: arial">
<table style="width:100%">
<tr>
<h2>Current Value:</h2><p>
<div w3-include-html="/setPreValue.html"></div>
</tr>
<tr>
<h2>Set Value:</h2><p>
Input (Format = 123.456):<p>
PreValue:
<input type="number" id="myInput" name="myInput"
pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
title="This should be a number with up to 4 decimal places.">
<button type="button" onclick="setprevalue()">Set PreValue</button>
</tr>
<tr>
<h2>Result:</h2><p>
<div id="result"> </div>
</tr>
</table>
<script> <script>
function setprevalue() { function setprevalue() {
var inputVal = document.getElementById("myInput").value; var inputVal = document.getElementById("myInput").value;
@@ -77,8 +53,29 @@ function setprevalue() {
} }
</script> </script>
<script> <body style="font-family: arial; padding: 0px 10px;">
includeHTML(); <h3>Set the previous value for consistency check and substitution for NaN</h3>
</script>
<table style="width:100%">
<tr>
<h2>Current Value:</h2><p>
<div id="prevalue"></div>
</tr>
<tr>
<h2>Set Value:</h2><p>
Input (Format = 123.456):<p>
PreValue:
<input type="number" id="myInput" name="myInput"
pattern="[0-9]+([\.,][0-9]+)?" step="0.001"
title="This should be a number with up to 4 decimal places.">
<p></p>
<button class="button" type="button" onclick="setprevalue()">Set PreValue</button>
</tr>
<tr>
<h2>Result:</h2><p>
<div id="result" readonly></div>
</tr>
</table>
</body></html> </body></html>

View File

@@ -1,22 +1,32 @@
<html><head> <!DOCTYPE html>
<title>jomjol - AI on the edge</title> <html>
<meta charset="utf-8"> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <title>Reboot</title>
<script type="text/javascript"> <meta charset="utf-8">
//<![CDATA[
//]]> <style>
h1 {font-size: 2em;}
h2 {font-size: 1.5em;}
h3 {font-size: 1.2em;}
p {font-size: 1em;}
.button {
padding: 10px 20px;
width: 211px;
font-size: 16px;
}
</style>
</script>
</head> </head>
<body style="font-family: arial"> <body style="font-family: arial; padding: 0px 10px;">
<h2>Do you really want to reboot your system now?</h2> <h3>Do you really want to reboot your ESP32 now?</h3>
<table class="fixed" border="0"> <table class="fixed" border="0">
<tr> <tr>
<td> <td>
<button id="reboot" type="button" onclick="doReboot()">Yes, please reboot now</button> <button class="button" id="reboot" type="button" onclick="doReboot()">Yes, please reboot</button>
</td> </td>
</tr> </tr>
</table> </table>
@@ -33,4 +43,5 @@ function doReboot() {
} }
</script> </script>
</body></html> </body>
</html>

View File

@@ -1,93 +1,107 @@
<html><head> <!DOCTYPE html>
<title>jomjol - AI on the edge</title> <html>
<meta charset="utf-8"> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <title>Overview</title>
<style type="text/css" media="screen"> <meta charset="utf-8">
.tg {border-collapse:collapse;border-spacing:0;width:100%;color: darkslategray;border: inset;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;} <style>
.tg th{font-family:Arial, sans-serif;font-size:24px;font-weight:bold;text-align:left;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;} .tg {border-collapse:collapse;border-spacing:0;width:100%;color: darkslategray;border: inset;height:585px;}
.tg .tg-hfl5{font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;} .tg td{font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
</style> .tg th{height: 55px;font-size:24px;font-weight:bold;text-align:left;padding:0px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;background-color:#f0f0f0}
.tg .tg-1{width:77%;font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
.tg .tg-2{font-size:20px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
.tg .tg-3{height: 15px;font-size:14px;font-family:Arial, Helvetica, sans-serif !important;border: inset;}
</style>
</head> </head>
<script src="/jquery-3.5.1.min.js"></script>
<script> <script>
function includeHTML() { function addZero(i) {
var z, i, elmnt, file, xhttp; if (i < 10) {
/* Loop through a collection of all HTML elements: */ i = "0" + i;
z = document.getElementsByTagName("*"); }
for (i = 0; i < z.length; i++) { return i;
elmnt = z[i]; }
/*search for elements with a certain atrribute:*/
file = elmnt.getAttribute("w3-include-html"); $ (document).ready(function() {
if (file) { var d = new Date();
/* Make an HTTP request using the attribute value as the file name: */ var h = addZero(d.getHours());
xhttp = new XMLHttpRequest(); var m = addZero(d.getMinutes());
xhttp.onreadystatechange = function() { var s = addZero(d.getSeconds());
if (this.readyState == 4) {
if (this.status == 200) {elmnt.innerHTML = this.responseText;} $('#img').html('<img src="/img_tmp/alg_roi.jpg" style="width:100%; max-height:555px;"></img>');
if (this.status == 404) {elmnt.innerHTML = "Page not found.";} $("#raw").load("/wasserzaehler.html?rawvalue=true");
/* Remove the attribute, and call this function once more: */ $("#corrected").load("/wasserzaehler.html");
elmnt.removeAttribute("w3-include-html"); $("#checked").load("/setPreValue.html");
includeHTML(); $("#start").load("/starttime");
} $('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
} refresh();
xhttp.open("GET", file, true); });
xhttp.send();
/* Exit the function: */ function refresh() {
return; setTimeout (function() {
} var time = new Date();
var timestamp = new Date().getTime();
var d = new Date();
var h = addZero(d.getHours());
var m = addZero(d.getMinutes());
var s = addZero(d.getSeconds());
// 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 +'" style="width:100%; max-height:555px;"></img>');
$("#raw").load("/wasserzaehler.html?rawvalue=true");
$("#corrected").load("/wasserzaehler.html");
$("#checked").load("/setPreValue.html");
$("#start").load("/starttime");
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
refresh();
}, 300000);
} }
}
</script> </script>
<body style="font-family: arial"> <body style="font-family: arial">
<table class="tg"> <table class="tg">
<tr> <tr>
<td class="tg-hfl5" rowspan="8"><img src="/img_tmp/alg_roi.jpg" alt="ROI-Image"></td> <td class="tg-1" rowspan="9"><div id="img"></div></td>
<th class="th"> <th class="th">Raw Value:</th>
Raw Value:
</th>
</tr> </tr>
<tr> <tr>
<td class="tg-hfl5"> <td class="tg-2">
<div w3-include-html="/wasserzaehler.html?rawvalue=true"></div> <div id="raw"></div>
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="th"> <th class="th">Corrected Value:</th>
Corrected Value:
</th>
</tr> </tr>
<tr> <tr>
<td class="tg-hfl5"> <td class="tg-2">
<div w3-include-html="/wasserzaehler.html"></div> <div id="corrected"></div>
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="th"> <th class="th">Checked Value:</th>
Checked Value:
</th>
</tr> </tr>
<tr> <tr>
<td class="tg-hfl5"> <td class="tg-2">
<div w3-include-html="/setPreValue.html"></div> <div id="checked"></div>
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="th"> <th class="th">Start Time:</th>
Start Time:
</th>
</tr> </tr>
<tr> <tr>
<td class="tg-hfl5"> <td class="tg-2">
<div w3-include-html="/starttime"></div> <div id="start"></div>
</td> </td>
</tr> </tr>
<tr>
<td class="tg-3">
<div id="timestamp"></div>
</td>
</tr>
</table> </table>
<script> </body>
includeHTML(); </html>
</script>
</body></html>

View File

@@ -1,2 +1,4 @@
ssid = "SSID" ssid = "SSID"
password = "PASSWORD" password = "PASSWORD"
hostname = "watermeter"
;hostname is optional