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

@@ -46,9 +46,6 @@ extern const char* BUILD_TIME;
#include "server_GPIO.h"
#ifdef BLINK_GPIO
#undef BLINK_GPIO
#endif
#define BLINK_GPIO GPIO_NUM_33
static const char *TAGMAIN = "main";
@@ -91,10 +88,11 @@ bool Init_NVS_SDCard()
// Options for mounting the filesystem.
// If format_if_mount_failed is set to true, SD card will be partitioned and
// formatted in case when mounting fails.
esp_vfs_fat_sdmmc_mount_config_t mount_config;
mount_config.format_if_mount_failed = false;
mount_config.max_files = 7; // anstatt 5 (2022-09-21)
mount_config.allocation_unit_size = 16 * 1024;
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = false,
.max_files = 7, // anstatt 5 (2022-09-21)
.allocation_unit_size = 16 * 1024
};
// Use settings defined above to initialize SD card and mount FAT filesystem.
// Note: esp_vfs_fat_sdmmc_mount is an all-in-one convenience function.
@@ -197,7 +195,7 @@ extern "C" void app_main(void)
ESP_LOGD(TAGMAIN, "No SSID and PASSWORD set!!!");
if (hostname != NULL)
ESP_LOGD(TAGMAIN, "Hostname: %s", hostname);
ESP_LOGD(TAGMAIN, "Hostename: %s", hostname);
else
ESP_LOGD(TAGMAIN, "Hostname not set");

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 + "\"\
}\
]";

View File

@@ -9,6 +9,7 @@
#include <sys/param.h>
#include "nvs_flash.h"
#include "esp_netif.h"
#include "esp_eth.h"
#include "server_GPIO.h"
#include <esp_http_server.h>