Fix various warnings which become fatal with later gcc versons in esp-idf 5.x (#1268)

- we cannot use partial initialisation of structs in C++ files (copied from example C files initially it seems)
- IRAM_ATTR uses a COUNTER, do not use the attribute on the implementation
- provide missing copy implementations for Rgb and Hsv
- one no longer can |= on volatile variables; use = | instead
- fix project and header includes
- avoid redefining BLINK_GPIO
- Remove defined but unused variables
- Fix printf formats
- Add missing case statement (HTTP_EVENT_REDIRECT)
- RMT needs to be updated to new interface (CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is on currently; see https://docs.espressif.com/projects/esp-idf/en/release-v5.0/esp32/api-reference/peripherals/rmt.html)
- Adjust tcpip_adpater_* to esp_netif_*
- Use buffered versions of *ntoa* functions for IPv4 addresses and not a static on the stack (also fixes warnings)
- Whatever I missed

Co-authored-by: Bjoern A. Zeeb <patch@zabbadoz.net>
This commit is contained in:
bzfbd
2022-11-04 19:06:46 +00:00
committed by GitHub
parent 4ffde22bc6
commit 235861eaea
25 changed files with 194 additions and 92 deletions

View File

@@ -12,6 +12,7 @@
#include "version.h"
#include "esp_wifi.h"
#include "lwip/inet.h"
#include "server_tflite.h"
#include "esp_log.h"
@@ -359,12 +360,25 @@ 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
tcpip_adapter_ip_info_t ip_info;
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
char ipstr[INET_ADDRSTRLEN];
const char *hostname;
ESP_ERROR_CHECK(tcpip_adapter_get_hostname(TCPIP_ADAPTER_IF_STA, &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";
}
zw = "[\
{\
@@ -376,7 +390,7 @@ esp_err_t sysinfo_handler(httpd_req_t *req)
\"html\" : \"" + htmlversion + "\",\
\"cputemp\" : \"" + cputemp + "\",\
\"hostname\" : \"" + hostname + "\",\
\"IPv4\" : \"" + ip4addr_ntoa(&ip_info.ip) + "\",\
\"IPv4\" : \"" + ipstr + "\",\
\"freeHeapMem\" : \"" + freeheapmem + "\"\
}\
]";