Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
480da7c38b | ||
|
|
d428abc12f | ||
|
|
a08144cc9f | ||
|
|
0868c22ac6 | ||
|
|
8ff17650dd | ||
|
|
5e037d7ab9 | ||
|
|
8d2ddc2f22 | ||
|
|
7963474bf0 | ||
|
|
a8aa6d6329 | ||
|
|
5b52b806ae | ||
|
|
b059713df5 | ||
|
|
48ec76ab38 | ||
|
|
fe446d60d7 | ||
|
|
9e2e0d4591 | ||
|
|
87935a23d4 | ||
|
|
2b178dcbd7 | ||
|
|
05cdc99079 | ||
|
|
51bca222c0 | ||
|
|
61bbe57018 | ||
|
|
9997539736 | ||
|
|
d142917afc | ||
|
|
41c1316575 | ||
|
|
d4be57f59e | ||
|
|
6a047d14a0 | ||
|
|
0d1b58542b | ||
|
|
bb05957d33 | ||
|
|
157b071a78 | ||
|
|
927b5e6e38 | ||
|
|
fb0fb551ff | ||
|
|
db02a306e9 | ||
|
|
7d84891813 | ||
|
|
e1a33003f0 | ||
|
|
64c7a171ae | ||
|
|
6a3cb6d9d9 | ||
|
|
efed040e9e | ||
|
|
2148f1031f | ||
|
|
6659456cb3 | ||
|
|
207cc585d9 | ||
|
|
df80124c57 | ||
|
|
dd1155dc89 | ||
|
|
4bbed42fb8 | ||
|
|
d70beb57fc | ||
|
|
954388e191 | ||
|
|
609d492442 | ||
|
|
60e9dd7506 | ||
|
|
f0d7bdadb7 | ||
|
|
677bf60113 | ||
|
|
a4c6a004b9 | ||
|
|
7a7fee68a4 | ||
|
|
b61280b388 | ||
|
|
c815f3f767 | ||
|
|
9fea3b4b3a | ||
|
|
3712c0ea7e | ||
|
|
7a7cfb493d | ||
|
|
5b84d40028 | ||
|
|
97adcec80e | ||
|
|
186a500a1e | ||
|
|
ac3edc9bec | ||
|
|
14705d0601 | ||
|
|
40953091d7 |
46
README.md
@@ -11,28 +11,56 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
|
||||
<img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/watermeter.jpg" width="600">
|
||||
<img src="https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/master/images/edit_reference.jpg" width="600">
|
||||
|
||||
|
||||
|
||||
## Change log
|
||||
|
||||
|
||||
|
||||
------
|
||||
|
||||
### Known Issues
|
||||
|
||||
* Parts of the web page only works correctly in **Firefox**!
|
||||
With **Chrome** or **Edge** not all parts (especially the configuration) is **not full functional**.
|
||||
* spontaneous reboot, especially in case of intensive web server access
|
||||
* spontaneous reboot, especially in case of intensive web server access (improved since v2.1.0)
|
||||
|
||||
------
|
||||
|
||||
**General remark:** beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
||||
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
||||
|
||||
|
||||
|
||||
##### Rolling - (2020-09-09)
|
||||
##### Rolling - (2020-09-25)
|
||||
|
||||
* tbd
|
||||
* based on v1.1.3 (2020-09-09)
|
||||
* 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
|
||||
|
||||
|
||||
|
||||
##### 2.0.0 Layout update (2020-09-12)
|
||||
|
||||
* Update to **new and modern layout**
|
||||
* Support for Chrome improved
|
||||
* Improved robustness: improved error handling in auto flow reduces spontaneous reboots
|
||||
* File server: Option for "DELETE ALL"
|
||||
* WLan: support of spaces in SSID and password
|
||||
* Reference Image: Option for mirror image, option for image update on the fly
|
||||
* additional parameter in `wasserzaehler.html?noerror=true` to suppress an potential error message
|
||||
* bug fixing
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ static const char *MAIN_TAG = "connect_wlan";
|
||||
|
||||
std::string ssid;
|
||||
std::string passphrase;
|
||||
std::string hostname;
|
||||
|
||||
std::string std_hostname = "watermeter";
|
||||
|
||||
static EventGroupHandle_t wifi_event_group;
|
||||
|
||||
@@ -28,10 +31,13 @@ static EventGroupHandle_t wifi_event_group;
|
||||
#define BLINK_GPIO GPIO_NUM_33
|
||||
|
||||
|
||||
std::vector<string> ZerlegeZeile(std::string input)
|
||||
std::vector<string> ZerlegeZeile(std::string input, std::string _delimiter = "")
|
||||
{
|
||||
std::vector<string> Output;
|
||||
std::string delimiter = " =,";
|
||||
if (_delimiter.length() > 0){
|
||||
delimiter = _delimiter;
|
||||
}
|
||||
|
||||
input = trim(input, delimiter);
|
||||
size_t pos = findDelimiterPos(input, delimiter);
|
||||
@@ -62,11 +68,11 @@ void wifi_connect(){
|
||||
ESP_ERROR_CHECK( esp_wifi_connect() );
|
||||
}
|
||||
|
||||
void blinkstatus(int dauer)
|
||||
void blinkstatus(int dauer, int _anzahl)
|
||||
{
|
||||
gpio_reset_pin(BLINK_GPIO);
|
||||
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int i = 0; i < _anzahl; ++i)
|
||||
{
|
||||
gpio_set_level(BLINK_GPIO, 0);
|
||||
vTaskDelay(dauer / portTICK_PERIOD_MS);
|
||||
@@ -79,15 +85,15 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
|
||||
{
|
||||
switch(event->event_id) {
|
||||
case SYSTEM_EVENT_STA_START:
|
||||
blinkstatus(200);
|
||||
blinkstatus(200, 5);
|
||||
wifi_connect();
|
||||
break;
|
||||
case SYSTEM_EVENT_STA_GOT_IP:
|
||||
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
|
||||
blinkstatus(1000);
|
||||
blinkstatus(1000, 3);
|
||||
break;
|
||||
case SYSTEM_EVENT_STA_DISCONNECTED:
|
||||
blinkstatus(200);
|
||||
blinkstatus(200, 5);
|
||||
esp_wifi_connect();
|
||||
xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
|
||||
break;
|
||||
@@ -97,33 +103,36 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
|
||||
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) );
|
||||
wifi_event_group = xEventGroupCreate();
|
||||
ssid = _ssid;
|
||||
passphrase = _passphrase;
|
||||
hostname = _hostname;
|
||||
esp_log_level_set("wifi", ESP_LOG_NONE); // disable wifi driver logging
|
||||
tcpip_adapter_init();
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
|
||||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||
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 ){
|
||||
ESP_LOGE(MAIN_TAG,"failed to set hostname:%d",ret);
|
||||
}
|
||||
xEventGroupWaitBits(wifi_event_group,CONNECTED_BIT,true,true,portMAX_DELAY);
|
||||
tcpip_adapter_ip_info_t 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 = "";
|
||||
std::vector<string> zerlegt;
|
||||
_hostname = std_hostname;
|
||||
|
||||
FILE* pFile;
|
||||
fn = FormatFileName(fn);
|
||||
@@ -140,11 +149,34 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
|
||||
while ((line.size() > 0) || !(feof(pFile)))
|
||||
{
|
||||
// printf("%s", line.c_str());
|
||||
zerlegt = ZerlegeZeile(line);
|
||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "SSID"))
|
||||
zerlegt = ZerlegeZeile(line, "=");
|
||||
zerlegt[0] = trim(zerlegt[0], " ");
|
||||
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")){
|
||||
_ssid = zerlegt[1];
|
||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "PASSWORD"))
|
||||
if ((_ssid[0] == '"') && (_ssid[_ssid.length()-1] == '"')){
|
||||
_ssid = _ssid.substr(1, _ssid.length()-2);
|
||||
}
|
||||
}
|
||||
|
||||
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "PASSWORD")){
|
||||
_passphrase = zerlegt[1];
|
||||
if ((_passphrase[0] == '"') && (_passphrase[_passphrase.length()-1] == '"')){
|
||||
_passphrase = _passphrase.substr(1, _passphrase.length()-2);
|
||||
}
|
||||
}
|
||||
|
||||
if (fgets(zw, 1024, pFile) == NULL)
|
||||
{
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
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
|
||||
@@ -140,13 +140,21 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath)
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
std::string _zw = std::string(dirpath);
|
||||
_zw = _zw.substr(8, _zw.length() - 8);
|
||||
_zw = "/delete/" + _zw + "?task=deldircontent";
|
||||
|
||||
|
||||
/* Send file-list table definition and column labels */
|
||||
httpd_resp_sendstr_chunk(req,
|
||||
"<table class=\"fixed\" border=\"1\">"
|
||||
"<col width=\"800px\" /><col width=\"300px\" /><col width=\"300px\" /><col width=\"100px\" />"
|
||||
"<thead><tr><th>Name</th><th>Type</th><th>Size (Bytes)</th><th>Delete<br><button id=\"deleteall\" type=\"button\" onclick=\"deleteall()\">DELETE ALL!</button></th></tr></thead>"
|
||||
"<tbody>");
|
||||
"<thead><tr><th>Name</th><th>Type</th><th>Size (Bytes)</th><th>Delete<br>"
|
||||
"<form method=\"post\" action=\"");
|
||||
httpd_resp_sendstr_chunk(req, _zw.c_str());
|
||||
httpd_resp_sendstr_chunk(req,
|
||||
"\"><button type=\"submit\">DELETE ALL!</button></form>"
|
||||
"</th></tr></thead><tbody>\n");
|
||||
|
||||
/* Iterate over all files / folders and fetch their names and sizes */
|
||||
while ((entry = readdir(dir)) != NULL) {
|
||||
@@ -460,12 +468,19 @@ static esp_err_t delete_post_handler(httpd_req_t *req)
|
||||
}
|
||||
zw = std::string(filename);
|
||||
zw = zw.substr(0, zw.length()-1);
|
||||
directory = "/fileserver" + zw + "/";
|
||||
zw = "/sdcard" + zw;
|
||||
printf("Directory to delete: %s\n", zw.c_str());
|
||||
|
||||
delete_all_in_directory(zw);
|
||||
directory = std::string(filepath);
|
||||
// directory = std::string(filepath);
|
||||
// directory = "/fileserver" + directory;
|
||||
printf("Location after delete directory content: %s\n", directory.c_str());
|
||||
/* Redirect onto root to see the updated file list */
|
||||
// httpd_resp_set_status(req, "303 See Other");
|
||||
// httpd_resp_set_hdr(req, "Location", directory.c_str());
|
||||
// httpd_resp_sendstr(req, "File deleted successfully");
|
||||
// return ESP_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -544,10 +559,12 @@ void delete_all_in_directory(std::string _directory)
|
||||
/* Iterate over all files / folders and fetch their names and sizes */
|
||||
while ((entry = readdir(dir)) != NULL) {
|
||||
if (!(entry->d_type == DT_DIR)){
|
||||
filename = _directory + "/" + std::string(entry->d_name);
|
||||
ESP_LOGI(TAG, "Deleting file : %s", filename.c_str());
|
||||
/* Delete file */
|
||||
unlink(filename.c_str());
|
||||
if (strcmp("wlan.ini", entry->d_name) != 0){ // auf wlan.ini soll nicht zugegriffen werden !!!
|
||||
filename = _directory + "/" + std::string(entry->d_name);
|
||||
ESP_LOGI(TAG, "Deleting file : %s", filename.c_str());
|
||||
/* Delete file */
|
||||
unlink(filename.c_str());
|
||||
}
|
||||
};
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
@@ -400,18 +400,21 @@ void task_reboot(void *pvParameter)
|
||||
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
||||
}
|
||||
|
||||
void doReboot(){
|
||||
LogFile.WriteToFile("Reboot - now");
|
||||
KillTFliteTasks();
|
||||
xTaskCreate(&task_reboot, "reboot", configMINIMAL_STACK_SIZE * 64, NULL, 10, NULL);
|
||||
}
|
||||
|
||||
|
||||
esp_err_t handler_reboot(httpd_req_t *req)
|
||||
{
|
||||
LogFile.WriteToFile("handler_reboot");
|
||||
ESP_LOGI(TAGPARTOTA, "!!! System will restart within 5 sec!!!");
|
||||
|
||||
const char* resp_str = "!!! System will restart within 5 sec!!!";
|
||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
||||
|
||||
KillTFliteTasks();
|
||||
|
||||
xTaskCreate(&task_reboot, "reboot", configMINIMAL_STACK_SIZE * 64, NULL, 10, NULL);
|
||||
doReboot();
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -7,4 +7,5 @@
|
||||
static const char *TAGPARTOTA = "server_ota";
|
||||
|
||||
void register_server_ota_sdcard_uri(httpd_handle_t server);
|
||||
void CheckOTAUpdate();
|
||||
void CheckOTAUpdate();
|
||||
void doReboot();
|
||||
@@ -1,11 +1,14 @@
|
||||
#include "ClassFlowAlignment.h"
|
||||
|
||||
#include "ClassLogFile.h"
|
||||
|
||||
ClassFlowAlignment::ClassFlowAlignment()
|
||||
{
|
||||
initalrotate = 0;
|
||||
anz_ref = 0;
|
||||
suchex = 40;
|
||||
suchey = 40;
|
||||
initialmirror = false;
|
||||
namerawimage = "/sdcard/img_tmp/raw.jpg";
|
||||
ListFlowControll = NULL;
|
||||
}
|
||||
@@ -16,6 +19,7 @@ ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow*>* lfc)
|
||||
anz_ref = 0;
|
||||
suchex = 40;
|
||||
suchey = 40;
|
||||
initialmirror = false;
|
||||
namerawimage = "/sdcard/img_tmp/raw.jpg";
|
||||
ListFlowControll = lfc;
|
||||
}
|
||||
@@ -36,7 +40,12 @@ bool ClassFlowAlignment::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||
{
|
||||
zerlegt = this->ZerlegeZeile(aktparamgraph);
|
||||
if ((zerlegt[0] == "InitalRotate") && (zerlegt.size() > 1))
|
||||
if ((zerlegt[0] == "InitialMirror") && (zerlegt.size() > 1))
|
||||
{
|
||||
if (toUpper(zerlegt[1]) == "TRUE")
|
||||
initialmirror = true;
|
||||
}
|
||||
if (((zerlegt[0] == "InitalRotate") || (zerlegt[0] == "InitialRotate")) && (zerlegt.size() > 1))
|
||||
{
|
||||
this->initalrotate = std::stod(zerlegt[1]);
|
||||
}
|
||||
@@ -78,16 +87,39 @@ bool ClassFlowAlignment::doFlow(string time)
|
||||
string output3 = "/sdcard/img_tmp/rot_roi.jpg";
|
||||
string output2 = "/sdcard/img_tmp/alg.jpg";
|
||||
string output4 = "/sdcard/img_tmp/alg_roi.jpg";
|
||||
string output1 = "/sdcard/img_tmp/mirror.jpg";
|
||||
|
||||
input = FormatFileName(input);
|
||||
output = FormatFileName(output);
|
||||
output2 = FormatFileName(output2);
|
||||
|
||||
CRotate *rt;
|
||||
|
||||
if (initialmirror){
|
||||
CRotate *rt;
|
||||
rt = new CRotate(input);
|
||||
if (!rt->ImageOkay()){
|
||||
LogFile.WriteToFile("ClassFlowAlignment::doFlow CRotate Inital Mirror raw.jpg not okay!");
|
||||
delete rt;
|
||||
return false;
|
||||
}
|
||||
printf("do mirror\n");
|
||||
rt->Mirror();
|
||||
rt->SaveToFile(output1);
|
||||
input = output1;
|
||||
delete rt;
|
||||
}
|
||||
|
||||
|
||||
if (initalrotate != 0)
|
||||
{
|
||||
CRotate *rt = NULL;
|
||||
printf("Load rotationfile: %s\n", input.c_str());
|
||||
rt = new CRotate(input);
|
||||
if (!rt->ImageOkay()){
|
||||
LogFile.WriteToFile("ClassFlowAlignment::doFlow CRotate raw.jpg not okay!");
|
||||
delete rt;
|
||||
return false;
|
||||
}
|
||||
rt->Rotate(this->initalrotate);
|
||||
rt->SaveToFile(output);
|
||||
delete rt;
|
||||
|
||||
@@ -12,6 +12,7 @@ class ClassFlowAlignment :
|
||||
{
|
||||
protected:
|
||||
float initalrotate;
|
||||
bool initialmirror;
|
||||
string reffilename[2];
|
||||
int ref_x[2], ref_y[2];
|
||||
int anz_ref;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "CTfLiteClass.h"
|
||||
#endif
|
||||
|
||||
#include "ClassLogFile.h"
|
||||
|
||||
ClassFlowAnalog::ClassFlowAnalog()
|
||||
{
|
||||
isLogImage = false;
|
||||
@@ -140,7 +142,10 @@ string ClassFlowAnalog::getHTMLSingleStep(string host)
|
||||
|
||||
bool ClassFlowAnalog::doFlow(string time)
|
||||
{
|
||||
doAlignAndCut(time);
|
||||
if (!doAlignAndCut(time)){
|
||||
return false;
|
||||
};
|
||||
|
||||
doNeuralNetwork(time);
|
||||
|
||||
return true;
|
||||
@@ -160,6 +165,12 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
|
||||
CImageBasis *img_roi = NULL;
|
||||
CAlignAndCutImage *caic = new CAlignAndCutImage(input);
|
||||
|
||||
if (!caic->ImageOkay()){
|
||||
LogFile.WriteToFile("ClassFlowAnalog::doAlignAndCut not okay!");
|
||||
delete caic;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (input_roi.length() > 0)
|
||||
img_roi = new CImageBasis(input_roi);
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#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;
|
||||
@@ -73,15 +74,15 @@ ClassFlow* ClassFlowControll::CreateClassFlow(std::string _type)
|
||||
|
||||
_type = trim(_type);
|
||||
|
||||
if (_type.compare("[MakeImage]") == 0)
|
||||
if (toUpper(_type).compare("[MAKEIMAGE]") == 0)
|
||||
cfc = new ClassFlowMakeImage(&FlowControll);
|
||||
if (_type.compare("[Alignment]") == 0)
|
||||
if (toUpper(_type).compare("[ALIGNMENT]") == 0)
|
||||
cfc = new ClassFlowAlignment(&FlowControll);
|
||||
if (_type.compare("[Analog]") == 0)
|
||||
if (toUpper(_type).compare("[ANALOG]") == 0)
|
||||
cfc = new ClassFlowAnalog(&FlowControll);
|
||||
if (_type.compare("[Digits]") == 0)
|
||||
if (toUpper(_type).compare("[DIGITS]") == 0)
|
||||
cfc = new ClassFlowDigit(&FlowControll);
|
||||
if (_type.compare("[PostProcessing]") == 0)
|
||||
if (toUpper(_type).compare("[POSTPROCESSING]") == 0)
|
||||
{
|
||||
cfc = new ClassFlowPostProcessing(&FlowControll);
|
||||
flowpostprocessing = (ClassFlowPostProcessing*) cfc;
|
||||
@@ -90,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
|
||||
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;
|
||||
|
||||
return cfc;
|
||||
}
|
||||
|
||||
@@ -144,23 +148,39 @@ 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);
|
||||
result = result && FlowControll[i]->doFlow(time);
|
||||
if (!FlowControll[i]->doFlow(time)){
|
||||
repeat++;
|
||||
LogFile.WriteToFile("Fehler im vorheriger Schritt - wird zum " + to_string(repeat) + ". Mal wiederholt");
|
||||
i = i-2; // vorheriger Schritt muss wiederholt werden (vermutlich Bilder aufnehmen)
|
||||
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)
|
||||
string ClassFlowControll::getReadout(bool _rawvalue = false, bool _noerror = false)
|
||||
{
|
||||
if (flowpostprocessing)
|
||||
return flowpostprocessing->getReadoutParam(_rawvalue);
|
||||
return flowpostprocessing->getReadoutParam(_rawvalue, _noerror);
|
||||
|
||||
string zw = "";
|
||||
string result = "";
|
||||
@@ -230,23 +250,34 @@ bool ClassFlowControll::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||
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;
|
||||
|
||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(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")
|
||||
{
|
||||
AutoStart = true;
|
||||
}
|
||||
}
|
||||
if ((zerlegt[0] == "Intervall") && (zerlegt.size() > 1))
|
||||
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);
|
||||
}
|
||||
if (toUpper(zerlegt[1]) == "FALSE")
|
||||
{
|
||||
LogFile.SwitchOnOff(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ protected:
|
||||
public:
|
||||
void InitFlow(std::string config);
|
||||
bool doFlow(string time);
|
||||
string getReadout(bool _rawvalue);
|
||||
string getReadout(bool _rawvalue, bool _noerror);
|
||||
string UpdatePrevalue(std::string _newvalue);
|
||||
string GetPrevalue();
|
||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
// #include "bitmap_image.hpp"
|
||||
|
||||
#include "ClassLogFile.h"
|
||||
|
||||
ClassFlowDigit::ClassFlowDigit()
|
||||
{
|
||||
isLogImage = false;
|
||||
@@ -119,7 +121,10 @@ string ClassFlowDigit::getHTMLSingleStep(string host)
|
||||
|
||||
bool ClassFlowDigit::doFlow(string time)
|
||||
{
|
||||
doAlignAndCut(time);
|
||||
if (!doAlignAndCut(time)){
|
||||
return false;
|
||||
};
|
||||
|
||||
doNeuralNetwork(time);
|
||||
|
||||
return true;
|
||||
@@ -138,6 +143,11 @@ bool ClassFlowDigit::doAlignAndCut(string time)
|
||||
CResizeImage *rs;
|
||||
CImageBasis *img_roi = NULL;
|
||||
CAlignAndCutImage *caic = new CAlignAndCutImage(input);
|
||||
if (!caic->ImageOkay()){
|
||||
LogFile.WriteToFile("ClassFlowDigit::doAlignAndCut not okay!");
|
||||
delete caic;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (input_roi.length() > 0)
|
||||
img_roi = new CImageBasis(input_roi);
|
||||
|
||||
@@ -12,7 +12,19 @@
|
||||
|
||||
string ClassFlowPostProcessing::GetPreValue()
|
||||
{
|
||||
return to_string(PreValue);
|
||||
std::string result;
|
||||
result = to_string(PreValue);
|
||||
|
||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||
{
|
||||
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
|
||||
{
|
||||
int AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
|
||||
result = RundeOutput(PreValue, AnzahlAnalog - DecimalShift);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ClassFlowPostProcessing::LoadPreValue(void)
|
||||
@@ -56,6 +68,22 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
|
||||
difference /= 60;
|
||||
if (difference > PreValueAgeStartup)
|
||||
return false;
|
||||
|
||||
Value = PreValue;
|
||||
ReturnValue = to_string(Value);
|
||||
ReturnValueNoError = ReturnValue;
|
||||
|
||||
// falls es Analog gibt, dann die Anzahl der Nachkommastellen feststellen und entsprechend runden:
|
||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||
{
|
||||
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
|
||||
{
|
||||
int AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
|
||||
ReturnValue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||
ReturnValueNoError = ReturnValue;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -102,6 +130,7 @@ ClassFlowPostProcessing::ClassFlowPostProcessing()
|
||||
PreValueOkay = false;
|
||||
useMaxRateValue = false;
|
||||
checkDigitIncreaseConsistency = false;
|
||||
DecimalShift = 0;
|
||||
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
||||
}
|
||||
|
||||
@@ -115,11 +144,13 @@ ClassFlowPostProcessing::ClassFlowPostProcessing(std::vector<ClassFlow*>* lfc)
|
||||
ListFlowControll = NULL;
|
||||
PreValueOkay = false;
|
||||
useMaxRateValue = false;
|
||||
checkDigitIncreaseConsistency = false;
|
||||
checkDigitIncreaseConsistency = false;
|
||||
DecimalShift = 0;
|
||||
FilePreValue = FormatFileName("/sdcard/config/prevalue.ini");
|
||||
ListFlowControll = lfc;
|
||||
}
|
||||
|
||||
|
||||
bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||
{
|
||||
std::vector<string> zerlegt;
|
||||
@@ -137,56 +168,92 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(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;
|
||||
PreValueOkay = LoadPreValue();
|
||||
if (PreValueOkay)
|
||||
{
|
||||
Value = PreValue;
|
||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||
{
|
||||
if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
|
||||
{
|
||||
int AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
|
||||
std::stringstream stream;
|
||||
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
|
||||
ReturnValue = stream.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((zerlegt[0] == "CheckDigitIncreaseConsistency") && (zerlegt.size() > 1))
|
||||
if ((toUpper(zerlegt[0]) == "CHECKDIGITINCREASECONSISTENCY") && (zerlegt.size() > 1))
|
||||
{
|
||||
if (toUpper(zerlegt[1]) == "TRUE")
|
||||
checkDigitIncreaseConsistency = true;
|
||||
}
|
||||
if ((zerlegt[0] == "AllowNegativeRates") && (zerlegt.size() > 1))
|
||||
if ((toUpper(zerlegt[0]) == "ALLOWNEGATIVERATES") && (zerlegt.size() > 1))
|
||||
{
|
||||
if (toUpper(zerlegt[1]) == "TRUE")
|
||||
AllowNegativeRates = true;
|
||||
}
|
||||
if ((zerlegt[0] == "ErrorMessage") && (zerlegt.size() > 1))
|
||||
if ((toUpper(zerlegt[0]) == "ERRORMESSAGE") && (zerlegt.size() > 1))
|
||||
{
|
||||
if (toUpper(zerlegt[1]) == "TRUE")
|
||||
ErrorMessage = true;
|
||||
}
|
||||
if ((zerlegt[0] == "PreValueAgeStartup") && (zerlegt.size() > 1))
|
||||
if ((toUpper(zerlegt[0]) == "PREVALUEAGESTARTUP") && (zerlegt.size() > 1))
|
||||
{
|
||||
PreValueAgeStartup = std::stoi(zerlegt[1]);
|
||||
}
|
||||
if ((zerlegt[0] == "MaxRateValue") && (zerlegt.size() > 1))
|
||||
if ((toUpper(zerlegt[0]) == "MAXRATEVALUE") && (zerlegt.size() > 1))
|
||||
{
|
||||
useMaxRateValue = true;
|
||||
MaxRateValue = std::stof(zerlegt[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (PreValueUse) {
|
||||
PreValueOkay = LoadPreValue();
|
||||
}
|
||||
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)
|
||||
{
|
||||
string result = "";
|
||||
@@ -195,7 +262,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
||||
string zwvalue;
|
||||
bool isdigit = false;
|
||||
bool isanalog = false;
|
||||
int AnzahlNachkomma = 0;
|
||||
int AnzahlAnalog = 0;
|
||||
string zw;
|
||||
string error = "";
|
||||
time_t imagetime = 0;
|
||||
@@ -215,7 +282,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
||||
{
|
||||
isanalog = true;
|
||||
analog = (*ListFlowControll)[i]->getReadout();
|
||||
AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
|
||||
AnzahlAnalog = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,17 +301,19 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
||||
// isdigit = true; digit = "12N";
|
||||
// isanalog = true; analog = "456";
|
||||
|
||||
if (isdigit)
|
||||
ReturnRawValue = digit;
|
||||
if (isdigit && isanalog)
|
||||
ReturnRawValue = ReturnRawValue + ".";
|
||||
if (isanalog)
|
||||
ReturnRawValue = ReturnRawValue + analog;
|
||||
|
||||
ReturnRawValue = ShiftDecimal(ReturnRawValue, DecimalShift);
|
||||
|
||||
if (!PreValueUse || !PreValueOkay)
|
||||
{
|
||||
if (isdigit)
|
||||
ReturnValue = digit;
|
||||
if (isdigit && isanalog)
|
||||
ReturnValue = ReturnValue + ".";
|
||||
if (isanalog)
|
||||
ReturnValue = ReturnValue + analog;
|
||||
|
||||
ReturnRawValue = ReturnValue;
|
||||
ReturnValue = ReturnRawValue;
|
||||
ReturnValueNoError = ReturnRawValue;
|
||||
|
||||
if ((findDelimiterPos(ReturnValue, "N") == std::string::npos) && (ReturnValue.length() > 0))
|
||||
{
|
||||
@@ -253,57 +322,35 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
||||
ReturnValue.erase(0, 1);
|
||||
}
|
||||
Value = std::stof(ReturnValue);
|
||||
ReturnValueNoError = ReturnValue;
|
||||
|
||||
SavePreValue(Value, zwtime);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isdigit)
|
||||
ReturnRawValue = digit;
|
||||
if (isdigit && isanalog)
|
||||
ReturnRawValue = ReturnRawValue + ".";
|
||||
if (isanalog)
|
||||
ReturnRawValue = ReturnRawValue + analog;
|
||||
|
||||
if (isdigit)
|
||||
{
|
||||
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;
|
||||
zw = ErsetzteN(ReturnRawValue);
|
||||
|
||||
Value = std::stof(zw);
|
||||
|
||||
std::stringstream stream;
|
||||
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
|
||||
zwvalue = stream.str();
|
||||
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||
|
||||
if ((!AllowNegativeRates) && (Value < PreValue))
|
||||
{
|
||||
error = "Negative Rate - Returned old value - read value: " + zwvalue;
|
||||
Value = PreValue;
|
||||
stream.str("");
|
||||
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
|
||||
zwvalue = stream.str();
|
||||
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||
}
|
||||
|
||||
if (useMaxRateValue && (abs(Value - PreValue) > MaxRateValue))
|
||||
else
|
||||
{
|
||||
error = "Rate too high - Returned old value - read value: " + zwvalue;
|
||||
Value = PreValue;
|
||||
stream.str("");
|
||||
stream << std::fixed << std::setprecision(AnzahlNachkomma) << Value;
|
||||
zwvalue = stream.str();
|
||||
if (useMaxRateValue && (abs(Value - PreValue) > MaxRateValue))
|
||||
{
|
||||
error = "Rate too high - Returned old value - read value: " + zwvalue;
|
||||
Value = PreValue;
|
||||
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValueNoError = zwvalue;
|
||||
ReturnValue = zwvalue;
|
||||
if (ErrorMessage && (error.length() > 0))
|
||||
ReturnValue = ReturnValue + "\t" + error;
|
||||
@@ -319,26 +366,43 @@ string ClassFlowPostProcessing::getReadout()
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
string ClassFlowPostProcessing::getReadoutParam(bool _rawValue)
|
||||
string ClassFlowPostProcessing::getReadoutParam(bool _rawValue, bool _noerror)
|
||||
{
|
||||
if (_rawValue)
|
||||
return ReturnRawValue;
|
||||
if (_noerror)
|
||||
return ReturnValueNoError;
|
||||
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 pot, ziffer;
|
||||
float zw;
|
||||
|
||||
posN = findDelimiterPos(input, "N");
|
||||
posPunkt = input.length();
|
||||
posPunkt = findDelimiterPos(input, ".");
|
||||
if (posPunkt == std::string::npos){
|
||||
posPunkt = input.length();
|
||||
}
|
||||
|
||||
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);
|
||||
ziffer = ((int) zw) % 10;
|
||||
input[posN] = ziffer + 48;
|
||||
@@ -346,17 +410,15 @@ string ClassFlowPostProcessing::ErsetzteN(string input, int lastvalueanalog = -1
|
||||
posN = findDelimiterPos(input, "N");
|
||||
}
|
||||
|
||||
///////////////////////////// TestCode
|
||||
/*
|
||||
input = "10";
|
||||
posPunkt = input.length();
|
||||
PreValue = 9.5;
|
||||
lastvalueanalog = 7;
|
||||
*/
|
||||
return input;
|
||||
}
|
||||
|
||||
string ClassFlowPostProcessing::checkDigitConsistency(string input, int _decilamshift, int lastvalueanalog){
|
||||
/*
|
||||
if (checkDigitIncreaseConsistency && lastvalueanalog > -1)
|
||||
{
|
||||
int zifferIST;
|
||||
int substrakt = 0;
|
||||
// int substrakt = 0;
|
||||
bool lastcorrected = false;
|
||||
for (int i = input.length() - 1; i >= 0; --i)
|
||||
{
|
||||
@@ -383,7 +445,7 @@ string ClassFlowPostProcessing::ErsetzteN(string input, int lastvalueanalog = -1
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
return input;
|
||||
}
|
||||
|
||||
@@ -16,17 +16,21 @@ protected:
|
||||
bool ErrorMessage;
|
||||
bool PreValueOkay;
|
||||
bool checkDigitIncreaseConsistency;
|
||||
int DecimalShift;
|
||||
|
||||
string FilePreValue;
|
||||
float PreValue;
|
||||
float Value;
|
||||
string ReturnValue;
|
||||
string ReturnRawValue;
|
||||
float PreValue; // letzter Wert, der gut ausgelesen wurde
|
||||
float Value; // letzer ausgelesener Wert, inkl. Korrekturen
|
||||
string ReturnRawValue; // Rohwert (mit N & führenden 0)
|
||||
string ReturnValue; // korrigierter Rückgabewert, ggf. mit Fehlermeldung
|
||||
string ReturnValueNoError; // korrigierter Rückgabewert ohne Fehlermeldung
|
||||
|
||||
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:
|
||||
ClassFlowPostProcessing();
|
||||
@@ -34,7 +38,7 @@ public:
|
||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
||||
bool doFlow(string time);
|
||||
string getReadout();
|
||||
string getReadoutParam(bool _rawValue);
|
||||
string getReadoutParam(bool _rawValue, bool _noerror);
|
||||
void SavePreValue(float value, string time = "");
|
||||
string GetPreValue();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -167,3 +167,9 @@ string toUpper(string in)
|
||||
return in;
|
||||
}
|
||||
|
||||
// CPU Temp
|
||||
extern "C" uint8_t temprature_sens_read();
|
||||
float temperatureRead()
|
||||
{
|
||||
return (temprature_sens_read() - 32) / 1.8;
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ string getFileType(string filename);
|
||||
|
||||
string toUpper(string in);
|
||||
|
||||
|
||||
float temperatureRead();
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#ifndef __CFINDTEMPLATE
|
||||
#define __CFINGTEMPLATE
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
#include <esp_heap_caps.h>
|
||||
|
||||
#include "stb_image.h"
|
||||
#include "stb_image_write.h"
|
||||
#include "stb_image_resize.h"
|
||||
|
||||
|
||||
|
||||
class CImageBasis
|
||||
{
|
||||
protected:
|
||||
uint8_t* rgb_image;
|
||||
int channels;
|
||||
int width, height, bpp;
|
||||
bool externalImage;
|
||||
std::string filename;
|
||||
|
||||
void memCopy(uint8_t* _source, uint8_t* _target, int _size);
|
||||
public:
|
||||
int getWidth(){return this->width;};
|
||||
int getHeight(){return this->width;};
|
||||
int getChannels(){return this->channels;};
|
||||
|
||||
CImageBasis();
|
||||
CImageBasis(std::string _image);
|
||||
CImageBasis(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp);
|
||||
uint8_t GetPixelColor(int x, int y, int ch);
|
||||
|
||||
~CImageBasis();
|
||||
|
||||
void SaveToFile(std::string _imageout);
|
||||
};
|
||||
|
||||
class CFindTemplate : public CImageBasis
|
||||
{
|
||||
public:
|
||||
CFindTemplate(std::string _image);
|
||||
|
||||
void FindTemplate(std::string _template, int* found_x, int* found_y, std::string _imageout);
|
||||
void FindTemplate(std::string _template, int* found_x, int* found_y, int _dx, int _dy, std::string _imageout);
|
||||
void FindTemplate(std::string _template, int* found_x, int* found_y);
|
||||
void FindTemplate(std::string _template, int* found_x, int* found_y, int _dx, int _dy);
|
||||
};
|
||||
|
||||
class CRotate: public CImageBasis
|
||||
{
|
||||
public:
|
||||
CRotate(std::string _image) : CImageBasis(_image) {};
|
||||
CRotate(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {};
|
||||
|
||||
void Rotate(float _angle);
|
||||
void Rotate(float _angle, int _centerx, int _centery);
|
||||
void Translate(int _dx, int _dy);
|
||||
};
|
||||
|
||||
|
||||
class CAlignAndCutImage : public CImageBasis
|
||||
{
|
||||
public:
|
||||
CAlignAndCutImage(std::string _image) : CImageBasis(_image) {};
|
||||
|
||||
void Align(std::string _template0, int ref0_x, int ref0_y, std::string _template1, int ref1_x, int ref1_y, int deltax, int deltay);
|
||||
void CutAndSave(std::string _template1, int x1, int y1, int dx, int dy);
|
||||
};
|
||||
|
||||
|
||||
class CResizeImage : public CImageBasis
|
||||
{
|
||||
public:
|
||||
CResizeImage(std::string _image) : CImageBasis(_image) {};
|
||||
void Resize(int _new_dx, int _new_dy);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,366 +0,0 @@
|
||||
#include "CFindTemplate.h"
|
||||
#include "Helper.h"
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
|
||||
#define _ESP32_PSRAM
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define GET_MEMORY malloc
|
||||
|
||||
|
||||
uint8_t CImageBasis::GetPixelColor(int x, int y, int ch)
|
||||
{
|
||||
stbi_uc* p_source;
|
||||
p_source = this->rgb_image + (this->channels * (y * this->width + x));
|
||||
return p_source[channels];
|
||||
}
|
||||
|
||||
void CResizeImage::Resize(int _new_dx, int _new_dy)
|
||||
{
|
||||
int memsize = _new_dx * _new_dy * this->channels;
|
||||
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
|
||||
|
||||
stbir_resize_uint8(this->rgb_image, this->width, this->height, 0, odata, _new_dx, _new_dy, 0, this->channels);
|
||||
|
||||
stbi_image_free(this->rgb_image);
|
||||
this->rgb_image = (unsigned char*)GET_MEMORY(memsize);
|
||||
|
||||
this->memCopy(odata, this->rgb_image, memsize);
|
||||
this->width = _new_dx;
|
||||
this->height = _new_dy;
|
||||
stbi_image_free(odata);
|
||||
}
|
||||
|
||||
void CRotate::Rotate(float _angle, int _centerx, int _centery)
|
||||
{
|
||||
float m[2][3];
|
||||
|
||||
float x_center = _centerx;
|
||||
float y_center = _centery;
|
||||
_angle = _angle / 180 * M_PI;
|
||||
|
||||
m[0][0] = cos(_angle);
|
||||
m[0][1] = sin(_angle);
|
||||
m[0][2] = (1 - m[0][0]) * x_center - m[0][1] * y_center;
|
||||
|
||||
m[1][0] = -m[0][1];
|
||||
m[1][1] = m[0][0];
|
||||
m[1][2] = m[0][1] * x_center + (1 - m[0][0]) * y_center;
|
||||
|
||||
int memsize = this->width * this->height * this->channels;
|
||||
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
|
||||
|
||||
int x_source, y_source;
|
||||
stbi_uc* p_target;
|
||||
stbi_uc* p_source;
|
||||
|
||||
for (int x = 0; x < this->width; ++x)
|
||||
for (int y = 0; y < this->height; ++y)
|
||||
{
|
||||
p_target = odata + (this->channels * (y * this->width + x));
|
||||
|
||||
x_source = int(m[0][0] * x + m[0][1] * y);
|
||||
y_source = int(m[1][0] * x + m[1][1] * y);
|
||||
|
||||
x_source += int(m[0][2]);
|
||||
y_source += int(m[1][2]);
|
||||
|
||||
if ((x_source >= 0) && (x_source < this->width) && (y_source >= 0) && (y_source < this->height))
|
||||
{
|
||||
p_source = this->rgb_image + (this->channels * (y_source * this->width + x_source));
|
||||
for (int channels = 0; channels < this->channels; ++channels)
|
||||
p_target[channels] = p_source[channels];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int channels = 0; channels < this->channels; ++channels)
|
||||
p_target[channels] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
// memcpy(this->rgb_image, odata, memsize);
|
||||
this->memCopy(odata, this->rgb_image, memsize);
|
||||
stbi_image_free(odata);
|
||||
}
|
||||
|
||||
void CRotate::Rotate(float _angle)
|
||||
{
|
||||
this->Rotate(_angle, this->width / 2, this->height / 2);
|
||||
}
|
||||
|
||||
void CRotate::Translate(int _dx, int _dy)
|
||||
{
|
||||
int memsize = this->width * this->height * this->channels;
|
||||
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
|
||||
|
||||
|
||||
int x_source, y_source;
|
||||
stbi_uc* p_target;
|
||||
stbi_uc* p_source;
|
||||
|
||||
for (int x = 0; x < this->width; ++x)
|
||||
for (int y = 0; y < this->height; ++y)
|
||||
{
|
||||
p_target = odata + (this->channels * (y * this->width + x));
|
||||
|
||||
x_source = x - _dx;
|
||||
y_source = y - _dy;
|
||||
|
||||
if ((x_source >= 0) && (x_source < this->width) && (y_source >= 0) && (y_source < this->height))
|
||||
{
|
||||
p_source = this->rgb_image + (this->channels * (y_source * this->width + x_source));
|
||||
for (int channels = 0; channels < this->channels; ++channels)
|
||||
p_target[channels] = p_source[channels];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int channels = 0; channels < this->channels; ++channels)
|
||||
p_target[channels] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
// memcpy(this->rgb_image, odata, memsize);
|
||||
this->memCopy(odata, this->rgb_image, memsize);
|
||||
stbi_image_free(odata);
|
||||
}
|
||||
|
||||
|
||||
|
||||
CFindTemplate::CFindTemplate(std::string _image)
|
||||
{
|
||||
this->channels = 1;
|
||||
this->rgb_image = stbi_load(_image.c_str(), &(this->width), &(this->height), &(this->bpp), this->channels);
|
||||
}
|
||||
|
||||
void CFindTemplate::FindTemplate(std::string _template, int* found_x, int* found_y)
|
||||
{
|
||||
this->FindTemplate(_template, found_x, found_y, 0, 0);
|
||||
}
|
||||
|
||||
void CFindTemplate::FindTemplate(std::string _template, int* found_x, int* found_y, int _dx, int _dy)
|
||||
{
|
||||
int tpl_width, tpl_height, tpl_bpp;
|
||||
uint8_t* rgb_template = stbi_load(_template.c_str(), &tpl_width, &tpl_height, &tpl_bpp, this->channels);
|
||||
|
||||
int ow, ow_start, ow_stop;
|
||||
int oh, oh_start, oh_stop;
|
||||
|
||||
if (_dx == 0)
|
||||
{
|
||||
_dx = this->width;
|
||||
*found_x = 0;
|
||||
}
|
||||
|
||||
if (_dy == 0)
|
||||
{
|
||||
_dy = this->height;
|
||||
*found_y = 0;
|
||||
}
|
||||
|
||||
|
||||
ow_start = *found_x - _dx;
|
||||
ow_start = std::max(ow_start, 0);
|
||||
ow_stop = *found_x + _dx;
|
||||
if ((ow_stop + tpl_width) > this->width)
|
||||
ow_stop = this->width - tpl_width;
|
||||
ow = ow_stop - ow_start + 1;
|
||||
|
||||
oh_start = *found_y - _dy;
|
||||
oh_start = std::max(oh_start, 0);
|
||||
oh_stop = *found_y + _dy;
|
||||
if ((oh_stop + tpl_height) > this->height)
|
||||
oh_stop = this->height - tpl_height;
|
||||
oh = oh_stop - oh_start + 1;
|
||||
|
||||
uint8_t* odata = (unsigned char*)GET_MEMORY(ow * oh * this->channels);
|
||||
|
||||
double aktSAD;
|
||||
double minSAD = pow(tpl_width * tpl_height * 255, 2);
|
||||
|
||||
for (int xouter = ow_start; xouter <= ow_stop; xouter++)
|
||||
for (int youter = oh_start; youter <= oh_stop; ++youter)
|
||||
{
|
||||
aktSAD = 0;
|
||||
for (int tpl_x = 0; tpl_x < tpl_width; tpl_x++)
|
||||
for (int tpl_y = 0; tpl_y < tpl_height; tpl_y++)
|
||||
{
|
||||
stbi_uc* p_org = this->rgb_image + (this->channels * ((youter + tpl_y) * this->width + (xouter + tpl_x)));
|
||||
stbi_uc* p_tpl = rgb_template + (this->channels * (tpl_y * tpl_width + tpl_x));
|
||||
aktSAD += pow(p_tpl[0] - p_org[0], 2);
|
||||
}
|
||||
stbi_uc* p_out = odata + (this->channels * ((youter - oh_start) * ow + (xouter - ow_start)));
|
||||
|
||||
p_out[0] = int(sqrt(aktSAD / (tpl_width * tpl_height)));
|
||||
if (aktSAD < minSAD)
|
||||
{
|
||||
minSAD = aktSAD;
|
||||
*found_x = xouter;
|
||||
*found_y = youter;
|
||||
}
|
||||
}
|
||||
|
||||
stbi_image_free(odata);
|
||||
stbi_image_free(rgb_template);
|
||||
}
|
||||
|
||||
void CFindTemplate::FindTemplate(std::string _template, int* found_x, int* found_y, std::string _imageout)
|
||||
{
|
||||
this->FindTemplate(_template, found_x, found_y);
|
||||
this->SaveToFile(_imageout);
|
||||
}
|
||||
|
||||
void CFindTemplate::FindTemplate(std::string _template, int* found_x, int* found_y, int _dx, int _dy, std::string _imageout)
|
||||
{
|
||||
this->FindTemplate(_template, found_x, found_y, _dx, _dy);
|
||||
this->SaveToFile(_imageout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CImageBasis::memCopy(uint8_t* _source, uint8_t* _target, int _size)
|
||||
{
|
||||
#ifdef _ESP32_PSRAM
|
||||
for (int i = 0; i < _size; ++i)
|
||||
*(_target + i) = *(_source + i);
|
||||
#else
|
||||
memcpy(_target, _source, _size);
|
||||
#endif
|
||||
}
|
||||
|
||||
CImageBasis::CImageBasis()
|
||||
{
|
||||
this->externalImage = false;
|
||||
}
|
||||
|
||||
CImageBasis::CImageBasis(std::string _image)
|
||||
{
|
||||
// printf("Start CImageBasis\n");
|
||||
channels = 3;
|
||||
externalImage = false;
|
||||
filename = _image;
|
||||
// printf("CImageBasis before load\n");
|
||||
// printf(_image.c_str()); printf("\n");
|
||||
rgb_image = stbi_load(_image.c_str(), &width, &height, &bpp, channels);
|
||||
if (!rgb_image)
|
||||
{
|
||||
printf("Datei konnte nicht geoeffnet werden\n");
|
||||
return;
|
||||
}
|
||||
// printf("CImageBasis after load\n");
|
||||
// printf("w %d, h %d, b %d, c %d\n", width, height, bpp, channels);
|
||||
}
|
||||
|
||||
CImageBasis::CImageBasis(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp)
|
||||
{
|
||||
rgb_image = _rgb_image;
|
||||
channels = _channels;
|
||||
width = _width;
|
||||
height = _height;
|
||||
bpp = _bpp;
|
||||
externalImage = true;
|
||||
}
|
||||
|
||||
CImageBasis::~CImageBasis()
|
||||
{
|
||||
if (!externalImage)
|
||||
stbi_image_free(rgb_image);
|
||||
}
|
||||
|
||||
void CImageBasis::SaveToFile(std::string _imageout)
|
||||
{
|
||||
string typ = getFileType(_imageout);
|
||||
|
||||
if ((typ == "jpg") || (typ == "JPG")) // ACHTUNG PROBLEMATISCH IM ESP32
|
||||
{
|
||||
stbi_write_jpg(_imageout.c_str(), this->width, this->height, this->channels, this->rgb_image, 0);
|
||||
}
|
||||
|
||||
if ((typ == "bmp") || (typ == "BMP"))
|
||||
{
|
||||
stbi_write_bmp(_imageout.c_str(), this->width, this->height, this->channels, this->rgb_image);
|
||||
}
|
||||
// stbi_write_jpg(_imageout.c_str(), this->width, this->height, this->channels, this->rgb_image, 0);
|
||||
// stbi_write_bmp(_imageout.c_str(), this->width, this->height, this->channels, this->rgb_image);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CAlignAndCutImage::Align(std::string _template0, int ref0_x, int ref0_y, std::string _template1, int ref1_x, int ref1_y, int deltax = 40, int deltay = 40)
|
||||
{
|
||||
int dx, dy;
|
||||
int r0_x, r0_y, r1_x, r1_y;
|
||||
|
||||
CFindTemplate* ft = new CFindTemplate(this->filename);
|
||||
|
||||
r0_x = ref0_x;
|
||||
r0_y = ref0_y;
|
||||
ft->FindTemplate(_template0, &r0_x, &r0_y, deltax, deltay);
|
||||
|
||||
r1_x = ref1_x;
|
||||
r1_y = ref1_y;
|
||||
ft->FindTemplate(_template1, &r1_x, &r1_y, deltax, deltay);
|
||||
|
||||
delete ft;
|
||||
|
||||
|
||||
dx = ref0_x - r0_x;
|
||||
dy = ref0_y - r0_y;
|
||||
|
||||
r0_x += dx;
|
||||
r0_y += dy;
|
||||
|
||||
r1_x += dx;
|
||||
r1_y += dy;
|
||||
|
||||
float w_org, w_ist, d_winkel;
|
||||
|
||||
w_org = atan2(ref1_y - ref0_y, ref1_x - ref0_x);
|
||||
w_ist = atan2(r1_y - r0_y, r1_x - r0_x);
|
||||
|
||||
d_winkel = -(w_org - w_ist) * 180 / M_PI;
|
||||
|
||||
CRotate rt(this->rgb_image, this->channels, this->width, this->height, this->bpp);
|
||||
rt.Translate(dx, dy);
|
||||
rt.Rotate(d_winkel, ref0_x, ref0_y);
|
||||
printf("Alignment: dx %d - dy %d - rot %f\n", dx, dy, d_winkel);
|
||||
}
|
||||
|
||||
void CAlignAndCutImage::CutAndSave(std::string _template1, int x1, int y1, int dx, int dy)
|
||||
{
|
||||
|
||||
int x2, y2;
|
||||
|
||||
x2 = x1 + dx;
|
||||
y2 = y1 + dy;
|
||||
x2 = min(x2, this->width - 1);
|
||||
y2 = min(y2, this->height - 1);
|
||||
|
||||
dx = x2 - x1;
|
||||
dy = y2 - y1;
|
||||
|
||||
int memsize = dx * dy * this->channels;
|
||||
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
|
||||
|
||||
|
||||
int x_source, y_source;
|
||||
stbi_uc* p_target;
|
||||
stbi_uc* p_source;
|
||||
|
||||
for (int x = x1; x < x2; ++x)
|
||||
for (int y = y1; y < y2; ++y)
|
||||
{
|
||||
p_target = odata + (this->channels * ((y - y1) * dx + (x - x1)));
|
||||
p_source = this->rgb_image + (this->channels * (y * this->width + x));
|
||||
for (int channels = 0; channels < this->channels; ++channels)
|
||||
p_target[channels] = p_source[channels];
|
||||
}
|
||||
|
||||
// stbi_write_jpg(_template1.c_str(), dx, dy, this->channels, odata, 0);
|
||||
stbi_write_bmp(_template1.c_str(), dx, dy, this->channels, odata);
|
||||
|
||||
stbi_image_free(odata);
|
||||
}
|
||||
@@ -44,6 +44,32 @@ void CResizeImage::Resize(int _new_dx, int _new_dy)
|
||||
stbi_image_free(odata);
|
||||
}
|
||||
|
||||
void CRotate::Mirror(){
|
||||
int memsize = this->width * this->height * this->channels;
|
||||
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
|
||||
|
||||
int x_source, y_source;
|
||||
stbi_uc* p_target;
|
||||
stbi_uc* p_source;
|
||||
|
||||
for (int x = 0; x < this->width; ++x)
|
||||
for (int y = 0; y < this->height; ++y)
|
||||
{
|
||||
p_target = odata + (this->channels * (y * this->width + x));
|
||||
|
||||
x_source = this->width - x;
|
||||
y_source = y;
|
||||
|
||||
p_source = this->rgb_image + (this->channels * (y_source * this->width + x_source));
|
||||
for (int channels = 0; channels < this->channels; ++channels)
|
||||
p_target[channels] = p_source[channels];
|
||||
}
|
||||
|
||||
// memcpy(this->rgb_image, odata, memsize);
|
||||
this->memCopy(odata, this->rgb_image, memsize);
|
||||
stbi_image_free(odata);
|
||||
}
|
||||
|
||||
void CRotate::Rotate(float _angle, int _centerx, int _centery)
|
||||
{
|
||||
float m[2][3];
|
||||
@@ -374,6 +400,10 @@ CImageBasis::CImageBasis(std::string _image)
|
||||
// printf("w %d, h %d, b %d, c %d", this->width, this->height, this->bpp, this->channels);
|
||||
}
|
||||
|
||||
bool CImageBasis::ImageOkay(){
|
||||
return rgb_image != NULL;
|
||||
}
|
||||
|
||||
CImageBasis::CImageBasis(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp)
|
||||
{
|
||||
this->rgb_image = _rgb_image;
|
||||
|
||||
@@ -36,6 +36,7 @@ class CImageBasis
|
||||
void drawCircle(int x1, int y1, int rad, int r, int g, int b, int thickness = 1);
|
||||
void setPixelColor(int x, int y, int r, int g, int b);
|
||||
void Contrast(float _contrast);
|
||||
bool ImageOkay();
|
||||
|
||||
|
||||
CImageBasis();
|
||||
@@ -69,6 +70,7 @@ class CRotate: public CImageBasis
|
||||
void Rotate(float _angle);
|
||||
void Rotate(float _angle, int _centerx, int _centery);
|
||||
void Translate(int _dx, int _dy);
|
||||
void Mirror();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ void ClassLogFile::WriteToDedicatedFile(std::string _fn, std::string info, bool
|
||||
FILE* pFile;
|
||||
std::string zwtime;
|
||||
|
||||
if (!doLogFile){
|
||||
return;
|
||||
}
|
||||
|
||||
pFile = fopen(_fn.c_str(), "a+");
|
||||
|
||||
if (_time)
|
||||
@@ -30,6 +34,11 @@ void ClassLogFile::WriteToDedicatedFile(std::string _fn, std::string info, bool
|
||||
fclose(pFile);
|
||||
}
|
||||
|
||||
void ClassLogFile::SwitchOnOff(bool _doLogFile){
|
||||
doLogFile = _doLogFile;
|
||||
};
|
||||
|
||||
|
||||
void ClassLogFile::WriteToFile(std::string info, bool _time)
|
||||
{
|
||||
WriteToDedicatedFile(logfile, info, _time);
|
||||
@@ -37,5 +46,6 @@ void ClassLogFile::WriteToFile(std::string info, bool _time)
|
||||
|
||||
ClassLogFile::ClassLogFile(std::string _logfile)
|
||||
{
|
||||
logfile = _logfile;
|
||||
logfile = _logfile;
|
||||
doLogFile = true;
|
||||
}
|
||||
@@ -6,9 +6,12 @@ class ClassLogFile
|
||||
{
|
||||
private:
|
||||
std::string logfile;
|
||||
bool doLogFile;
|
||||
public:
|
||||
ClassLogFile(std::string _logfile);
|
||||
|
||||
void SwitchOnOff(bool _doLogFile);
|
||||
|
||||
void WriteToFile(std::string info, bool _time = true);
|
||||
void WriteToDedicatedFile(std::string _fn, std::string info, bool _time = true);
|
||||
};
|
||||
|
||||
254
code/lib/jomjol_tfliteclass/CTfLiteClass._cpp_old
Normal file
@@ -0,0 +1,254 @@
|
||||
#include "CTfLiteClass.h"
|
||||
|
||||
#include "bitmap_image.hpp"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
float CTfLiteClass::GetOutputValue(int nr)
|
||||
{
|
||||
TfLiteTensor* output2 = this->interpreter->output(0);
|
||||
|
||||
int numeroutput = output2->dims->data[1];
|
||||
if ((nr+1) > numeroutput)
|
||||
return -1000;
|
||||
|
||||
return output2->data.f[nr];
|
||||
}
|
||||
|
||||
|
||||
int CTfLiteClass::GetClassFromImage(std::string _fn)
|
||||
{
|
||||
// printf("Before Load image %s\n", _fn.c_str());
|
||||
if (!LoadInputImage(_fn))
|
||||
return -1000;
|
||||
// printf("After Load image %s\n", _fn.c_str());
|
||||
|
||||
Invoke();
|
||||
printf("After Invoke %s\n", _fn.c_str());
|
||||
|
||||
return GetOutClassification();
|
||||
// return 0;
|
||||
}
|
||||
|
||||
int CTfLiteClass::GetOutClassification()
|
||||
{
|
||||
TfLiteTensor* output2 = interpreter->output(0);
|
||||
|
||||
float zw_max = 0;
|
||||
float zw;
|
||||
int zw_class = -1;
|
||||
|
||||
if (output2 == NULL)
|
||||
return -1;
|
||||
|
||||
int numeroutput = output2->dims->data[1];
|
||||
for (int i = 0; i < numeroutput; ++i)
|
||||
{
|
||||
zw = output2->data.f[i];
|
||||
if (zw > zw_max)
|
||||
{
|
||||
zw_max = zw;
|
||||
zw_class = i;
|
||||
}
|
||||
}
|
||||
// printf("Result Ziffer: %d\n", zw_class);
|
||||
return zw_class;
|
||||
}
|
||||
|
||||
void CTfLiteClass::GetInputDimension(bool silent = false)
|
||||
{
|
||||
TfLiteTensor* input2 = this->interpreter->input(0);
|
||||
|
||||
int numdim = input2->dims->size;
|
||||
if (!silent) printf("NumDimension: %d\n", numdim);
|
||||
|
||||
int sizeofdim;
|
||||
for (int j = 0; j < numdim; ++j)
|
||||
{
|
||||
sizeofdim = input2->dims->data[j];
|
||||
if (!silent) printf("SizeOfDimension %d: %d\n", j, sizeofdim);
|
||||
if (j == 1) im_height = sizeofdim;
|
||||
if (j == 2) im_width = sizeofdim;
|
||||
if (j == 3) im_channel = sizeofdim;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CTfLiteClass::GetOutPut()
|
||||
{
|
||||
TfLiteTensor* output2 = this->interpreter->output(0);
|
||||
|
||||
int numdim = output2->dims->size;
|
||||
printf("NumDimension: %d\n", numdim);
|
||||
|
||||
int sizeofdim;
|
||||
for (int j = 0; j < numdim; ++j)
|
||||
{
|
||||
sizeofdim = output2->dims->data[j];
|
||||
printf("SizeOfDimension %d: %d\n", j, sizeofdim);
|
||||
}
|
||||
|
||||
|
||||
float fo;
|
||||
|
||||
// Process the inference results.
|
||||
int numeroutput = output2->dims->data[1];
|
||||
for (int i = 0; i < numeroutput; ++i)
|
||||
{
|
||||
fo = output2->data.f[i];
|
||||
printf("Result %d: %f\n", i, fo);
|
||||
}
|
||||
}
|
||||
|
||||
void CTfLiteClass::Invoke()
|
||||
{
|
||||
interpreter->Invoke();
|
||||
// printf("Invoke Done.\n");
|
||||
}
|
||||
|
||||
|
||||
bool CTfLiteClass::LoadInputImage(std::string _fn)
|
||||
{
|
||||
bitmap_image image(_fn);
|
||||
unsigned int w = image.width();
|
||||
unsigned int h = image.height();
|
||||
unsigned char red, green, blue;
|
||||
|
||||
input_i = 0;
|
||||
float* input_data_ptr = (interpreter->input(0))->data.f;
|
||||
|
||||
for (int y = 0; y < h; ++y)
|
||||
for (int x = 0; x < w; ++x)
|
||||
{
|
||||
red = image.red_channel(x, y);
|
||||
green = image.green_channel(x, y);
|
||||
blue = image.blue_channel(x, y);
|
||||
*(input_data_ptr) = (float) red;
|
||||
input_data_ptr++;
|
||||
*(input_data_ptr) = (float) green;
|
||||
input_data_ptr++;
|
||||
*(input_data_ptr) = (float) blue;
|
||||
input_data_ptr++;
|
||||
|
||||
// printf("BMP: %f %f %f\n", (float) red, (float) green, (float) blue);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CTfLiteClass::MakeAllocate()
|
||||
{
|
||||
/*
|
||||
this->micro_op_resolver.AddBuiltin(
|
||||
tflite::BuiltinOperator_RESHAPE,
|
||||
tflite::ops::micro::Register_RESHAPE());
|
||||
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_CONV_2D,
|
||||
tflite::ops::micro::Register_CONV_2D());
|
||||
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_FULLY_CONNECTED,
|
||||
tflite::ops::micro::Register_FULLY_CONNECTED());
|
||||
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_SOFTMAX,
|
||||
tflite::ops::micro::Register_SOFTMAX());
|
||||
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_DEPTHWISE_CONV_2D,
|
||||
tflite::ops::micro::Register_DEPTHWISE_CONV_2D());
|
||||
|
||||
|
||||
this->interpreter = new tflite::MicroInterpreter(this->model, this->micro_op_resolver, this->tensor_arena, this->kTensorArenaSize, this->error_reporter);
|
||||
*/
|
||||
|
||||
|
||||
static tflite::ops::micro::AllOpsResolver resolver;
|
||||
this->interpreter = new tflite::MicroInterpreter(this->model, resolver, this->tensor_arena, this->kTensorArenaSize, this->error_reporter);
|
||||
|
||||
TfLiteStatus allocate_status = this->interpreter->AllocateTensors();
|
||||
if (allocate_status != kTfLiteOk) {
|
||||
TF_LITE_REPORT_ERROR(error_reporter, "AllocateTensors() failed");
|
||||
this->GetInputDimension();
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Allocate Done.\n");
|
||||
}
|
||||
|
||||
void CTfLiteClass::GetInputTensorSize(){
|
||||
float *zw = this->input;
|
||||
int test = sizeof(zw);
|
||||
printf("Input Tensor Dimension: %d\n", test);
|
||||
|
||||
printf("Input Tensor Dimension: %d\n", test);
|
||||
}
|
||||
|
||||
long CTfLiteClass::GetFileSize(std::string filename)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
long rc = stat(filename.c_str(), &stat_buf);
|
||||
return rc == 0 ? stat_buf.st_size : -1;
|
||||
}
|
||||
|
||||
|
||||
unsigned char* CTfLiteClass::ReadFileToCharArray(std::string _fn)
|
||||
{
|
||||
long size;
|
||||
|
||||
size = this->GetFileSize(_fn);
|
||||
|
||||
if (size == -1)
|
||||
{
|
||||
printf("\nFile existiert nicht.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
unsigned char *result = (unsigned char*) malloc(size);
|
||||
|
||||
if(result != NULL) {
|
||||
// printf("\nSpeicher ist reserviert\n");
|
||||
FILE* f = fopen(_fn.c_str(), "rb"); // vorher nur "r"
|
||||
fread(result, 1, size, f);
|
||||
fclose(f);
|
||||
}else {
|
||||
printf("\nKein freier Speicher vorhanden.\n");
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void CTfLiteClass::LoadModel(std::string _fn){
|
||||
|
||||
|
||||
this->error_reporter = new tflite::MicroErrorReporter;
|
||||
|
||||
unsigned char *rd;
|
||||
rd = this->ReadFileToCharArray(_fn.c_str());
|
||||
// printf("loadedfile: %d", (int) rd);
|
||||
|
||||
this->model = tflite::GetModel(rd);
|
||||
free(rd);
|
||||
TFLITE_MINIMAL_CHECK(model != nullptr);
|
||||
printf("tfile Loaded.\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
CTfLiteClass::CTfLiteClass()
|
||||
{
|
||||
// this->accessSD = _accessSD;
|
||||
this->model = nullptr;
|
||||
this->interpreter = nullptr;
|
||||
this->input = nullptr;
|
||||
this->output = nullptr;
|
||||
this->kTensorArenaSize = 600 * 1024;
|
||||
this->tensor_arena = new uint8_t[kTensorArenaSize];
|
||||
|
||||
// micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_CONV_2D,
|
||||
// tflite::ops::micro::Register_CONV_2D());
|
||||
}
|
||||
|
||||
CTfLiteClass::~CTfLiteClass()
|
||||
{
|
||||
delete this->tensor_arena;
|
||||
}
|
||||
|
||||
|
||||
72
code/lib/jomjol_tfliteclass/CTfLiteClass._h_old
Normal file
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __CFINDTEMPLATE
|
||||
#define __CFINGTEMPLATE
|
||||
|
||||
#define TFLITE_MINIMAL_CHECK(x) \
|
||||
if (!(x)) { \
|
||||
fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); \
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
//#include "CAccessSD.h"
|
||||
#include "CFindTemplate.h"
|
||||
|
||||
#include "tensorflow/lite/micro/kernels/all_ops_resolver.h"
|
||||
#include "tensorflow/lite/micro/micro_error_reporter.h"
|
||||
#include "tensorflow/lite/micro/micro_interpreter.h"
|
||||
#include "tensorflow/lite/schema/schema_generated.h"
|
||||
#include "tensorflow/lite/version.h"
|
||||
#include "tensorflow/lite/micro/kernels/micro_ops.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
//extern CAccessSDClass accessSD;
|
||||
|
||||
class CTfLiteClass
|
||||
{
|
||||
protected:
|
||||
// CAccessSDClass *accessSD;
|
||||
|
||||
tflite::ErrorReporter* error_reporter;
|
||||
|
||||
const tflite::Model* model;
|
||||
tflite::MicroInterpreter* interpreter;
|
||||
// TfLiteTensor* input = nullptr;
|
||||
TfLiteTensor* output = nullptr;
|
||||
static tflite::ops::micro::AllOpsResolver *resolver;
|
||||
|
||||
tflite::MicroOpResolver<5> micro_op_resolver;
|
||||
|
||||
|
||||
int kTensorArenaSize;
|
||||
uint8_t *tensor_arena;
|
||||
|
||||
float* input;
|
||||
int input_i;
|
||||
|
||||
int im_height, im_width, im_channel;
|
||||
|
||||
long GetFileSize(std::string filename);
|
||||
unsigned char* ReadFileToCharArray(std::string _fn);
|
||||
|
||||
public:
|
||||
// CTfLiteClass(CAccessSDClass *_accessSD);
|
||||
CTfLiteClass();
|
||||
~CTfLiteClass();
|
||||
void LoadModel(std::string _fn);
|
||||
void MakeAllocate();
|
||||
void GetInputTensorSize();
|
||||
bool LoadInputImage(std::string _fn);
|
||||
void Invoke();
|
||||
void GetOutPut();
|
||||
int GetOutClassification();
|
||||
int GetClassFromImage(std::string _fn);
|
||||
|
||||
float GetOutputValue(int nr);
|
||||
void GetInputDimension(bool silent);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -114,6 +114,8 @@ bool CTfLiteClass::LoadInputImage(std::string _fn)
|
||||
unsigned int h = image.height();
|
||||
unsigned char red, green, blue;
|
||||
|
||||
// printf("Image: %s size: %d x %d\n", _fn.c_str(), w, h);
|
||||
|
||||
input_i = 0;
|
||||
float* input_data_ptr = (interpreter->input(0))->data.f;
|
||||
|
||||
@@ -139,24 +141,6 @@ bool CTfLiteClass::LoadInputImage(std::string _fn)
|
||||
|
||||
void CTfLiteClass::MakeAllocate()
|
||||
{
|
||||
/*
|
||||
this->micro_op_resolver.AddBuiltin(
|
||||
tflite::BuiltinOperator_RESHAPE,
|
||||
tflite::ops::micro::Register_RESHAPE());
|
||||
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_CONV_2D,
|
||||
tflite::ops::micro::Register_CONV_2D());
|
||||
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_FULLY_CONNECTED,
|
||||
tflite::ops::micro::Register_FULLY_CONNECTED());
|
||||
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_SOFTMAX,
|
||||
tflite::ops::micro::Register_SOFTMAX());
|
||||
this->micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_DEPTHWISE_CONV_2D,
|
||||
tflite::ops::micro::Register_DEPTHWISE_CONV_2D());
|
||||
|
||||
|
||||
this->interpreter = new tflite::MicroInterpreter(this->model, this->micro_op_resolver, this->tensor_arena, this->kTensorArenaSize, this->error_reporter);
|
||||
*/
|
||||
|
||||
|
||||
static tflite::ops::micro::AllOpsResolver resolver;
|
||||
this->interpreter = new tflite::MicroInterpreter(this->model, resolver, this->tensor_arena, this->kTensorArenaSize, this->error_reporter);
|
||||
|
||||
@@ -167,7 +151,7 @@ void CTfLiteClass::MakeAllocate()
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Allocate Done.\n");
|
||||
// printf("Allocate Done.\n");
|
||||
}
|
||||
|
||||
void CTfLiteClass::GetInputTensorSize(){
|
||||
@@ -216,8 +200,11 @@ unsigned char* CTfLiteClass::ReadFileToCharArray(std::string _fn)
|
||||
|
||||
void CTfLiteClass::LoadModel(std::string _fn){
|
||||
|
||||
|
||||
#ifdef SUPRESS_TFLITE_ERRORS
|
||||
this->error_reporter = new tflite::OwnMicroErrorReporter;
|
||||
#else
|
||||
this->error_reporter = new tflite::MicroErrorReporter;
|
||||
#endif
|
||||
|
||||
unsigned char *rd;
|
||||
rd = this->ReadFileToCharArray(_fn.c_str());
|
||||
@@ -226,7 +213,7 @@ void CTfLiteClass::LoadModel(std::string _fn){
|
||||
this->model = tflite::GetModel(rd);
|
||||
free(rd);
|
||||
TFLITE_MINIMAL_CHECK(model != nullptr);
|
||||
printf("tfile Loaded.\n");
|
||||
// printf("tfile Loaded.\n");
|
||||
|
||||
}
|
||||
|
||||
@@ -234,16 +221,12 @@ void CTfLiteClass::LoadModel(std::string _fn){
|
||||
|
||||
CTfLiteClass::CTfLiteClass()
|
||||
{
|
||||
// this->accessSD = _accessSD;
|
||||
this->model = nullptr;
|
||||
this->interpreter = nullptr;
|
||||
this->input = nullptr;
|
||||
this->output = nullptr;
|
||||
this->kTensorArenaSize = 600 * 1024;
|
||||
this->tensor_arena = new uint8_t[kTensorArenaSize];
|
||||
|
||||
// micro_op_resolver.AddBuiltin(tflite::BuiltinOperator_CONV_2D,
|
||||
// tflite::ops::micro::Register_CONV_2D());
|
||||
this->tensor_arena = new uint8_t[kTensorArenaSize];
|
||||
}
|
||||
|
||||
CTfLiteClass::~CTfLiteClass()
|
||||
@@ -252,3 +235,12 @@ CTfLiteClass::~CTfLiteClass()
|
||||
}
|
||||
|
||||
|
||||
namespace tflite {
|
||||
|
||||
int OwnMicroErrorReporter::Report(const char* format, va_list args) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace tflite
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __CFINDTEMPLATE
|
||||
#define __CFINGTEMPLATE
|
||||
|
||||
#define TFLITE_MINIMAL_CHECK(x) \
|
||||
if (!(x)) { \
|
||||
@@ -9,9 +5,6 @@
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
//#include "CAccessSD.h"
|
||||
#include "CFindTemplate.h"
|
||||
|
||||
#include "tensorflow/lite/micro/kernels/all_ops_resolver.h"
|
||||
#include "tensorflow/lite/micro/micro_error_reporter.h"
|
||||
#include "tensorflow/lite/micro/micro_interpreter.h"
|
||||
@@ -21,37 +14,44 @@
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
//extern CAccessSDClass accessSD;
|
||||
|
||||
|
||||
#define SUPRESS_TFLITE_ERRORS // use, to avoid error messages from TFLITE
|
||||
|
||||
#ifdef SUPRESS_TFLITE_ERRORS
|
||||
#include "tensorflow/lite/core/api/error_reporter.h"
|
||||
#include "tensorflow/lite/micro/compatibility.h"
|
||||
#include "tensorflow/lite/micro/debug_log.h"
|
||||
///// OwnErrorReporter to prevent printing of Errors (especially unavoidable in CalculateActivationRangeQuantized@kerne_util.cc)
|
||||
namespace tflite {
|
||||
class OwnMicroErrorReporter : public ErrorReporter {
|
||||
public:
|
||||
int Report(const char* format, va_list args) override;
|
||||
};
|
||||
} // namespace tflite
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
|
||||
class CTfLiteClass
|
||||
{
|
||||
protected:
|
||||
// CAccessSDClass *accessSD;
|
||||
|
||||
tflite::ErrorReporter* error_reporter;
|
||||
|
||||
tflite::ErrorReporter *error_reporter;
|
||||
const tflite::Model* model;
|
||||
tflite::MicroInterpreter* interpreter;
|
||||
// TfLiteTensor* input = nullptr;
|
||||
TfLiteTensor* output = nullptr;
|
||||
static tflite::ops::micro::AllOpsResolver *resolver;
|
||||
|
||||
tflite::MicroOpResolver<5> micro_op_resolver;
|
||||
|
||||
|
||||
int kTensorArenaSize;
|
||||
uint8_t *tensor_arena;
|
||||
|
||||
float* input;
|
||||
int input_i;
|
||||
|
||||
int im_height, im_width, im_channel;
|
||||
|
||||
long GetFileSize(std::string filename);
|
||||
unsigned char* ReadFileToCharArray(std::string _fn);
|
||||
|
||||
public:
|
||||
// CTfLiteClass(CAccessSDClass *_accessSD);
|
||||
CTfLiteClass();
|
||||
~CTfLiteClass();
|
||||
void LoadModel(std::string _fn);
|
||||
@@ -65,8 +65,5 @@ class CTfLiteClass
|
||||
|
||||
float GetOutputValue(int nr);
|
||||
void GetInputDimension(bool silent);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -74,8 +74,8 @@ CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||
CONFIG_PARTITION_TABLE_MD5=y
|
||||
CONFIG_EXAMPLE_CONNECT_WIFI=y
|
||||
# CONFIG_EXAMPLE_CONNECT_ETHERNET is not set
|
||||
CONFIG_EXAMPLE_WIFI_SSID="SSID"
|
||||
CONFIG_EXAMPLE_WIFI_PASSWORD="passwd"
|
||||
CONFIG_EXAMPLE_WIFI_SSID="myssid"
|
||||
CONFIG_EXAMPLE_WIFI_PASSWORD="mypassword"
|
||||
CONFIG_EXAMPLE_CONNECT_IPV6=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y
|
||||
# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set
|
||||
@@ -221,7 +221,7 @@ CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
|
||||
CONFIG_ESP_INT_WDT_CHECK_CPU1=y
|
||||
CONFIG_ESP_TASK_WDT=y
|
||||
# CONFIG_ESP_TASK_WDT_PANIC is not set
|
||||
CONFIG_ESP_TASK_WDT_TIMEOUT_S=5
|
||||
CONFIG_ESP_TASK_WDT_TIMEOUT_S=3
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
|
||||
CONFIG_ETH_USE_ESP32_EMAC=y
|
||||
@@ -240,8 +240,8 @@ CONFIG_ESP_EVENT_POST_FROM_ISR=y
|
||||
CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
|
||||
CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
|
||||
# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
|
||||
CONFIG_HTTPD_MAX_REQ_HDR_LEN=512
|
||||
CONFIG_HTTPD_MAX_URI_LEN=512
|
||||
CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024
|
||||
CONFIG_HTTPD_MAX_URI_LEN=1024
|
||||
CONFIG_HTTPD_ERR_RESP_NO_DELAY=y
|
||||
CONFIG_HTTPD_PURGE_BUF_LEN=32
|
||||
# CONFIG_HTTPD_LOG_PURGE_DATA is not set
|
||||
@@ -649,7 +649,7 @@ CONFIG_INT_WDT_TIMEOUT_MS=300
|
||||
CONFIG_INT_WDT_CHECK_CPU1=y
|
||||
CONFIG_TASK_WDT=y
|
||||
# CONFIG_TASK_WDT_PANIC is not set
|
||||
CONFIG_TASK_WDT_TIMEOUT_S=5
|
||||
CONFIG_TASK_WDT_TIMEOUT_S=3
|
||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
|
||||
# CONFIG_EVENT_LOOP_PROFILING is not set
|
||||
|
||||
841
code/sdkconfig.old
Normal file
@@ -0,0 +1,841 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Espressif IoT Development Framework Configuration
|
||||
#
|
||||
CONFIG_IDF_TARGET_ESP32=y
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000
|
||||
|
||||
#
|
||||
# SDK tool configuration
|
||||
#
|
||||
CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-"
|
||||
|
||||
#
|
||||
# Application manager
|
||||
#
|
||||
CONFIG_APP_COMPILE_TIME_DATE=y
|
||||
CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=
|
||||
CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=
|
||||
CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16
|
||||
|
||||
#
|
||||
# Bootloader config
|
||||
#
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_WARN=
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG=
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE=
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL=3
|
||||
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V=
|
||||
CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
|
||||
CONFIG_BOOTLOADER_FACTORY_RESET=
|
||||
CONFIG_BOOTLOADER_APP_TEST=
|
||||
CONFIG_BOOTLOADER_WDT_ENABLE=y
|
||||
CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE=
|
||||
CONFIG_BOOTLOADER_WDT_TIME_MS=9000
|
||||
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=
|
||||
|
||||
#
|
||||
# Security features
|
||||
#
|
||||
CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT=
|
||||
CONFIG_SECURE_BOOT_ENABLED=
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=
|
||||
|
||||
#
|
||||
# Serial flasher config
|
||||
#
|
||||
CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_QIO=
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_QOUT=
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
|
||||
CONFIG_ESPTOOLPY_FLASHMODE_DOUT=
|
||||
CONFIG_ESPTOOLPY_FLASHMODE="dio"
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_26M=
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_20M=
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ="40m"
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_1MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE="2MB"
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
|
||||
CONFIG_ESPTOOLPY_BEFORE_RESET=y
|
||||
CONFIG_ESPTOOLPY_BEFORE_NORESET=
|
||||
CONFIG_ESPTOOLPY_BEFORE="default_reset"
|
||||
CONFIG_ESPTOOLPY_AFTER_RESET=y
|
||||
CONFIG_ESPTOOLPY_AFTER_NORESET=
|
||||
CONFIG_ESPTOOLPY_AFTER="hard_reset"
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B=
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B=
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B=
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B=
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB=
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER=
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
||||
|
||||
#
|
||||
# Partition Table
|
||||
#
|
||||
CONFIG_PARTITION_TABLE_SINGLE_APP=y
|
||||
CONFIG_PARTITION_TABLE_TWO_OTA=
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||
CONFIG_PARTITION_TABLE_MD5=y
|
||||
|
||||
#
|
||||
# Example Connection Configuration
|
||||
#
|
||||
CONFIG_EXAMPLE_CONNECT_WIFI=y
|
||||
CONFIG_EXAMPLE_CONNECT_ETHERNET=
|
||||
CONFIG_EXAMPLE_WIFI_SSID="myssid"
|
||||
CONFIG_EXAMPLE_WIFI_PASSWORD="mypassword"
|
||||
CONFIG_EXAMPLE_CONNECT_IPV6=y
|
||||
|
||||
#
|
||||
# Compiler options
|
||||
#
|
||||
CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=
|
||||
CONFIG_COMPILER_CXX_EXCEPTIONS=
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_NORM=
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_ALL=
|
||||
CONFIG_COMPILER_STACK_CHECK=
|
||||
CONFIG_COMPILER_WARN_WRITE_STRINGS=
|
||||
CONFIG_COMPILER_DISABLE_GCC8_WARNINGS=
|
||||
|
||||
#
|
||||
# Component config
|
||||
#
|
||||
|
||||
#
|
||||
# Application Level Tracing
|
||||
#
|
||||
CONFIG_ESP32_APPTRACE_DEST_TRAX=
|
||||
CONFIG_ESP32_APPTRACE_DEST_NONE=y
|
||||
CONFIG_ESP32_APPTRACE_ENABLE=
|
||||
CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
|
||||
|
||||
#
|
||||
# Bluetooth
|
||||
#
|
||||
CONFIG_BT_ENABLED=
|
||||
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0
|
||||
CONFIG_BTDM_CTRL_AUTO_LATENCY_EFF=
|
||||
CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=0
|
||||
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0
|
||||
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0
|
||||
CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
|
||||
CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
|
||||
CONFIG_BT_RESERVE_DRAM=0
|
||||
CONFIG_BLE_MESH=
|
||||
|
||||
#
|
||||
# Driver configurations
|
||||
#
|
||||
|
||||
#
|
||||
# ADC configuration
|
||||
#
|
||||
CONFIG_ADC_FORCE_XPD_FSM=
|
||||
CONFIG_ADC_DISABLE_DAC=y
|
||||
|
||||
#
|
||||
# SPI configuration
|
||||
#
|
||||
CONFIG_SPI_MASTER_IN_IRAM=
|
||||
CONFIG_SPI_MASTER_ISR_IN_IRAM=y
|
||||
CONFIG_SPI_SLAVE_IN_IRAM=
|
||||
CONFIG_SPI_SLAVE_ISR_IN_IRAM=y
|
||||
|
||||
#
|
||||
# eFuse Bit Manager
|
||||
#
|
||||
CONFIG_EFUSE_CUSTOM_TABLE=
|
||||
CONFIG_EFUSE_VIRTUAL=
|
||||
CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE=
|
||||
CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y
|
||||
CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT=
|
||||
CONFIG_EFUSE_MAX_BLK_LEN=192
|
||||
|
||||
#
|
||||
# ESP-TLS
|
||||
#
|
||||
CONFIG_ESP_TLS_SERVER=
|
||||
|
||||
#
|
||||
# ESP32-specific
|
||||
#
|
||||
CONFIG_ESP32_REV_MIN_0=y
|
||||
CONFIG_ESP32_REV_MIN_1=
|
||||
CONFIG_ESP32_REV_MIN_2=
|
||||
CONFIG_ESP32_REV_MIN_3=
|
||||
CONFIG_ESP32_REV_MIN=0
|
||||
CONFIG_ESP32_DPORT_WORKAROUND=y
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_80=
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160
|
||||
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
CONFIG_SPIRAM_IGNORE_NOTFOUND=
|
||||
CONFIG_SPIRAM_USE_MEMMAP=
|
||||
CONFIG_SPIRAM_USE_CAPS_ALLOC=
|
||||
CONFIG_SPIRAM_USE_MALLOC=y
|
||||
CONFIG_SPIRAM_TYPE_AUTO=y
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM32=
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM64=
|
||||
CONFIG_SPIRAM_SIZE=-1
|
||||
CONFIG_SPIRAM_SPEED_40M=y
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
CONFIG_SPIRAM_CACHE_WORKAROUND=y
|
||||
CONFIG_SPIRAM_BANKSWITCH_ENABLE=y
|
||||
CONFIG_SPIRAM_BANKSWITCH_RESERVE=8
|
||||
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
|
||||
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=
|
||||
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
|
||||
CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=
|
||||
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=
|
||||
|
||||
#
|
||||
# PSRAM clock and cs IO for ESP32-DOWD
|
||||
#
|
||||
CONFIG_D0WD_PSRAM_CLK_IO=17
|
||||
CONFIG_D0WD_PSRAM_CS_IO=16
|
||||
|
||||
#
|
||||
# PSRAM clock and cs IO for ESP32-D2WD
|
||||
#
|
||||
CONFIG_D2WD_PSRAM_CLK_IO=9
|
||||
CONFIG_D2WD_PSRAM_CS_IO=10
|
||||
|
||||
#
|
||||
# PSRAM clock and cs IO for ESP32-PICO
|
||||
#
|
||||
CONFIG_PICO_PSRAM_CS_IO=10
|
||||
CONFIG_SPIRAM_SPIWP_SD3_PIN=7
|
||||
CONFIG_SPIRAM_2T_MODE=
|
||||
CONFIG_ESP32_MEMMAP_TRACEMEM=
|
||||
CONFIG_ESP32_MEMMAP_TRACEMEM_TWOBANKS=
|
||||
CONFIG_ESP32_TRAX=
|
||||
CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0
|
||||
CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO=
|
||||
CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y
|
||||
CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4
|
||||
CONFIG_ESP32_ULP_COPROC_ENABLED=
|
||||
CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0
|
||||
CONFIG_ESP32_PANIC_PRINT_HALT=
|
||||
CONFIG_ESP32_PANIC_PRINT_REBOOT=y
|
||||
CONFIG_ESP32_PANIC_SILENT_REBOOT=
|
||||
CONFIG_ESP32_PANIC_GDBSTUB=
|
||||
CONFIG_ESP32_DEBUG_OCDAWARE=y
|
||||
CONFIG_ESP32_DEBUG_STUBS_ENABLE=y
|
||||
CONFIG_ESP32_BROWNOUT_DET=y
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1=
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2=
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3=
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4=
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5=
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6=
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7=
|
||||
CONFIG_ESP32_BROWNOUT_DET_LVL=0
|
||||
CONFIG_ESP32_REDUCE_PHY_TX_POWER=y
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC=
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_FRC1=
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_NONE=
|
||||
CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y
|
||||
CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS=
|
||||
CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC=
|
||||
CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256=
|
||||
CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024
|
||||
CONFIG_ESP32_RTC_XTAL_CAL_RETRY=1
|
||||
CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000
|
||||
CONFIG_ESP32_XTAL_FREQ_40=y
|
||||
CONFIG_ESP32_XTAL_FREQ_26=
|
||||
CONFIG_ESP32_XTAL_FREQ_AUTO=
|
||||
CONFIG_ESP32_XTAL_FREQ=40
|
||||
CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE=
|
||||
CONFIG_ESP32_NO_BLOBS=
|
||||
CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS=
|
||||
CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE=
|
||||
CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5
|
||||
|
||||
#
|
||||
# Power Management
|
||||
#
|
||||
CONFIG_PM_ENABLE=
|
||||
|
||||
#
|
||||
# ADC-Calibration
|
||||
#
|
||||
CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y
|
||||
CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y
|
||||
CONFIG_ADC_CAL_LUT_ENABLE=y
|
||||
|
||||
#
|
||||
# Common ESP-related
|
||||
#
|
||||
CONFIG_ESP_TIMER_PROFILING=
|
||||
CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
|
||||
CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32
|
||||
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304
|
||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584
|
||||
CONFIG_ESP_IPC_TASK_STACK_SIZE=1024
|
||||
CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584
|
||||
CONFIG_ESP_CONSOLE_UART_DEFAULT=y
|
||||
CONFIG_ESP_CONSOLE_UART_CUSTOM=
|
||||
CONFIG_ESP_CONSOLE_UART_NONE=
|
||||
CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
||||
CONFIG_ESP_INT_WDT=y
|
||||
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
|
||||
CONFIG_ESP_INT_WDT_CHECK_CPU1=y
|
||||
CONFIG_ESP_TASK_WDT=y
|
||||
CONFIG_ESP_TASK_WDT_PANIC=
|
||||
CONFIG_ESP_TASK_WDT_TIMEOUT_S=3
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
|
||||
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
|
||||
|
||||
#
|
||||
# Ethernet
|
||||
#
|
||||
CONFIG_ETH_USE_ESP32_EMAC=y
|
||||
CONFIG_ETH_PHY_INTERFACE_RMII=y
|
||||
CONFIG_ETH_PHY_INTERFACE_MII=
|
||||
CONFIG_ETH_RMII_CLK_INPUT=y
|
||||
CONFIG_ETH_RMII_CLK_OUTPUT=
|
||||
CONFIG_ETH_RMII_CLK_IN_GPIO=0
|
||||
CONFIG_ETH_DMA_BUFFER_SIZE=512
|
||||
CONFIG_ETH_DMA_RX_BUFFER_NUM=10
|
||||
CONFIG_ETH_DMA_TX_BUFFER_NUM=10
|
||||
CONFIG_ETH_USE_SPI_ETHERNET=y
|
||||
CONFIG_ETH_SPI_ETHERNET_DM9051=y
|
||||
|
||||
#
|
||||
# Event Loop Library
|
||||
#
|
||||
CONFIG_ESP_EVENT_LOOP_PROFILING=
|
||||
CONFIG_ESP_EVENT_POST_FROM_ISR=y
|
||||
CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
|
||||
|
||||
#
|
||||
# GDB Stub
|
||||
#
|
||||
|
||||
#
|
||||
# ESP HTTP client
|
||||
#
|
||||
CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
|
||||
CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH=
|
||||
|
||||
#
|
||||
# HTTP Server
|
||||
#
|
||||
CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024
|
||||
CONFIG_HTTPD_MAX_URI_LEN=1024
|
||||
CONFIG_HTTPD_ERR_RESP_NO_DELAY=y
|
||||
CONFIG_HTTPD_PURGE_BUF_LEN=32
|
||||
CONFIG_HTTPD_LOG_PURGE_DATA=
|
||||
|
||||
#
|
||||
# ESP HTTPS OTA
|
||||
#
|
||||
CONFIG_OTA_ALLOW_HTTP=
|
||||
|
||||
#
|
||||
# ESP HTTPS server
|
||||
#
|
||||
CONFIG_ESP_HTTPS_SERVER_ENABLE=
|
||||
|
||||
#
|
||||
# Wi-Fi
|
||||
#
|
||||
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10
|
||||
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32
|
||||
CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y
|
||||
CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0
|
||||
CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=16
|
||||
CONFIG_ESP32_WIFI_CSI_ENABLED=
|
||||
CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
|
||||
CONFIG_ESP32_WIFI_TX_BA_WIN=6
|
||||
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
|
||||
CONFIG_ESP32_WIFI_RX_BA_WIN=6
|
||||
CONFIG_ESP32_WIFI_NVS_ENABLED=y
|
||||
CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
|
||||
CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1=
|
||||
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
|
||||
CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32
|
||||
CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE=
|
||||
CONFIG_ESP32_WIFI_IRAM_OPT=y
|
||||
CONFIG_ESP32_WIFI_RX_IRAM_OPT=y
|
||||
CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y
|
||||
|
||||
#
|
||||
# PHY
|
||||
#
|
||||
CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y
|
||||
CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION=
|
||||
CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20
|
||||
CONFIG_ESP32_PHY_MAX_TX_POWER=20
|
||||
|
||||
#
|
||||
# Core dump
|
||||
#
|
||||
CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH=
|
||||
CONFIG_ESP32_ENABLE_COREDUMP_TO_UART=
|
||||
CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y
|
||||
CONFIG_ESP32_ENABLE_COREDUMP=
|
||||
|
||||
#
|
||||
# FAT Filesystem support
|
||||
#
|
||||
CONFIG_FATFS_CODEPAGE_DYNAMIC=
|
||||
CONFIG_FATFS_CODEPAGE_437=y
|
||||
CONFIG_FATFS_CODEPAGE_720=
|
||||
CONFIG_FATFS_CODEPAGE_737=
|
||||
CONFIG_FATFS_CODEPAGE_771=
|
||||
CONFIG_FATFS_CODEPAGE_775=
|
||||
CONFIG_FATFS_CODEPAGE_850=
|
||||
CONFIG_FATFS_CODEPAGE_852=
|
||||
CONFIG_FATFS_CODEPAGE_855=
|
||||
CONFIG_FATFS_CODEPAGE_857=
|
||||
CONFIG_FATFS_CODEPAGE_860=
|
||||
CONFIG_FATFS_CODEPAGE_861=
|
||||
CONFIG_FATFS_CODEPAGE_862=
|
||||
CONFIG_FATFS_CODEPAGE_863=
|
||||
CONFIG_FATFS_CODEPAGE_864=
|
||||
CONFIG_FATFS_CODEPAGE_865=
|
||||
CONFIG_FATFS_CODEPAGE_866=
|
||||
CONFIG_FATFS_CODEPAGE_869=
|
||||
CONFIG_FATFS_CODEPAGE_932=
|
||||
CONFIG_FATFS_CODEPAGE_936=
|
||||
CONFIG_FATFS_CODEPAGE_949=
|
||||
CONFIG_FATFS_CODEPAGE_950=
|
||||
CONFIG_FATFS_CODEPAGE=437
|
||||
CONFIG_FATFS_LFN_NONE=
|
||||
CONFIG_FATFS_LFN_HEAP=y
|
||||
CONFIG_FATFS_LFN_STACK=
|
||||
CONFIG_FATFS_MAX_LFN=255
|
||||
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
|
||||
CONFIG_FATFS_API_ENCODING_UTF_16=
|
||||
CONFIG_FATFS_API_ENCODING_UTF_8=
|
||||
CONFIG_FATFS_FS_LOCK=0
|
||||
CONFIG_FATFS_TIMEOUT_MS=10000
|
||||
CONFIG_FATFS_PER_FILE_CACHE=y
|
||||
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y
|
||||
|
||||
#
|
||||
# Modbus configuration
|
||||
#
|
||||
CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150
|
||||
CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200
|
||||
CONFIG_FMB_QUEUE_LENGTH=20
|
||||
CONFIG_FMB_SERIAL_TASK_STACK_SIZE=2048
|
||||
CONFIG_FMB_SERIAL_BUF_SIZE=256
|
||||
CONFIG_FMB_SERIAL_TASK_PRIO=10
|
||||
CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT=
|
||||
CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20
|
||||
CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20
|
||||
CONFIG_FMB_CONTROLLER_STACK_SIZE=4096
|
||||
CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20
|
||||
CONFIG_FMB_TIMER_PORT_ENABLED=y
|
||||
CONFIG_FMB_TIMER_GROUP=0
|
||||
CONFIG_FMB_TIMER_INDEX=0
|
||||
|
||||
#
|
||||
# FreeRTOS
|
||||
#
|
||||
CONFIG_FREERTOS_UNICORE=
|
||||
CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF
|
||||
CONFIG_FREERTOS_CORETIMER_0=y
|
||||
CONFIG_FREERTOS_CORETIMER_1=
|
||||
CONFIG_FREERTOS_HZ=100
|
||||
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y
|
||||
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE=
|
||||
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL=
|
||||
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y
|
||||
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=
|
||||
CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y
|
||||
CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1
|
||||
CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y
|
||||
CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE=
|
||||
CONFIG_FREERTOS_ASSERT_DISABLE=
|
||||
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536
|
||||
CONFIG_FREERTOS_ISR_STACKSIZE=1536
|
||||
CONFIG_FREERTOS_LEGACY_HOOKS=
|
||||
CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16
|
||||
CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y
|
||||
CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=
|
||||
CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1
|
||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048
|
||||
CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10
|
||||
CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
|
||||
CONFIG_FREERTOS_USE_TRACE_FACILITY=
|
||||
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=
|
||||
CONFIG_FREERTOS_DEBUG_INTERNALS=
|
||||
CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y
|
||||
CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
|
||||
CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=
|
||||
|
||||
#
|
||||
# Heap memory debugging
|
||||
#
|
||||
CONFIG_HEAP_POISONING_DISABLED=y
|
||||
CONFIG_HEAP_POISONING_LIGHT=
|
||||
CONFIG_HEAP_POISONING_COMPREHENSIVE=
|
||||
CONFIG_HEAP_TRACING_OFF=y
|
||||
CONFIG_HEAP_TRACING_STANDALONE=
|
||||
CONFIG_HEAP_TRACING_TOHOST=
|
||||
CONFIG_HEAP_TRACING=
|
||||
|
||||
#
|
||||
# libsodium
|
||||
#
|
||||
|
||||
#
|
||||
# Log output
|
||||
#
|
||||
CONFIG_LOG_DEFAULT_LEVEL_NONE=
|
||||
CONFIG_LOG_DEFAULT_LEVEL_ERROR=
|
||||
CONFIG_LOG_DEFAULT_LEVEL_WARN=
|
||||
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
||||
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=
|
||||
CONFIG_LOG_DEFAULT_LEVEL_VERBOSE=
|
||||
CONFIG_LOG_DEFAULT_LEVEL=3
|
||||
CONFIG_LOG_COLORS=y
|
||||
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
|
||||
CONFIG_LWIP_L2_TO_L3_COPY=
|
||||
CONFIG_LWIP_IRAM_OPTIMIZATION=
|
||||
CONFIG_LWIP_TIMERS_ONDEMAND=y
|
||||
CONFIG_LWIP_MAX_SOCKETS=10
|
||||
CONFIG_LWIP_USE_ONLY_LWIP_SELECT=
|
||||
CONFIG_LWIP_SO_REUSE=y
|
||||
CONFIG_LWIP_SO_REUSE_RXTOALL=y
|
||||
CONFIG_LWIP_SO_RCVBUF=
|
||||
CONFIG_LWIP_IP_FRAG=y
|
||||
CONFIG_LWIP_IP_REASSEMBLY=
|
||||
CONFIG_LWIP_STATS=
|
||||
CONFIG_LWIP_ETHARP_TRUST_IP_MAC=
|
||||
CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
|
||||
CONFIG_LWIP_GARP_TMR_INTERVAL=60
|
||||
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
|
||||
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
|
||||
CONFIG_LWIP_DHCP_RESTORE_LAST_IP=
|
||||
|
||||
#
|
||||
# DHCP server
|
||||
#
|
||||
CONFIG_LWIP_DHCPS_LEASE_UNIT=60
|
||||
CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
|
||||
CONFIG_LWIP_AUTOIP=
|
||||
CONFIG_LWIP_IPV6_AUTOCONFIG=
|
||||
CONFIG_LWIP_NETIF_LOOPBACK=y
|
||||
CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8
|
||||
|
||||
#
|
||||
# TCP
|
||||
#
|
||||
CONFIG_LWIP_MAX_ACTIVE_TCP=16
|
||||
CONFIG_LWIP_MAX_LISTENING_TCP=16
|
||||
CONFIG_LWIP_TCP_MAXRTX=12
|
||||
CONFIG_LWIP_TCP_SYNMAXRTX=6
|
||||
CONFIG_LWIP_TCP_MSS=1440
|
||||
CONFIG_LWIP_TCP_MSL=60000
|
||||
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744
|
||||
CONFIG_LWIP_TCP_WND_DEFAULT=5744
|
||||
CONFIG_LWIP_TCP_RECVMBOX_SIZE=6
|
||||
CONFIG_LWIP_TCP_QUEUE_OOSEQ=y
|
||||
CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES=
|
||||
CONFIG_LWIP_TCP_OVERSIZE_MSS=y
|
||||
CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS=
|
||||
CONFIG_LWIP_TCP_OVERSIZE_DISABLE=
|
||||
|
||||
#
|
||||
# UDP
|
||||
#
|
||||
CONFIG_LWIP_MAX_UDP_PCBS=16
|
||||
CONFIG_LWIP_UDP_RECVMBOX_SIZE=6
|
||||
CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072
|
||||
CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
|
||||
CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=
|
||||
CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1=
|
||||
CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF
|
||||
CONFIG_LWIP_PPP_SUPPORT=
|
||||
|
||||
#
|
||||
# ICMP
|
||||
#
|
||||
CONFIG_LWIP_MULTICAST_PING=
|
||||
CONFIG_LWIP_BROADCAST_PING=
|
||||
|
||||
#
|
||||
# LWIP RAW API
|
||||
#
|
||||
CONFIG_LWIP_MAX_RAW_PCBS=16
|
||||
|
||||
#
|
||||
# SNTP
|
||||
#
|
||||
CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1
|
||||
CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000
|
||||
|
||||
#
|
||||
# mbedTLS
|
||||
#
|
||||
CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
|
||||
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=
|
||||
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=
|
||||
CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC=
|
||||
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
|
||||
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384
|
||||
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
|
||||
CONFIG_MBEDTLS_DEBUG=
|
||||
CONFIG_MBEDTLS_ECP_RESTARTABLE=
|
||||
CONFIG_MBEDTLS_CMAC_C=
|
||||
CONFIG_MBEDTLS_HARDWARE_AES=y
|
||||
CONFIG_MBEDTLS_HARDWARE_MPI=
|
||||
CONFIG_MBEDTLS_HARDWARE_SHA=y
|
||||
CONFIG_MBEDTLS_HAVE_TIME=y
|
||||
CONFIG_MBEDTLS_HAVE_TIME_DATE=
|
||||
CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
|
||||
CONFIG_MBEDTLS_TLS_SERVER_ONLY=
|
||||
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=
|
||||
CONFIG_MBEDTLS_TLS_DISABLED=
|
||||
CONFIG_MBEDTLS_TLS_SERVER=y
|
||||
CONFIG_MBEDTLS_TLS_CLIENT=y
|
||||
CONFIG_MBEDTLS_TLS_ENABLED=y
|
||||
|
||||
#
|
||||
# TLS Key Exchange Methods
|
||||
#
|
||||
CONFIG_MBEDTLS_PSK_MODES=
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y
|
||||
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y
|
||||
CONFIG_MBEDTLS_SSL_RENEGOTIATION=y
|
||||
CONFIG_MBEDTLS_SSL_PROTO_SSL3=
|
||||
CONFIG_MBEDTLS_SSL_PROTO_TLS1=y
|
||||
CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y
|
||||
CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
|
||||
CONFIG_MBEDTLS_SSL_PROTO_DTLS=
|
||||
CONFIG_MBEDTLS_SSL_ALPN=y
|
||||
CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y
|
||||
CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y
|
||||
|
||||
#
|
||||
# Symmetric Ciphers
|
||||
#
|
||||
CONFIG_MBEDTLS_AES_C=y
|
||||
CONFIG_MBEDTLS_CAMELLIA_C=
|
||||
CONFIG_MBEDTLS_DES_C=
|
||||
CONFIG_MBEDTLS_RC4_DISABLED=y
|
||||
CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT=
|
||||
CONFIG_MBEDTLS_RC4_ENABLED=
|
||||
CONFIG_MBEDTLS_BLOWFISH_C=
|
||||
CONFIG_MBEDTLS_XTEA_C=
|
||||
CONFIG_MBEDTLS_CCM_C=y
|
||||
CONFIG_MBEDTLS_GCM_C=y
|
||||
CONFIG_MBEDTLS_RIPEMD160_C=
|
||||
|
||||
#
|
||||
# Certificates
|
||||
#
|
||||
CONFIG_MBEDTLS_PEM_PARSE_C=y
|
||||
CONFIG_MBEDTLS_PEM_WRITE_C=y
|
||||
CONFIG_MBEDTLS_X509_CRL_PARSE_C=y
|
||||
CONFIG_MBEDTLS_X509_CSR_PARSE_C=y
|
||||
CONFIG_MBEDTLS_ECP_C=y
|
||||
CONFIG_MBEDTLS_ECDH_C=y
|
||||
CONFIG_MBEDTLS_ECDSA_C=y
|
||||
CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y
|
||||
CONFIG_MBEDTLS_ECP_NIST_OPTIM=y
|
||||
|
||||
#
|
||||
# mDNS
|
||||
#
|
||||
CONFIG_MDNS_MAX_SERVICES=10
|
||||
|
||||
#
|
||||
# ESP-MQTT Configurations
|
||||
#
|
||||
CONFIG_MQTT_PROTOCOL_311=y
|
||||
CONFIG_MQTT_TRANSPORT_SSL=y
|
||||
CONFIG_MQTT_TRANSPORT_WEBSOCKET=y
|
||||
CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y
|
||||
CONFIG_MQTT_USE_CUSTOM_CONFIG=
|
||||
CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED=
|
||||
CONFIG_MQTT_CUSTOM_OUTBOX=
|
||||
|
||||
#
|
||||
# Newlib
|
||||
#
|
||||
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y
|
||||
CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF=
|
||||
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR=
|
||||
CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF=
|
||||
CONFIG_NEWLIB_STDIN_LINE_ENDING_LF=
|
||||
CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y
|
||||
CONFIG_NEWLIB_NANO_FORMAT=
|
||||
|
||||
#
|
||||
# NVS
|
||||
#
|
||||
|
||||
#
|
||||
# OpenSSL
|
||||
#
|
||||
CONFIG_OPENSSL_DEBUG=
|
||||
CONFIG_OPENSSL_ASSERT_DO_NOTHING=
|
||||
CONFIG_OPENSSL_ASSERT_EXIT=y
|
||||
|
||||
#
|
||||
# PThreads
|
||||
#
|
||||
CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5
|
||||
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
|
||||
CONFIG_PTHREAD_STACK_MIN=768
|
||||
CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y
|
||||
CONFIG_PTHREAD_DEFAULT_CORE_0=
|
||||
CONFIG_PTHREAD_DEFAULT_CORE_1=
|
||||
CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1
|
||||
CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread"
|
||||
|
||||
#
|
||||
# SPI Flash driver
|
||||
#
|
||||
CONFIG_SPI_FLASH_VERIFY_WRITE=
|
||||
CONFIG_SPI_FLASH_ENABLE_COUNTERS=
|
||||
CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y
|
||||
CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y
|
||||
CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS=
|
||||
CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=
|
||||
CONFIG_SPI_FLASH_USE_LEGACY_IMPL=
|
||||
|
||||
#
|
||||
# Auto-detect flash chips
|
||||
#
|
||||
CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y
|
||||
CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y
|
||||
|
||||
#
|
||||
# SPIFFS Configuration
|
||||
#
|
||||
CONFIG_SPIFFS_MAX_PARTITIONS=3
|
||||
|
||||
#
|
||||
# SPIFFS Cache Configuration
|
||||
#
|
||||
CONFIG_SPIFFS_CACHE=y
|
||||
CONFIG_SPIFFS_CACHE_WR=y
|
||||
CONFIG_SPIFFS_CACHE_STATS=
|
||||
CONFIG_SPIFFS_PAGE_CHECK=y
|
||||
CONFIG_SPIFFS_GC_MAX_RUNS=10
|
||||
CONFIG_SPIFFS_GC_STATS=
|
||||
CONFIG_SPIFFS_PAGE_SIZE=256
|
||||
CONFIG_SPIFFS_OBJ_NAME_LEN=32
|
||||
CONFIG_SPIFFS_USE_MAGIC=y
|
||||
CONFIG_SPIFFS_USE_MAGIC_LENGTH=y
|
||||
CONFIG_SPIFFS_META_LENGTH=4
|
||||
CONFIG_SPIFFS_USE_MTIME=y
|
||||
|
||||
#
|
||||
# Debug Configuration
|
||||
#
|
||||
CONFIG_SPIFFS_DBG=
|
||||
CONFIG_SPIFFS_API_DBG=
|
||||
CONFIG_SPIFFS_GC_DBG=
|
||||
CONFIG_SPIFFS_CACHE_DBG=
|
||||
CONFIG_SPIFFS_CHECK_DBG=
|
||||
CONFIG_SPIFFS_TEST_VISUALISATION=
|
||||
|
||||
#
|
||||
# TCP/IP Adapter
|
||||
#
|
||||
CONFIG_NETIF_IP_LOST_TIMER_INTERVAL=120
|
||||
CONFIG_TCPIP_LWIP=y
|
||||
|
||||
#
|
||||
# Unity unit testing library
|
||||
#
|
||||
CONFIG_UNITY_ENABLE_FLOAT=y
|
||||
CONFIG_UNITY_ENABLE_DOUBLE=y
|
||||
CONFIG_UNITY_ENABLE_COLOR=
|
||||
CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
|
||||
CONFIG_UNITY_ENABLE_FIXTURE=
|
||||
CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL=
|
||||
|
||||
#
|
||||
# Virtual file system
|
||||
#
|
||||
CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y
|
||||
CONFIG_VFS_SUPPORT_TERMIOS=y
|
||||
|
||||
#
|
||||
# Host File System I/O (Semihosting)
|
||||
#
|
||||
CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1
|
||||
CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128
|
||||
|
||||
#
|
||||
# Wear Levelling
|
||||
#
|
||||
CONFIG_WL_SECTOR_SIZE_512=
|
||||
CONFIG_WL_SECTOR_SIZE_4096=y
|
||||
CONFIG_WL_SECTOR_SIZE=4096
|
||||
|
||||
#
|
||||
# Wi-Fi Provisioning Manager
|
||||
#
|
||||
CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16
|
||||
CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30
|
||||
|
||||
#
|
||||
# Supplicant
|
||||
#
|
||||
CONFIG_WPA_MBEDTLS_CRYPTO=y
|
||||
CONFIG_WPA_TLS_V12=
|
||||
|
||||
#
|
||||
# Compatibility options
|
||||
#
|
||||
CONFIG_LEGACY_INCLUDE_COMMON_HEADERS=
|
||||
@@ -1,10 +1,11 @@
|
||||
# This file was automatically generated for projects
|
||||
# without default 'CMakeLists.txt' file.
|
||||
|
||||
|
||||
|
||||
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
|
||||
|
||||
# idf_component_register(SRCS ${app_sources})
|
||||
|
||||
idf_component_register(SRCS ${app_sources}
|
||||
INCLUDE_DIRS "."
|
||||
EMBED_FILES "favicon.ico")
|
||||
INCLUDE_DIRS ".")
|
||||
|
||||
24
code/src/gitversion.cmake
Normal 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)
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "driver/gpio.h"
|
||||
#include "sdkconfig.h"
|
||||
//#include "version.h"
|
||||
|
||||
#include "ClassLogFile.h"
|
||||
|
||||
@@ -106,28 +107,31 @@ extern "C" void app_main()
|
||||
{
|
||||
printf("Do Reset Camera\n");
|
||||
PowerResetCamera();
|
||||
// LogFile.WriteToFile("Startsequence 01");
|
||||
Init_NVS_SDCard();
|
||||
LogFile.WriteToFile("Startsequence 02");
|
||||
// LogFile.WriteToFile("Startsequence 02");
|
||||
CheckOTAUpdate();
|
||||
LogFile.WriteToFile("Startsequence 03");
|
||||
// LogFile.WriteToFile("Startsequence 03");
|
||||
std::string ssid = "";
|
||||
std::string password = "";
|
||||
LoadWlanFromFile("/sdcard/wlan.ini", ssid, password);
|
||||
LogFile.WriteToFile("Startsequence 04");
|
||||
printf("WLan: %s, %s\n", ssid.c_str(), password.c_str());
|
||||
std::string hostname = "";
|
||||
|
||||
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);
|
||||
LogFile.WriteToFile("Startsequence 05");
|
||||
initialise_wifi(ssid, password, hostname);
|
||||
// LogFile.WriteToFile("Startsequence 05");
|
||||
|
||||
TickType_t xDelay;
|
||||
xDelay = 2000 / portTICK_PERIOD_MS;
|
||||
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
|
||||
LogFile.WriteToFile("Startsequence 06");
|
||||
// LogFile.WriteToFile("Startsequence 06");
|
||||
vTaskDelay( xDelay );
|
||||
LogFile.WriteToFile("Startsequence 07");
|
||||
// LogFile.WriteToFile("Startsequence 07");
|
||||
setup_time();
|
||||
LogFile.WriteToFile("======================== Main Started ================================");
|
||||
LogFile.SwitchOnOff(false);
|
||||
|
||||
std::string zw = gettimestring("%Y%m%d-%H%M%S");
|
||||
printf("time %s\n", zw.c_str());
|
||||
|
||||
@@ -58,7 +58,6 @@ void doInit(void)
|
||||
|
||||
bool doflow(void)
|
||||
{
|
||||
int i;
|
||||
std::string zw_time = gettimestring("%Y%m%d-%H%M%S");
|
||||
printf("doflow - start %s\n", zw_time.c_str());
|
||||
flowisrunning = true;
|
||||
@@ -131,9 +130,9 @@ esp_err_t handler_doflow(httpd_req_t *req)
|
||||
esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
||||
{
|
||||
LogFile.WriteToFile("handler_wasserzaehler");
|
||||
const char* resp_str;
|
||||
string zw;
|
||||
bool _rawValue = false;
|
||||
bool _noerror = false;
|
||||
string zw;
|
||||
|
||||
printf("handler_wasserzaehler uri:\n"); printf(req->uri); printf("\n");
|
||||
|
||||
@@ -148,9 +147,14 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
||||
printf("rawvalue is found"); printf(_size); printf("\n");
|
||||
_rawValue = true;
|
||||
}
|
||||
if (httpd_query_key_value(_query, "noerror", _size, 10) == ESP_OK)
|
||||
{
|
||||
printf("noerror is found"); printf(_size); printf("\n");
|
||||
_noerror = true;
|
||||
}
|
||||
}
|
||||
|
||||
zw = tfliteflow.getReadout(_rawValue);
|
||||
zw = tfliteflow.getReadout(_rawValue, _noerror);
|
||||
if (zw.length() > 0)
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
|
||||
@@ -213,9 +217,6 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
|
||||
esp_err_t handler_editflow(httpd_req_t *req)
|
||||
{
|
||||
LogFile.WriteToFile("handler_editflow");
|
||||
const char* resp_str;
|
||||
string zw;
|
||||
bool _rawValue = false;
|
||||
|
||||
printf("handler_editflow uri: "); printf(req->uri); printf("\n");
|
||||
|
||||
@@ -396,7 +397,7 @@ esp_err_t handler_prevalue(httpd_req_t *req)
|
||||
}
|
||||
|
||||
if (strlen(_size) == 0)
|
||||
zw = "Actual PreValue: " + tfliteflow.GetPrevalue();
|
||||
zw = tfliteflow.GetPrevalue();
|
||||
else
|
||||
zw = "SetPrevalue to " + tfliteflow.UpdatePrevalue(_size);
|
||||
|
||||
@@ -410,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)
|
||||
{
|
||||
int64_t fr_start, fr_delta_ms;
|
||||
@@ -435,7 +465,11 @@ void task_autodoFlow(void *pvParameter)
|
||||
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;
|
||||
const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
|
||||
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
|
||||
@@ -483,5 +517,10 @@ void register_server_tflite_uri(httpd_handle_t server)
|
||||
camuri.uri = "/wasserzaehler.html";
|
||||
camuri.handler = handler_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
@@ -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()
|
||||
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 144 KiB |
BIN
images/index.png
|
Before Width: | Height: | Size: 822 KiB After Width: | Height: | Size: 822 KiB |
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 179 KiB |
@@ -11,9 +11,9 @@ InitalRotate=180
|
||||
SearchFieldX = 20
|
||||
SearchFieldY = 20
|
||||
|
||||
|
||||
[Digits]
|
||||
;Model=/config/dig0622.tfl
|
||||
Model=/config/dig0630s3.tflite
|
||||
Model=/config/dig0640s3.tflite
|
||||
LogImageLocation = /log/digit
|
||||
ModelInputSize 20, 32
|
||||
digit1, 306, 120, 37, 67
|
||||
@@ -21,7 +21,6 @@ digit2, 355, 120, 37, 67
|
||||
digit3, 404, 120, 37, 67
|
||||
|
||||
[Analog]
|
||||
;Model=/config/ana0622.tfl
|
||||
Model=/config/ana0630s2.tflite
|
||||
LogImageLocation = /log/analog
|
||||
ModelInputSize 32, 32
|
||||
@@ -31,6 +30,7 @@ analog3, 294, 369, 92, 92
|
||||
analog4, 168, 326, 92, 92
|
||||
|
||||
[PostProcessing]
|
||||
DecimalShift = 0
|
||||
PreValueUse = True
|
||||
PreValueAgeStartup = 30
|
||||
AllowNegativeRates = False
|
||||
@@ -43,4 +43,7 @@ CheckDigitIncreaseConsistency = True
|
||||
AutoStart= True
|
||||
Intervall = 4.85
|
||||
|
||||
[Debug]
|
||||
Logfile = False
|
||||
|
||||
[Ende]
|
||||
BIN
sd-card/config/dig0640s3.tflite
Normal file
@@ -1,101 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<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>
|
||||
|
||||
<div class="body-content">
|
||||
|
||||
<div id="createrefernce">
|
||||
<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>
|
||||
<body style="font-family: arial; padding: 0px 10px;">
|
||||
|
||||
<h2>Define Alignment Structure in Reference Image</h2>
|
||||
|
||||
<td>
|
||||
<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="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>
|
||||
<table>
|
||||
<tr>
|
||||
<td><canvas id="canvas" crossorigin></canvas></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript" src="./gethost.js"></script>
|
||||
<script type="text/javascript" src="./readconfig.js"></script>
|
||||
<table>
|
||||
<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'),
|
||||
ctx = canvas.getContext('2d'),
|
||||
imageObj = new Image(),
|
||||
@@ -364,7 +361,5 @@ function dataURLtoBlob(dataurl) {
|
||||
|
||||
init();
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,87 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Make Alignment</title>
|
||||
<meta charset="utf-8"/>
|
||||
<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>
|
||||
|
||||
<div class="body-content">
|
||||
|
||||
<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" name="newROI" onclick="newROI()" value="New ROI (after current)">
|
||||
<input type="submit" 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>
|
||||
<body style="font-family: arial; padding: 0px 10px;">
|
||||
|
||||
<td>
|
||||
<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" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Edit Analog</h2>
|
||||
|
||||
<script type="text/javascript" src="./gethost.js"></script>
|
||||
<script type="text/javascript" src="./readconfig.js"></script>
|
||||
<table>
|
||||
<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'),
|
||||
ctx = canvas.getContext('2d'),
|
||||
imageObj = new Image(),
|
||||
@@ -159,6 +180,12 @@ function SaveToConfig(){
|
||||
function UpdateROIs(){
|
||||
if (ROIInfo.length == 0){
|
||||
alert("There are no ROIs defined.\nPlease first define minimum one ROI in the config.ini by hand.\n");
|
||||
document.getElementById("newROI").disabled = true;
|
||||
document.getElementById("deleteROI").disabled = true;
|
||||
document.getElementById("index").disabled = true;
|
||||
document.getElementById("saveroi").disabled = true;
|
||||
document.getElementById("moveNext").disabled = true;
|
||||
document.getElementById("movePrevious").disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,7 +274,9 @@ function ParseIni(_basepath) {
|
||||
loadCanvas(basepath + "/fileserver/config/reference.jpg");
|
||||
ParseIni(basepath);
|
||||
drawImage();
|
||||
draw();
|
||||
}
|
||||
|
||||
function drawImage(){
|
||||
var canvas = document.getElementById('canvas');
|
||||
var context = canvas.getContext('2d');
|
||||
@@ -383,8 +412,6 @@ function ParseIni(_basepath) {
|
||||
|
||||
|
||||
init();
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,26 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<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">
|
||||
|
||||
<table>
|
||||
<tr><td>Result:</td></tr>
|
||||
<tr><td colspan="2">Result:</td></tr>
|
||||
<tr>
|
||||
<td>
|
||||
<iframe name="maincontent" id ="maincontent" width="800px" height="800px"></iframe>
|
||||
<iframe name="maincontent" id ="maincontent" width="700px" height="700px"></iframe>
|
||||
</td>
|
||||
<td>
|
||||
<td style="padding-left: 15px;">
|
||||
<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>
|
||||
<input type="submit" id="align" onclick="doAlign()" value="2. Align Image"><br>
|
||||
Takes up to 2 Minutes!
|
||||
</p>
|
||||
</p>
|
||||
Digits and Analog recognition not yet implemented.
|
||||
<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>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,16 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<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>
|
||||
<tr><td>Config.ini:</td></tr>
|
||||
<tr><td><h2>Config.ini:</h2></td></tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<textarea id="inputTextToSave" cols="80" rows="25"></textarea>
|
||||
<textarea id="inputTextToSave" cols="100" rows="33"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button onclick="saveTextAsFile()">Update Config.ini</button></td>
|
||||
</tr>
|
||||
<td><button class="button" onclick="saveTextAsFile()">Update Config.ini</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate updates</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript" src="./gethost.js"></script>
|
||||
@@ -35,6 +62,17 @@ function saveTextAsFile()
|
||||
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();
|
||||
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr><td>Config.ini:</td></tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<textarea id="inputTextToSave" cols="80" rows="25"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button onclick="saveTextAsFile()">Update Config.ini</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function loadConfig() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function () {
|
||||
// alert(this.responseText);
|
||||
document.getElementById("inputTextToSave").value = this.responseText;
|
||||
};
|
||||
url = '/fileserver/config/config.ini';
|
||||
xhr.open('GET', url);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
|
||||
function saveTextAsFile()
|
||||
{
|
||||
if (confirm("Are you sure you want to update \"config.ini\"?")) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
|
||||
/* first delete the old firmware */
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (xhttp.readyState == 4) {
|
||||
if (xhttp.status == 200) {
|
||||
/* keine Reaktion, damit sich das Dokument nicht ändert */
|
||||
} else if (xhttp.status == 0) {
|
||||
alert("Server closed the connection abruptly!");
|
||||
location.reload()
|
||||
} else {
|
||||
alert(xhttp.status + " Error!\n" + xhttp.responseText);
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
};
|
||||
xhttp.open("POST", "/delete/config/config.ini", false);
|
||||
xhttp.send();
|
||||
/* ----------------------------- */
|
||||
|
||||
var textToSave = document.getElementById("inputTextToSave").value;
|
||||
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (xhttp.readyState == 4) {
|
||||
if (xhttp.status == 200) {
|
||||
alert("Update \"config.ini\" successfull!\n\nTo make it active you need to reboot.")
|
||||
document.reload();
|
||||
} else if (xhttp.status == 0) {
|
||||
alert("Server closed the connection abruptly!");
|
||||
location.reload()
|
||||
} else {
|
||||
alert(xhttp.status + " Error!\n" + xhttp.responseText);
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
upload_path = "/upload/config/config.ini";
|
||||
|
||||
xhttp.open("POST", upload_path, true);
|
||||
xhttp.send(textToSave);
|
||||
}
|
||||
}
|
||||
|
||||
loadConfig();
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,87 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Make Alignment</title>
|
||||
<meta charset="utf-8"/>
|
||||
<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>
|
||||
|
||||
<div class="body-content">
|
||||
|
||||
<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" name="newROI" onclick="newROI()" value="New ROI (after current)">
|
||||
<input type="submit" 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>
|
||||
<body style="font-family: arial; padding: 0px 10px;">
|
||||
|
||||
<td>
|
||||
<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" name="saveroi" onclick="SaveToConfig()" value="Save all to Config.ini">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Edit Digits</h2>
|
||||
|
||||
<script type="text/javascript" src="./gethost.js"></script>
|
||||
<script type="text/javascript" src="./readconfig.js"></script>
|
||||
<table>
|
||||
<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'),
|
||||
ctx = canvas.getContext('2d'),
|
||||
imageObj = new Image(),
|
||||
@@ -159,6 +180,12 @@ function SaveToConfig(){
|
||||
function UpdateROIs(){
|
||||
if (ROIInfo.length == 0){
|
||||
alert("There are no ROIs defined.\nPlease first define minimum one ROI in the config.ini by hand.\n");
|
||||
document.getElementById("newROI").disabled = true;
|
||||
document.getElementById("deleteROI").disabled = true;
|
||||
document.getElementById("index").disabled = true;
|
||||
document.getElementById("saveroi").disabled = true;
|
||||
document.getElementById("moveNext").disabled = true;
|
||||
document.getElementById("movePrevious").disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -384,8 +411,7 @@ function ParseIni(_basepath) {
|
||||
|
||||
|
||||
init();
|
||||
</script>
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,59 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Make refernce</title>
|
||||
<title>Make Reference</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>
|
||||
|
||||
<body>
|
||||
<h3>Create Reference out of Raw Image</h3>
|
||||
<div style="padding-left: 30px">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="button" value="Show actual Reference" onclick="showReference()">
|
||||
</td>
|
||||
<td>
|
||||
<input type="button" value="Create new Reference" onclick="loadRawImage()">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<body style="font-family: arial; padding: 0px 10px;">
|
||||
<h2>Create Reference out of Raw Image</h2>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><input class="button" type="button" value="Show Actual Reference" onclick="showReference()"></td>
|
||||
<td><input class="button" type="button" value="Create New Reference" onclick="loadRawImage()"></td>
|
||||
<td><input class="button" type="submit" id="take" onclick="doTake()" value="New Raw Image (raw.jpg)"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-top: 10px"><label for="mirror">Mirror Image:</label></td>
|
||||
<td style="padding-top: 10px"><input type="checkbox" id="mirror" name="mirror" value="1" onchange="drawRotated()"></td>
|
||||
</tr>
|
||||
<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>
|
||||
<tr>
|
||||
<td><canvas id="canvas"></canvas></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input class="button" type="button" id="updatereferenceimage" value="Update Reference Image" onclick="SaveReference()"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<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="./readconfig.js"></script>
|
||||
@@ -63,27 +73,47 @@
|
||||
ctx = canvas.getContext('2d'),
|
||||
imageObj = new Image()
|
||||
basepath = "http://192.168.178.26";
|
||||
isActReference = false;
|
||||
|
||||
function doTake(){
|
||||
var xhttp = new XMLHttpRequest();
|
||||
url = basepath + "/editflow.html?task=test_take";
|
||||
if (basepath.length > 0){
|
||||
url = url + "&host=" + basepath;
|
||||
}
|
||||
xhttp.open("GET", url, false);
|
||||
xhttp.send();
|
||||
loadRawImage();
|
||||
}
|
||||
|
||||
function loadRawImage(){
|
||||
url = basepath + "/fileserver/img_tmp/raw.jpg";
|
||||
url = basepath + "/fileserver/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);
|
||||
document.getElementById("finerotate").value = 0;
|
||||
document.getElementById("prerotateangle").value = getPreRotate();
|
||||
document.getElementById("mirror").checked = getMirror();
|
||||
document.getElementById("finerotate").disabled = false;
|
||||
document.getElementById("prerotateangle").disabled = false;
|
||||
document.getElementById("updatereferenceimage").disabled = false;
|
||||
document.getElementById("take").disabled = false;
|
||||
document.getElementById("mirror").disabled = false;
|
||||
|
||||
// document.getElementById("ButtonRotate").disabled = false;
|
||||
isActReference = false;
|
||||
loadCanvas(url);
|
||||
drawRotated();
|
||||
}
|
||||
|
||||
function showReference(){
|
||||
url = basepath + "/fileserver/config/reference.jpg";
|
||||
url = basepath + "/fileserver/config/reference.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);;
|
||||
document.getElementById("finerotate").value = 0;
|
||||
document.getElementById("prerotateangle").value = 0;
|
||||
document.getElementById("finerotate").disabled = true;
|
||||
document.getElementById("prerotateangle").disabled = true;
|
||||
document.getElementById("updatereferenceimage").disabled = true;
|
||||
// document.getElementById("ButtonRotate").disabled = true;
|
||||
document.getElementById("take").disabled = true;
|
||||
document.getElementById("mirror").disabled = true;
|
||||
|
||||
isActReference = true;
|
||||
loadCanvas(url);
|
||||
ParseConfig();
|
||||
drawRotated();
|
||||
@@ -101,7 +131,8 @@
|
||||
function SaveReference(){
|
||||
if (confirm("Are you sure you want to update the reference image?")) {
|
||||
setPreRotate(document.getElementById("prerotateangle").value);
|
||||
UpdateConfigFile(basepath);
|
||||
setMirror(document.getElementById("mirror").checked);
|
||||
UpdateConfigFileReferenceChange(basepath);
|
||||
var canvas = document.getElementById("canvas");
|
||||
drawRotated(false);
|
||||
SaveCanvasToImage(canvas, "/config/reference.jpg", true, basepath);
|
||||
@@ -141,12 +172,15 @@
|
||||
canvas.addEventListener('mousemove', mouseMove, false);
|
||||
basepath = getbasepath();
|
||||
loadConfig(basepath);
|
||||
ParseConfig();
|
||||
showReference();
|
||||
}
|
||||
|
||||
function drawRotated(_grid = true){
|
||||
finerot= parseFloat(document.getElementById("finerotate").value);
|
||||
prerot = parseFloat(document.getElementById("prerotateangle").value);
|
||||
mirror = document.getElementById("mirror").checked;
|
||||
|
||||
if (finerot == 1) {
|
||||
prerot+=1
|
||||
finerot = 0
|
||||
@@ -164,11 +198,21 @@
|
||||
|
||||
context.clearRect(0,0,imageObj.width,imageObj.height);
|
||||
context.save();
|
||||
context.translate(imageObj.width/2,imageObj.height/2);
|
||||
context.rotate(degrees*Math.PI/180);
|
||||
context.drawImage(imageObj,-imageObj.width/2,-imageObj.height/2);
|
||||
|
||||
if (mirror) {
|
||||
context.scale(-1, 1);
|
||||
context.translate(-imageObj.width/2,imageObj.height/2);
|
||||
context.rotate(-degrees*Math.PI/180);
|
||||
context.drawImage(imageObj, imageObj.width/2,-imageObj.height/2, -imageObj.width, imageObj.height);
|
||||
}
|
||||
else {
|
||||
context.translate(imageObj.width/2,imageObj.height/2);
|
||||
context.rotate(degrees*Math.PI/180);
|
||||
context.drawImage(imageObj,-imageObj.width/2,-imageObj.height/2);
|
||||
}
|
||||
|
||||
context.restore();
|
||||
if (_grid == true){
|
||||
if (_grid == true && !isActReference){
|
||||
drawGrid();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
|
||||
function gethost_Version(){
|
||||
return "1.0.0 - 20200910";
|
||||
}
|
||||
|
||||
function getbasepath(){
|
||||
var host = window.location.hostname;
|
||||
if (host == "127.0.0.1")
|
||||
@@ -14,8 +18,13 @@ function getbasepath(){
|
||||
return host;
|
||||
}
|
||||
|
||||
function UpdatePage(){
|
||||
function UpdatePage(_dosession = true){
|
||||
var zw = location.href;
|
||||
zw = zw.substr(0, zw.indexOf("?"));
|
||||
window.location = zw + '?session=' + Math.floor((Math.random() * 1000000) + 1);
|
||||
if (_dosession) {
|
||||
window.location = zw + '?session=' + Math.floor((Math.random() * 1000000) + 1);
|
||||
}
|
||||
else {
|
||||
window.location = zw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,115 +1,104 @@
|
||||
<html><head>
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type="text/css" media="screen">
|
||||
nav > ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
nav li {
|
||||
margin: 0.5em;
|
||||
padding: 0;
|
||||
font-size: 1.5em;
|
||||
flex: 1 1 0%;
|
||||
}
|
||||
|
||||
@media (min-width: 45em) {
|
||||
nav > ul {
|
||||
flex-direction: row;
|
||||
}
|
||||
nav li {
|
||||
flex: 1;
|
||||
font-size: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
nav a {
|
||||
display: block;
|
||||
padding: 0.4em;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
border: 1px solid darkblue;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 10px white inset;
|
||||
color: gold;
|
||||
background-color: darkblue;
|
||||
transition: all .25s ease-in;
|
||||
}
|
||||
|
||||
nav li[aria-current] a {
|
||||
background-color: firebrick;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
nav a:focus,
|
||||
nav a:hover,
|
||||
nav li[aria-current] a:focus,
|
||||
nav li[aria-current] a:hover {
|
||||
color: darkblue;
|
||||
background-color: gold;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
html, body {
|
||||
height:100%;
|
||||
width:100%;
|
||||
margin:0;
|
||||
}
|
||||
.h_iframe iframe {
|
||||
width:98%;
|
||||
height:80%;
|
||||
}
|
||||
.h_iframe {
|
||||
height: 80%;
|
||||
width:98%;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
//]]>
|
||||
<style>
|
||||
.h_iframe iframe {width:995px;height:605px;}
|
||||
.h_iframe {width:995px;height:605px;}
|
||||
|
||||
</script>
|
||||
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;}
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: #333;
|
||||
width:1000px;
|
||||
}
|
||||
|
||||
li {
|
||||
float: left;
|
||||
font-family: arial;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
li a, .dropbtn {
|
||||
display: inline-block;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li a:hover, .dropdown:hover .dropbtn {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
li.dropdown {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
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 a {
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Watermeter - AI on the edge - an ESP32 all in neural network recognition system</h1>
|
||||
<nav>
|
||||
<ul>
|
||||
<li aria-current="page"><a href="#"onclick="document.getElementById('maincontent').src = '/wasserzaehler_roi.html';">wasserzaehler</a>
|
||||
<ul class="submenu">
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = '/prevalue_set.html';">Set preValue</a> </li>
|
||||
<li><a href="index_configure.html">Edit Configuration</a> </li>
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = '/wasserzaehler.html?full';">/wasserzaehler.html?full</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
<body style="font-family: arial">
|
||||
|
||||
<li><a href="#" onclick="document.getElementById('maincontent').src = '/fileserver/';">File Server</a> </li>
|
||||
|
||||
<li><a href="#">System</a>
|
||||
<ul class="submenu">
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = '/starttime';">Start time</a> </li>
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = '/ota_page.html';">OTA Update</a> </li>
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = '/reboot_page.html';">Reboot</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
<h1>Watermeter - AI on the edge</h1>
|
||||
<h2>An ESP32 all in neural network recognition system</h2>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<p>
|
||||
|
||||
<div class="h_iframe">
|
||||
<iframe name="maincontent" id ="maincontent" src="/wasserzaehler_roi.html" title="fileserver" allowfullscreen></iframe>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = '/wasserzaehler_roi.html';">Overview</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="javascript:void(0)" class="dropbtn">Configuration</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="#"onclick="document.getElementById('maincontent').src = '/prevalue_set.html';">Set preValue</a>
|
||||
<a href="index_configure.html">Edit Configuration</a>
|
||||
</div>
|
||||
</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 class="dropdown">
|
||||
<a href="javascript:void(0)" class="dropbtn">System</a>
|
||||
<div class="dropdown-content">
|
||||
<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>
|
||||
</div>
|
||||
</ul>
|
||||
<p>
|
||||
<div class="h_iframe">
|
||||
<iframe name="maincontent" id ="maincontent" src="/wasserzaehler_roi.html" title="fileserver" allowfullscreen></iframe>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,116 +1,101 @@
|
||||
<html><head>
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type="text/css" media="screen">
|
||||
nav > ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
nav li {
|
||||
margin: 0.5em;
|
||||
padding: 0;
|
||||
font-size: 1.5em;
|
||||
flex: 1 1 0%;
|
||||
}
|
||||
|
||||
@media (min-width: 45em) {
|
||||
nav > ul {
|
||||
flex-direction: row;
|
||||
}
|
||||
nav li {
|
||||
flex: 1;
|
||||
font-size: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
nav a {
|
||||
display: block;
|
||||
padding: 0.4em;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
border: 1px solid darkblue;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 10px white inset;
|
||||
color: gold;
|
||||
background-color: darkblue;
|
||||
transition: all .25s ease-in;
|
||||
}
|
||||
|
||||
nav li[aria-current] a {
|
||||
background-color: firebrick;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
nav a:focus,
|
||||
nav a:hover,
|
||||
nav li[aria-current] a:focus,
|
||||
nav li[aria-current] a:hover {
|
||||
color: darkblue;
|
||||
background-color: gold;
|
||||
}
|
||||
|
||||
|
||||
html, body {
|
||||
height:100%;
|
||||
width:100%;
|
||||
margin:0;
|
||||
}
|
||||
.h_iframe iframe {
|
||||
width:98%;
|
||||
height:150%;
|
||||
}
|
||||
.h_iframe {
|
||||
height: 150%;
|
||||
width:98%;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
//]]>
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Configure watermeter</h1>
|
||||
<nav>
|
||||
<ul>
|
||||
|
||||
|
||||
<li><a href="#" onclick="document.getElementById('maincontent').src = 'edit_config.html';">CONFIG.INI direct</a> </li>
|
||||
<li><a href="#">Alignment</a>
|
||||
<ul class="submenu">
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = 'edit_reference.html';">Reference Image</a> </li>
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = 'edit_alignment.html';">Alignment Marks</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#">Regions of interest</a>
|
||||
<ul class="submenu">
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = 'edit_digits.html';">Digital ROIs</a> </li>
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = 'edit_analog.html';">Analog ROIs</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><a href="#" onclick="document.getElementById('maincontent').src = 'edit_check.html';">Check</a> </li>
|
||||
<li aria-current="page"><a href="index.html">Main</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<p>
|
||||
|
||||
<div class="h_iframe">
|
||||
<iframe name="maincontent" id="maincontent" src="edit_config.html" title="fileserver"></iframe>
|
||||
</div>
|
||||
<style>
|
||||
.h_iframe iframe {width:995px;height:765px;}
|
||||
.h_iframe {width:995px;height:765px;}
|
||||
|
||||
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;}
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: #333;
|
||||
width:1000px;
|
||||
}
|
||||
|
||||
li {
|
||||
float: left;
|
||||
font-family: arial;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
li a, .dropbtn {
|
||||
display: inline-block;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
</body></html>
|
||||
li a:hover, .dropdown:hover .dropbtn {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
li.dropdown {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
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 a {
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body style="font-family: arial">
|
||||
|
||||
<h1>Configure Watermeter</h1>
|
||||
|
||||
<ul>
|
||||
<li aria-current="page"><a href="index.html">Main Page</a>
|
||||
<li><a href="#"onclick="document.getElementById('maincontent').src = 'edit_config.html';">CONFIG.INI direct</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="javascript:void(0)" class="dropbtn">Alignment</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="#"onclick="document.getElementById('maincontent').src = 'edit_reference.html';">Reference Image</a>
|
||||
<a href="#"onclick="document.getElementById('maincontent').src = 'edit_alignment.html';">Alignment Marks</a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="javascript:void(0)" class="dropbtn">Regions Of Interest (ROI)</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="#"onclick="document.getElementById('maincontent').src = 'edit_digits.html';">Digital ROIs</a>
|
||||
<a href="#"onclick="document.getElementById('maincontent').src = 'edit_analog.html';">Analog ROIs</a>
|
||||
</div>
|
||||
</li>
|
||||
<li><a href="#" onclick="document.getElementById('maincontent').src = 'edit_check.html';">Check</a></li>
|
||||
</ul>
|
||||
<p>
|
||||
<div class="h_iframe">
|
||||
<iframe width="1020px" height="650px" name="maincontent" id ="maincontent" src="edit_config.html" title="fileserver"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
2
sd-card/html/jquery-3.5.1.min.js
vendored
Normal file
@@ -1,15 +1,33 @@
|
||||
<html><head>
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
//]]>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>OTA Update</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<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>
|
||||
|
||||
<body>
|
||||
<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>
|
||||
<h2>1. Firmware Update</h2>
|
||||
<table class="fixed" border="0">
|
||||
@@ -17,8 +35,8 @@
|
||||
<td>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="newfile">Select the firmware file</label>
|
||||
<td style="width: 230px">
|
||||
<label for="newfile">Select the firmware file:</label>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<input id="newfile" type="file" onchange="setpath()" style="width:100%;">
|
||||
@@ -26,7 +44,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="filepath">Set path on server</label>
|
||||
<label for="filepath">Set path on server:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="filepath" type="text" style="width:100%;" readonly>
|
||||
@@ -40,19 +58,28 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>2. Update /html directory</h2>
|
||||
<h2>2. Update "/html" directory</h2>
|
||||
<table class="fixed" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="newfilehtml">Select the zipped /html content</label>
|
||||
<td style="width: 230px">
|
||||
<label for="newfilehtml">Select the zipped /html content:</label>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<input id="newfilehtml" type="file" onchange="setpathhtml()" style="width:100%;">
|
||||
@@ -60,7 +87,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="filepathhtml">Set path on server</label>
|
||||
<label for="filepathhtml">Set path on server:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="filepathhtml" type="text" style="width:100%;" readonly>
|
||||
@@ -74,7 +101,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -82,7 +109,7 @@
|
||||
<table class="fixed" border="0">
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -317,6 +344,5 @@ function uploadhtml() {
|
||||
init();
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,43 +1,81 @@
|
||||
<html><head>
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
//]]>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Set PreValue</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<style>
|
||||
h1 {font-size: 2em;}
|
||||
h2 {font-size: 1.5em;}
|
||||
h3 {font-size: 1.2em;}
|
||||
p {font-size: 1em;}
|
||||
|
||||
</script>
|
||||
div {
|
||||
width: 200px;
|
||||
padding: 10px 5px;
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
font-size: 16px;
|
||||
max-height: 35px;
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
<body>
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
Current Value:<p>
|
||||
<iframe name="currentvalue" id ="currentvalue" src="/setPreValue.html" title="fileserver" allowfullscreen></iframe>
|
||||
</tr>
|
||||
<tr>
|
||||
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>
|
||||
Result:<p>
|
||||
<iframe name="result" id ="result" src="" title="fileserver" allowfullscreen></iframe>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<script src="/jquery-3.5.1.min.js"></script>
|
||||
<script>
|
||||
$ (document).ready(function() {
|
||||
$("#prevalue").load("/setPreValue.html");
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function setprevalue() {
|
||||
var inputVal = document.getElementById("myInput").value;
|
||||
inputVal = inputVal.replace(",", ".");
|
||||
_value = "/setPreValue.html?value="+inputVal;
|
||||
document.getElementById('result').src = _value;
|
||||
_value = "<object data=" + "/setPreValue.html?value=" + inputVal + " ></object>";
|
||||
document.getElementById("result").innerHTML=_value;
|
||||
// location.reload();
|
||||
}
|
||||
</script>
|
||||
|
||||
<body style="font-family: arial; padding: 0px 10px;">
|
||||
<h3>Set the previous value for consistency check and substitution for NaN</h3>
|
||||
|
||||
<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>
|
||||
@@ -1,3 +1,7 @@
|
||||
function readconfig_Version(){
|
||||
return "1.0.0 - 20200910";
|
||||
}
|
||||
|
||||
var config_gesamt;
|
||||
var config_split;
|
||||
var ref = new Array(2);
|
||||
@@ -34,7 +38,13 @@ function ParseConfigAlignment(_aktline){
|
||||
|
||||
while ((akt_ref < 2) && (_aktline < config_split.length) && (config_split[_aktline][0] != "[")) {
|
||||
var linesplit = ZerlegeZeile(config_split[_aktline]);
|
||||
if ((linesplit[0] == "InitalRotate") && (linesplit.length > 1))
|
||||
if ((linesplit[0].toUpperCase() == "INITIALMIRROR") && (linesplit.length > 1))
|
||||
{
|
||||
initalrotate["mirror"] = linesplit[1].toUpperCase().localeCompare("TRUE") == 0;
|
||||
initalrotate["pos_config_mirror"] = _aktline;
|
||||
}
|
||||
|
||||
if (((linesplit[0].toUpperCase() == "INITALROTATE") || (linesplit[0].toUpperCase() == "INITIALROTATE")) && (linesplit.length > 1))
|
||||
{
|
||||
initalrotate["angle"] = parseInt(linesplit[1]);
|
||||
initalrotate["pos_config"] = _aktline;
|
||||
@@ -127,7 +137,7 @@ function SaveROIToConfig(_ROIInfo, _typeROI, _basepath){
|
||||
config_split.push(zw);
|
||||
for (var j = config_split.length-2; j > _pos + 1; --j){
|
||||
config_split[j] = config_split[j-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = targetROI.length-1; i > _ROIInfo.length-1; --i){
|
||||
@@ -155,16 +165,16 @@ function ParseConfig() {
|
||||
var aktline = 0;
|
||||
|
||||
while (aktline < config_split.length){
|
||||
if (config_split[aktline].trim() == "[Alignment]") {
|
||||
if (config_split[aktline].trim().toUpperCase() == "[ALIGNMENT]") {
|
||||
aktline = ParseConfigAlignment(aktline);
|
||||
continue;
|
||||
}
|
||||
if (config_split[aktline].trim() == "[Digits]") {
|
||||
if (config_split[aktline].trim().toUpperCase() == "[DIGITS]") {
|
||||
aktline = ParseConfigDigit(aktline);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (config_split[aktline].trim() == "[Analog]") {
|
||||
if (config_split[aktline].trim().toUpperCase() == "[ANALOG]") {
|
||||
aktline = ParseConfigAnalog(aktline);
|
||||
continue;
|
||||
}
|
||||
@@ -181,6 +191,17 @@ function setPreRotate(_prerotate){
|
||||
initalrotate["angle"] = _prerotate;
|
||||
}
|
||||
|
||||
function getMirror(){
|
||||
if (initalrotate.hasOwnProperty("mirror")) {
|
||||
return initalrotate["mirror"];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function setMirror(_mirror){
|
||||
initalrotate["mirror"] = _mirror;
|
||||
}
|
||||
|
||||
function SaveCanvasToImage(_canvas, _filename, _delete = true, _basepath = ""){
|
||||
var JPEG_QUALITY=0.8;
|
||||
var dataUrl = _canvas.toDataURL('image/jpeg', JPEG_QUALITY);
|
||||
@@ -194,7 +215,11 @@ function SaveCanvasToImage(_canvas, _filename, _delete = true, _basepath = ""){
|
||||
}
|
||||
|
||||
function SaveConfigToServer(_basepath){
|
||||
FileDeleteOnServer("/config/config.ini", _basepath);
|
||||
// leere Zeilen am Ende löschen
|
||||
var zw = config_split.length - 1;
|
||||
while (config_split[zw] == "") {
|
||||
config_split.pop();
|
||||
}
|
||||
|
||||
var config_gesamt = "";
|
||||
for (var i = 0; i < config_split.length; ++i)
|
||||
@@ -202,20 +227,60 @@ function SaveConfigToServer(_basepath){
|
||||
config_gesamt = config_gesamt + config_split[i] + "\n";
|
||||
}
|
||||
|
||||
FileDeleteOnServer("/config/config.ini", _basepath);
|
||||
|
||||
FileSendContent(config_gesamt, "/config/config.ini", _basepath);
|
||||
}
|
||||
|
||||
function UpdateConfigFile(_basepath){
|
||||
function UpdateConfigFileReferenceChange(_basepath){
|
||||
for (var _index = 0; _index < ref.length; ++_index){
|
||||
var zeile = ref[_index]["name"] + " " + ref[_index]["x"] + ", " + ref[_index]["y"];
|
||||
var _pos = ref[_index]["pos_ref"];
|
||||
config_split[_pos] = zeile;
|
||||
}
|
||||
|
||||
zeile = "InitalRotate=" + initalrotate["angle"];
|
||||
zeile = "InitialRotate = " + initalrotate["angle"];
|
||||
var _pos = initalrotate["pos_config"];
|
||||
config_split[_pos] = zeile;
|
||||
|
||||
var mirror = false;
|
||||
if (initalrotate.hasOwnProperty("mirror")) {
|
||||
mirror = initalrotate["mirror"];
|
||||
}
|
||||
var mirror_pos = -1;
|
||||
if (initalrotate.hasOwnProperty("pos_config_mirror")) {
|
||||
mirror_pos = initalrotate["pos_config_mirror"];
|
||||
}
|
||||
if (mirror_pos > -1) {
|
||||
if (mirror) {
|
||||
config_split[mirror_pos] = "InitialMirror = True";
|
||||
}
|
||||
else {
|
||||
config_split[mirror_pos] = "InitialMirror = False";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mirror) { // neue Zeile muss an der richtigen Stelle eingefügt werden - hier direct nach [Alignment]
|
||||
var aktline = 0;
|
||||
|
||||
while (aktline < config_split.length){
|
||||
if (config_split[aktline].trim() == "[Alignment]") {
|
||||
break;
|
||||
}
|
||||
aktline++
|
||||
}
|
||||
|
||||
// fuege neue Zeile in config_split ein
|
||||
var zw = config_split[config_split.length-1];
|
||||
config_split.push(zw);
|
||||
for (var j = config_split.length-2; j > aktline + 1; --j){
|
||||
config_split[j] = config_split[j-1];
|
||||
}
|
||||
|
||||
config_split[aktline + 1] = "InitialMirror = True"
|
||||
}
|
||||
}
|
||||
|
||||
SaveConfigToServer(_basepath);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +1,47 @@
|
||||
<html><head>
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
//]]>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Reboot</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<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>
|
||||
|
||||
<body>
|
||||
<body style="font-family: arial; padding: 0px 10px;">
|
||||
|
||||
<h3>Do you really want to reboot your ESP32 now?</h3>
|
||||
|
||||
<table class="fixed" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<button id="reboot" type="button" onclick="doReboot()">Reboot</button>
|
||||
<button class="button" id="reboot" type="button" onclick="doReboot()">Yes, please reboot</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
function doReboot() {
|
||||
if (confirm("Are you sure you want to reboot the ESP32?")) {
|
||||
// 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);
|
||||
}
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<table class="fixed" border="0">
|
||||
<table class="fixed" border="0" style="font-family: arial">
|
||||
<col width="300px" /><col width="200px" />
|
||||
<tr><td>
|
||||
<h2>ESP32 File Server</h2>
|
||||
@@ -30,8 +30,10 @@
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript" src="./gethost.js"></script>
|
||||
<script>
|
||||
<script type="text/javascript" src="./html/gethost.js">
|
||||
// Achtung dieses Script wird mit /fileserver aufgerufen, daher muss hier /html/gethost.js verwendet werden!
|
||||
</script>
|
||||
<script language="JavaScript">
|
||||
function setpath() {
|
||||
var fileserverpraefix = "/fileserver";
|
||||
var anz_zeichen_fileserver = fileserverpraefix.length;
|
||||
@@ -54,37 +56,6 @@ function dirup() {
|
||||
window.location.href = res;
|
||||
}
|
||||
|
||||
function deleteall(){
|
||||
var str = window.location.href;
|
||||
// str = str.substring(0, str.length-1);
|
||||
// str = str.substring(10, str.length);
|
||||
str = str.replace("/fileserver/", "/delete/");
|
||||
str = str + "?task=deldircontent";
|
||||
if (confirm("This will delete ALL files in this directory!!!\n\nAre you sure?")) {
|
||||
alert(str);
|
||||
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (xhttp.readyState == 4) {
|
||||
if (xhttp.status == 200) {
|
||||
// document.open();
|
||||
// document.write(xhttp.responseText);
|
||||
// document.close();
|
||||
UpdatePage();
|
||||
} else if (xhttp.status == 0) {
|
||||
alert("Server closed the connection abruptly!");
|
||||
UpdatePage();
|
||||
} else {
|
||||
// alert(xhttp.status + " Error!\n" + xhttp.responseText);
|
||||
UpdatePage();
|
||||
}
|
||||
}
|
||||
};
|
||||
xhttp.open("POST", str, true);
|
||||
xhttp.send();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function upload() {
|
||||
var filePath = document.getElementById("filepath").value;
|
||||
@@ -121,10 +92,10 @@ function upload() {
|
||||
document.close();
|
||||
} else if (xhttp.status == 0) {
|
||||
alert("Server closed the connection abruptly!");
|
||||
UpdatePage();
|
||||
UpdatePage(false);
|
||||
} else {
|
||||
alert(xhttp.status + " Error!\n" + xhttp.responseText);
|
||||
UpdatePage();
|
||||
UpdatePage(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,97 +1,107 @@
|
||||
<html><head>
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type="text/css" media="screen">
|
||||
nav > ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
nav li {
|
||||
margin: 0.5em;
|
||||
padding: 0;
|
||||
font-size: 1.5em;
|
||||
flex: 1 1 0%;
|
||||
}
|
||||
|
||||
@media (min-width: 45em) {
|
||||
nav > ul {
|
||||
flex-direction: row;
|
||||
}
|
||||
nav li {
|
||||
flex: 1;
|
||||
font-size: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
nav a {
|
||||
display: block;
|
||||
padding: 0.4em;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
border: 1px solid darkblue;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 10px white inset;
|
||||
color: gold;
|
||||
background-color: darkblue;
|
||||
transition: all .25s ease-in;
|
||||
}
|
||||
|
||||
nav li[aria-current] a {
|
||||
background-color: firebrick;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
nav a:focus,
|
||||
nav a:hover,
|
||||
nav li[aria-current] a:focus,
|
||||
nav li[aria-current] a:hover {
|
||||
color: darkblue;
|
||||
background-color: gold;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Overview</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
html, body {
|
||||
height:100%;
|
||||
width:100%;
|
||||
margin:0;
|
||||
}
|
||||
.h_iframe iframe {
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
.h_iframe {
|
||||
height: 100%;
|
||||
width:100%;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
<style>
|
||||
.tg {border-collapse:collapse;border-spacing:0;width:100%;color: darkslategray;border: inset;height:585px;}
|
||||
.tg td{font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
|
||||
.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>
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table style="width:100%">
|
||||
<script src="/jquery-3.5.1.min.js"></script>
|
||||
|
||||
<script>
|
||||
function addZero(i) {
|
||||
if (i < 10) {
|
||||
i = "0" + i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
$ (document).ready(function() {
|
||||
var d = new Date();
|
||||
var h = addZero(d.getHours());
|
||||
var m = addZero(d.getMinutes());
|
||||
var s = addZero(d.getSeconds());
|
||||
|
||||
$('#img').html('<img src="/img_tmp/alg_roi.jpg" 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();
|
||||
});
|
||||
|
||||
function refresh() {
|
||||
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>
|
||||
|
||||
<body style="font-family: arial">
|
||||
|
||||
<table class="tg">
|
||||
<tr>
|
||||
<td> <img src="/img_tmp/alg_roi.jpg" alt="ROI-Image"> </td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
Raw Value:<p>
|
||||
<iframe name="maincontent1" id ="maincontent1" src="/wasserzaehler.html?rawvalue=true" title="fileserver" allowfullscreen></iframe>
|
||||
</tr>
|
||||
<tr>
|
||||
Corrected Value:<p>
|
||||
<iframe name="maincontent2" id ="maincontent2" src="/wasserzaehler.html" title="fileserver" allowfullscreen></iframe>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="tg-1" rowspan="9"><div id="img"></div></td>
|
||||
<th class="th">Raw Value:</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-2">
|
||||
<div id="raw"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="th">Corrected Value:</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-2">
|
||||
<div id="corrected"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="th">Checked Value:</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-2">
|
||||
<div id="checked"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="th">Start Time:</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-2">
|
||||
<div id="start"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-3">
|
||||
<div id="timestamp"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body></html>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,2 +1,4 @@
|
||||
ssid = SSID
|
||||
password = PASSWORD
|
||||
ssid = "SSID"
|
||||
password = "PASSWORD"
|
||||
hostname = "watermeter"
|
||||
;hostname is optional
|
||||