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

@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "." "../../include"
REQUIRES tflite-lib esp_http_server app_update esp_http_client nvs_flash jomjol_tfliteclass jomjol_flowcontroll spiffs jomjol_helper jomjol_controlGPIO)
REQUIRES tflite-lib esp_http_server bootloader_support app_update esp_http_client vfs nvs_flash jomjol_tfliteclass jomjol_flowcontroll spiffs jomjol_helper jomjol_controlGPIO)

View File

@@ -3076,7 +3076,9 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#define MZ_DELETE_FILE remove
#else
#if 0
#pragma message("Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files.")
#endif
#ifndef MINIZ_NO_TIME
#include <utime.h>
#endif

View File

@@ -3,7 +3,6 @@
#include <string>
#include "string.h"
#include <esp_int_wdt.h>
#include <esp_task_wdt.h>
@@ -17,7 +16,9 @@
#include <esp_ota_ops.h>
#include "esp_http_client.h"
#include "esp_flash_partitions.h"
#include "esp_vfs.h"
#include "esp_partition.h"
#include "esp_app_format.h"
#include <nvs.h>
#include "nvs_flash.h"
#include "driver/gpio.h"
@@ -78,16 +79,28 @@ static bool ota_update_task(std::string fn)
const esp_partition_t *running = esp_ota_get_running_partition();
if (configured != running) {
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
ESP_LOGW(TAGPARTOTA, "Configured OTA boot partition at offset 0x%08lx, but running from offset 0x%08lx",
#else
ESP_LOGW(TAGPARTOTA, "Configured OTA boot partition at offset 0x%08x, but running from offset 0x%08x",
#endif
configured->address, running->address);
ESP_LOGW(TAGPARTOTA, "(This can happen if either the OTA boot data or preferred boot image become somehow corrupted.)");
}
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
ESP_LOGI(TAGPARTOTA, "Running partition type %d subtype %d (offset 0x%08lx)",
#else
ESP_LOGI(TAGPARTOTA, "Running partition type %d subtype %d (offset 0x%08x)",
#endif
running->type, running->subtype, running->address);
update_partition = esp_ota_get_next_update_partition(NULL);
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
ESP_LOGI(TAGPARTOTA, "Writing to partition subtype %d at offset 0x%lx",
#else
ESP_LOGI(TAGPARTOTA, "Writing to partition subtype %d at offset 0x%x",
#endif
update_partition->subtype, update_partition->address);
// assert(update_partition != NULL);
@@ -474,7 +487,17 @@ esp_err_t handler_ota_update(httpd_req_t *req)
};
void hard_restart() {
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
esp_task_wdt_config_t wd_config;
wd_config.timeout_ms = 1000;
wd_config.idle_core_mask = (1 << portNUM_PROCESSORS) - 1; // Bitmask of all cores
wd_config.trigger_panic = true;
esp_task_wdt_init(&wd_config);
#else
esp_task_wdt_init(1,true);
#endif
esp_task_wdt_add(NULL);
while(true);
}