diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..7911e3f4 Binary files /dev/null and b/.DS_Store differ diff --git a/code/.DS_Store b/code/.DS_Store new file mode 100644 index 00000000..017ffc68 Binary files /dev/null and b/code/.DS_Store differ diff --git a/code/src/server_main.cpp b/code/src/server_main.cpp index bfe085ef..987dad1d 100644 --- a/code/src/server_main.cpp +++ b/code/src/server_main.cpp @@ -9,6 +9,8 @@ #include "version.h" +#include "esp_wifi.h" + httpd_handle_t server = NULL; @@ -163,8 +165,6 @@ esp_err_t hello_main_handler(httpd_req_t *req) return ESP_OK; } - - esp_err_t img_tmp_handler(httpd_req_t *req) { char filepath[50]; @@ -205,7 +205,47 @@ esp_err_t img_tmp_handler(httpd_req_t *req) return ESP_OK; } +esp_err_t sysinfo_handler(httpd_req_t *req) +{ + const char* resp_str; + std::string zw; + std::string cputemp = std::to_string(temperatureRead()); + std::string gitversion = libfive_git_version(); + std::string buildtime = build_time(); + std::string gitbranch = libfive_git_branch(); + std::string gitbasebranch = git_base_branch(); + std::string htmlversion = getHTMLversion(); + tcpip_adapter_ip_info_t ip_info; + ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info)); + ip6_addr_t if_ip6; + ESP_ERROR_CHECK(tcpip_adapter_get_ip6_global(TCPIP_ADAPTER_IF_STA, &if_ip6)); + const char *hostname; + ESP_ERROR_CHECK(tcpip_adapter_get_hostname(TCPIP_ADAPTER_IF_STA, &hostname)); + + zw = "[\ + {\ + \"firmware\" : \"" + gitversion + "\",\ + \"buildtime\" : \"" + buildtime + "\",\ + \"gitbranch\" : \"" + gitbranch + "\",\ + \"gitbasebranch\" : \"" + gitbasebranch + "\",\ + \"html\" : \"" + htmlversion + "\",\ + \"cputemp\" : \"" + cputemp + "\",\ + \"hostname\" : \"" + hostname + "\",\ + \"IPv4\" : \"" + ip4addr_ntoa(&ip_info.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 register_server_main_uri(httpd_handle_t server, const char *base_path) { @@ -217,6 +257,13 @@ void register_server_main_uri(httpd_handle_t server, const char *base_path) }; httpd_register_uri_handler(server, &info_get_handle); + httpd_uri_t sysinfo_handle = { + .uri = "/sysinfo", // Match all URIs of type /path/to/file + .method = HTTP_GET, + .handler = sysinfo_handler, + .user_ctx = (void*) base_path // Pass server data as context + }; + httpd_register_uri_handler(server, &sysinfo_handle); httpd_uri_t starttime_tmp_handle = { .uri = "/starttime", // Match all URIs of type /path/to/file @@ -243,6 +290,7 @@ void register_server_main_uri(httpd_handle_t server, const char *base_path) .user_ctx = (void*) base_path // Pass server data as context }; httpd_register_uri_handler(server, &main_rest_handle); + } diff --git a/code/src/server_tflite.cpp b/code/src/server_tflite.cpp index 5af665fd..77c99aaf 100644 --- a/code/src/server_tflite.cpp +++ b/code/src/server_tflite.cpp @@ -18,8 +18,6 @@ #include "ClassLogFile.h" -#include "version.h" - ClassFlowControll tfliteflow; TaskHandle_t xHandleblink_task_doFlow = NULL; @@ -412,44 +410,6 @@ esp_err_t handler_prevalue(httpd_req_t *req) return ESP_OK; }; - -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()); - string gitversion = libfive_git_version(); - string buildtime = build_time(); - string gitbranch = libfive_git_branch(); - string gitbasebranch = git_base_branch(); - string htmlversion = getHTMLversion(); - - zw = "[\ - {\ - \"firmware\" : \"" + gitversion + "\",\ - \"buildtime\" : \"" + buildtime + "\",\ - \"gitbranch\" : \"" + gitbranch + "\",\ - \"gitbasebranch\" : \"" + gitbasebranch + "\",\ - \"html\" : \"" + htmlversion + "\",\ - \"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; @@ -528,9 +488,5 @@ void register_server_tflite_uri(httpd_handle_t server) camuri.handler = handler_wasserzaehler; camuri.user_ctx = (void*) "Wasserzaehler"; httpd_register_uri_handler(server, &camuri); - - camuri.uri = "/sysinfo"; - camuri.handler = handler_sysinfo; - camuri.user_ctx = (void*) "Sysinfo"; - httpd_register_uri_handler(server, &camuri); + } diff --git a/code/src/version.cpp b/code/src/version.cpp index b14ca2b6..4682ac42 100644 --- a/code/src/version.cpp +++ b/code/src/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="9080f1d+"; +const char* GIT_REV="964486a+"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling"; -const char* BUILD_TIME="2020-09-28 23:50"; \ No newline at end of file +const char* BUILD_TIME="2020-09-29 01:57"; \ No newline at end of file diff --git a/code/src/version.h b/code/src/version.h index d58f9ecc..9b1bdf5a 100644 --- a/code/src/version.h +++ b/code/src/version.h @@ -9,6 +9,9 @@ extern "C" } #include +#include +#include "Helper.h" +#include const char* GIT_BASE_BRANCH = "master - v2.1.1 - 2020-09-28"; diff --git a/code/version.cpp b/code/version.cpp index b14ca2b6..4682ac42 100644 --- a/code/version.cpp +++ b/code/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="9080f1d+"; +const char* GIT_REV="964486a+"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling"; -const char* BUILD_TIME="2020-09-28 23:50"; \ No newline at end of file +const char* BUILD_TIME="2020-09-29 01:57"; \ No newline at end of file diff --git a/firmware/.DS_Store b/firmware/.DS_Store new file mode 100644 index 00000000..9ace466e Binary files /dev/null and b/firmware/.DS_Store differ diff --git a/firmware/html.zip b/firmware/html.zip index a65b4900..97217dcd 100644 Binary files a/firmware/html.zip and b/firmware/html.zip differ diff --git a/sd-card/.DS_Store b/sd-card/.DS_Store new file mode 100644 index 00000000..bb702244 Binary files /dev/null and b/sd-card/.DS_Store differ diff --git a/sd-card/html/.DS_Store b/sd-card/html/.DS_Store new file mode 100644 index 00000000..3b3240ee Binary files /dev/null and b/sd-card/html/.DS_Store differ