mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 20:46:52 +03:00
v8.4.0
This commit is contained in:
@@ -111,6 +111,8 @@ esp_err_t set_content_type_from_file(httpd_req_t *req, const char *filename)
|
||||
return httpd_resp_set_type(req, "image/jpeg");
|
||||
} else if (IS_FILE_EXT(filename, ".ico")) {
|
||||
return httpd_resp_set_type(req, "image/x-icon");
|
||||
} else if (IS_FILE_EXT(filename, ".js")) {
|
||||
return httpd_resp_set_type(req, "text/javascript");
|
||||
}
|
||||
/* This is a limited set only */
|
||||
/* For any other type always set as plain text */
|
||||
|
||||
@@ -83,17 +83,20 @@ FILE* OpenFileAndWait(const char* nm, const char* _mode, int _waitsec)
|
||||
printf("open config file %s in mode %s\n", nm, _mode);
|
||||
FILE *pfile = fopen(nm, _mode);
|
||||
|
||||
/*
|
||||
if (pfile == NULL)
|
||||
{
|
||||
TickType_t xDelay;
|
||||
xDelay = _waitsec * 1000 / portTICK_PERIOD_MS;
|
||||
std::string zw = "File is locked: " + std::string(nm) + " - wait for " + std::to_string(_waitsec);
|
||||
std::string zw = "File is locked: " + std::string(nm) + " - wait for " + std::to_string(_waitsec) + " seconds";
|
||||
printf(zw.c_str());
|
||||
printf("\n");
|
||||
LogFile.WriteToFile(zw);
|
||||
vTaskDelay( xDelay );
|
||||
pfile = fopen(nm, _mode);
|
||||
}
|
||||
*/
|
||||
|
||||
return pfile;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,14 +50,14 @@ std::string std_hostname = "watermeter";
|
||||
std::string ipadress = "";
|
||||
std::string ssid = "";
|
||||
|
||||
std::string getIPAddress()
|
||||
std::string* getIPAddress()
|
||||
{
|
||||
return ipadress;
|
||||
return &ipadress;
|
||||
}
|
||||
|
||||
std::string getSSID()
|
||||
std::string* getSSID()
|
||||
{
|
||||
return ssid;
|
||||
return &ssid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ void wifi_init_sta(const char *_ssid, const char *_password, const char *_hostna
|
||||
void wifi_init_sta(const char *_ssid, const char *_password, const char *_hostname);
|
||||
void wifi_init_sta(const char *_ssid, const char *_password);
|
||||
|
||||
std::string getIPAddress();
|
||||
std::string getSSID();
|
||||
std::string* getIPAddress();
|
||||
std::string* getSSID();
|
||||
|
||||
extern std::string hostname;
|
||||
extern std::string std_hostname;
|
||||
|
||||
@@ -216,26 +216,5 @@ extern "C" void app_main(void)
|
||||
|
||||
printf("vor dotautostart\n");
|
||||
TFliteDoAutoStart();
|
||||
|
||||
////////////////////////// Test SmartLED Liberary //////////////////////////////////////////////
|
||||
/*
|
||||
xDelay = 5000 / portTICK_PERIOD_MS;
|
||||
printf("main: sleep for : %ldms\n", (long) xDelay);
|
||||
// LogFile.WriteToFile("Startsequence 06");
|
||||
vTaskDelay( xDelay );
|
||||
|
||||
SmartLed leds( LED_WS2812, 2, GPIO_NUM_12, 0, DoubleBuffer );
|
||||
|
||||
|
||||
leds[ 0 ] = Rgb{ 255, 0, 0 };
|
||||
leds[ 1 ] = Rgb{ 255, 255, 255 };
|
||||
leds.show();
|
||||
|
||||
vTaskDelay( xDelay );
|
||||
|
||||
leds[ 0 ] = Rgb{ 0, 0, 0 };
|
||||
leds[ 1 ] = Rgb{ 0, 0, 0 };
|
||||
leds.show();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,7 @@ esp_err_t info_get_handler(httpd_req_t *req)
|
||||
|
||||
if (_task.compare("GitBranch") == 0)
|
||||
{
|
||||
std::string zw;
|
||||
zw = std::string(libfive_git_branch());
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
httpd_resp_sendstr_chunk(req, libfive_git_branch());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -61,9 +59,7 @@ esp_err_t info_get_handler(httpd_req_t *req)
|
||||
|
||||
if (_task.compare("GitTag") == 0)
|
||||
{
|
||||
std::string zw;
|
||||
zw = std::string(libfive_git_version());
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
httpd_resp_sendstr_chunk(req, libfive_git_version());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -72,36 +68,30 @@ esp_err_t info_get_handler(httpd_req_t *req)
|
||||
|
||||
if (_task.compare("GitRevision") == 0)
|
||||
{
|
||||
std::string zw;
|
||||
zw = std::string(libfive_git_revision());
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
httpd_resp_sendstr_chunk(req, libfive_git_revision());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (_task.compare("BuildTime") == 0)
|
||||
{
|
||||
std::string zw;
|
||||
zw = std::string(build_time());
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
httpd_resp_sendstr_chunk(req, build_time());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (_task.compare("GitBaseBranch") == 0)
|
||||
{
|
||||
std::string zw;
|
||||
zw = std::string(git_base_branch());
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
httpd_resp_sendstr_chunk(req, git_base_branch());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (_task.compare("HTMLVersion") == 0)
|
||||
{
|
||||
std::string zw;
|
||||
zw = std::string(getHTMLversion());
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
// std::string zw;
|
||||
// zw = std::string(getHTMLversion());
|
||||
httpd_resp_sendstr_chunk(req, getHTMLversion());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -117,18 +107,18 @@ esp_err_t info_get_handler(httpd_req_t *req)
|
||||
|
||||
if (_task.compare("IP") == 0)
|
||||
{
|
||||
std::string zw;
|
||||
zw = std::string(getIPAddress());
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
std::string *zw;
|
||||
zw = getIPAddress();
|
||||
httpd_resp_sendstr_chunk(req, zw->c_str());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (_task.compare("SSID") == 0)
|
||||
{
|
||||
std::string zw;
|
||||
zw = std::string(getSSID());
|
||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||
std::string *zw;
|
||||
zw = getSSID();
|
||||
httpd_resp_sendstr_chunk(req, zw->c_str());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -142,28 +132,15 @@ esp_err_t info_get_handler(httpd_req_t *req)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_DETAIL_ON
|
||||
LogFile.WriteHeapInfo("info_get_handler - Done");
|
||||
#endif
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t starttime_get_handler(httpd_req_t *req)
|
||||
{
|
||||
#ifdef DEBUG_DETAIL_ON
|
||||
LogFile.WriteHeapInfo("starttime_get_handler - Start");
|
||||
#endif
|
||||
|
||||
httpd_resp_send(req, starttime.c_str(), strlen(starttime.c_str()));
|
||||
/* Respond with an empty chunk to signal HTTP response completion */
|
||||
httpd_resp_send_chunk(req, NULL, 0);
|
||||
|
||||
#ifdef DEBUG_DETAIL_ON
|
||||
LogFile.WriteHeapInfo("starttime_get_handler - Done");
|
||||
#endif
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -217,12 +194,15 @@ esp_err_t hello_main_handler(httpd_req_t *req)
|
||||
}
|
||||
|
||||
res = send_file(req, filetosend);
|
||||
/* Respond with an empty chunk to signal HTTP response completion */
|
||||
httpd_resp_send_chunk(req, NULL, 0);
|
||||
|
||||
if (res != ESP_OK)
|
||||
return res;
|
||||
|
||||
/* Respond with an empty chunk to signal HTTP response completion */
|
||||
// httpd_resp_sendstr(req, "");
|
||||
httpd_resp_send_chunk(req, NULL, 0);
|
||||
// httpd_resp_send_chunk(req, NULL, 0);
|
||||
|
||||
#ifdef DEBUG_DETAIL_ON
|
||||
LogFile.WriteHeapInfo("hello_main_handler - Stop");
|
||||
@@ -299,10 +279,6 @@ esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
|
||||
|
||||
esp_err_t sysinfo_handler(httpd_req_t *req)
|
||||
{
|
||||
#ifdef DEBUG_DETAIL_ON
|
||||
LogFile.WriteHeapInfo("sysinfo_handler - Start");
|
||||
#endif
|
||||
|
||||
const char* resp_str;
|
||||
std::string zw;
|
||||
std::string cputemp = std::to_string(temperatureRead());
|
||||
@@ -333,7 +309,6 @@ esp_err_t sysinfo_handler(httpd_req_t *req)
|
||||
}\
|
||||
]";
|
||||
|
||||
|
||||
resp_str = zw.c_str();
|
||||
|
||||
httpd_resp_set_type(req, "application/json");
|
||||
@@ -341,10 +316,6 @@ esp_err_t sysinfo_handler(httpd_req_t *req)
|
||||
/* Respond with an empty chunk to signal HTTP response completion */
|
||||
httpd_resp_send_chunk(req, NULL, 0);
|
||||
|
||||
#ifdef DEBUG_DETAIL_ON
|
||||
LogFile.WriteHeapInfo("sysinfo_handler - Done");
|
||||
#endif
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -401,7 +372,7 @@ httpd_handle_t start_webserver(void)
|
||||
httpd_handle_t server = NULL;
|
||||
httpd_config_t config = { };
|
||||
|
||||
config.task_priority = tskIDLE_PRIORITY+5;
|
||||
config.task_priority = tskIDLE_PRIORITY+1; // 20210924 --> vorher +5
|
||||
config.stack_size = 32768; //20210921 --> vorher 32768 // bei 32k stürzt das Programm beim Bilderaufnehmen ab
|
||||
config.core_id = tskNO_AFFINITY;
|
||||
config.server_port = 80;
|
||||
@@ -411,15 +382,14 @@ httpd_handle_t start_webserver(void)
|
||||
config.max_resp_headers = 8;
|
||||
config.backlog_conn = 5;
|
||||
config.lru_purge_enable = true; // dadurch werden alte Verbindungen gekappt, falls neue benögt werden.
|
||||
config.recv_wait_timeout = 30; // default: 5
|
||||
config.send_wait_timeout = 30; // default: 5
|
||||
config.recv_wait_timeout = 5; // default: 5 20210924 --> vorher 30
|
||||
config.send_wait_timeout = 5; // default: 5 20210924 --> vorher 30
|
||||
config.global_user_ctx = NULL;
|
||||
config.global_user_ctx_free_fn = NULL;
|
||||
config.global_transport_ctx = NULL;
|
||||
config.global_transport_ctx_free_fn = NULL;
|
||||
config.open_fn = NULL;
|
||||
config.close_fn = NULL;
|
||||
config.lru_purge_enable = true; // neu, um schlechte Serverbindung zu verhindern
|
||||
// config.uri_match_fn = NULL;
|
||||
config.uri_match_fn = httpd_uri_match_wildcard;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const char* GIT_REV="e2a4034";
|
||||
const char* GIT_REV="f15e5f0";
|
||||
const char* GIT_TAG="";
|
||||
const char* GIT_BRANCH="rolling";
|
||||
const char* BUILD_TIME="2021-09-23 18:31";
|
||||
const char* BUILD_TIME="2021-09-24 19:25";
|
||||
@@ -42,21 +42,19 @@ const char* libfive_git_branch(void)
|
||||
return GIT_BRANCH;
|
||||
}
|
||||
|
||||
std::string getHTMLversion(void){
|
||||
|
||||
string line = "";
|
||||
char _char_getHTMLversion[20]="NaN\0";
|
||||
|
||||
const char* getHTMLversion(void){
|
||||
FILE* pFile;
|
||||
string fn = FormatFileName("/sdcard/html/version.txt");
|
||||
pFile = fopen(fn.c_str(), "r");
|
||||
|
||||
if (pFile == NULL)
|
||||
return std::string("NAN");
|
||||
return _char_getHTMLversion;
|
||||
|
||||
char zw[1024];
|
||||
fgets(zw, 1024, pFile);
|
||||
line = std::string(trim(zw));
|
||||
fgets(_char_getHTMLversion, 20, pFile);
|
||||
fclose(pFile);
|
||||
|
||||
return line;
|
||||
return _char_getHTMLversion;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
const char* GIT_REV="e2a4034";
|
||||
const char* GIT_REV="f15e5f0";
|
||||
const char* GIT_TAG="";
|
||||
const char* GIT_BRANCH="rolling";
|
||||
const char* BUILD_TIME="2021-09-23 18:30";
|
||||
const char* BUILD_TIME="2021-09-24 19:25";
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>Make Alignment</title>
|
||||
<meta charset="utf-8"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<meta charset="utf-8"/>
|
||||
<title>Make Analog Alignment</title>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<meta charset="utf-8"/>
|
||||
<title>Check</title>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>Edit Config</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>Edit Config</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<meta charset="utf-8"/>
|
||||
<title>Make Digital Alignment</title>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>Make Reference</title>
|
||||
<meta charset="utf-8"/>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>OTA Update</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<html><head>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>Set PreValue</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>Reboot</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="width: fit-content">
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>jomjol - AI on the edge</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="icon" href="data:,">
|
||||
<title>Overview</title>
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user