Revert "Revert "System instable""

This reverts commit 1d9ef7e634.
This commit is contained in:
jomjol
2022-11-04 21:59:22 +01:00
parent 1d9ef7e634
commit 7e26744e2e
31 changed files with 126 additions and 1808 deletions

View File

@@ -12,7 +12,6 @@
#include "version.h"
#include "esp_wifi.h"
#include "lwip/inet.h"
#include "server_tflite.h"
#include "esp_log.h"
@@ -360,25 +359,12 @@ esp_err_t sysinfo_handler(httpd_req_t *req)
std::string gitrevision = libfive_git_revision();
std::string htmlversion = getHTMLversion();
char freeheapmem[11];
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
sprintf(freeheapmem, "%lu", esp_get_free_heap_size());
#else
sprintf(freeheapmem, "%zu", esp_get_free_heap_size());
#endif
char ipstr[INET_ADDRSTRLEN];
tcpip_adapter_ip_info_t ip_info;
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
const char *hostname;
esp_netif_t *esp_netif = esp_netif_get_handle_from_ifkey("WIFI_STA_DEF");
if (esp_netif != NULL) {
esp_netif_ip_info_t ip_info;
ESP_ERROR_CHECK(esp_netif_get_ip_info(esp_netif, &ip_info));
esp_ip4addr_ntoa(&ip_info.ip, ipstr, INET_ADDRSTRLEN);
ESP_ERROR_CHECK(esp_netif_get_hostname(esp_netif, &hostname));
} else {
ipstr[0] = '\0';
hostname = "n/a";
}
ESP_ERROR_CHECK(tcpip_adapter_get_hostname(TCPIP_ADAPTER_IF_STA, &hostname));
zw = "[\
{\
@@ -390,7 +376,7 @@ esp_err_t sysinfo_handler(httpd_req_t *req)
\"html\" : \"" + htmlversion + "\",\
\"cputemp\" : \"" + cputemp + "\",\
\"hostname\" : \"" + hostname + "\",\
\"IPv4\" : \"" + ipstr + "\",\
\"IPv4\" : \"" + ip4addr_ntoa(&ip_info.ip) + "\",\
\"freeHeapMem\" : \"" + freeheapmem + "\"\
}\
]";