From 92d9735b1fb63c2b871ad193c287e51f0d5ebdc1 Mon Sep 17 00:00:00 2001 From: tobozo Date: Wed, 10 Jan 2024 18:45:21 +0100 Subject: [PATCH] fix for platformio lib_ldf_mode=deep+ --- src/ESP32-targz-lib.cpp | 2 +- src/ESP32-targz-lib.hpp | 27 +++++++-------------------- src/ESP32-targz.h | 19 +++++++++++++------ 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/ESP32-targz-lib.cpp b/src/ESP32-targz-lib.cpp index c1f2190..59548f2 100644 --- a/src/ESP32-targz-lib.cpp +++ b/src/ESP32-targz-lib.cpp @@ -2193,7 +2193,7 @@ bool TarGzUnpacker::tarGzStreamExpander( Stream *stream, fs::FS &destFS, const c -#if defined ESP32 +#if defined ESP32 && defined HAS_OTA_SUPPORT /** GzUpdateClass Class implementation **/ diff --git a/src/ESP32-targz-lib.hpp b/src/ESP32-targz-lib.hpp index 67c915a..c454aaf 100644 --- a/src/ESP32-targz-lib.hpp +++ b/src/ESP32-targz-lib.hpp @@ -37,27 +37,14 @@ \*/ +#pragma once + #ifndef _ESP_TGZ_H -#define _ESP_TGZ_H - -#include - -#if defined( ESP32 ) - #include - #define HAS_OTA_SUPPORT -#elif defined( ESP8266 ) - //#ifdef USE_LittleFS - // #define SPIFFS LittleFS - // #include - //#endif - #include - #define HAS_OTA_SUPPORT -#elif defined ARDUINO_ARCH_RP2040 - // TODO: RP2040 OTA implementation? -#else - #error Unsupported architecture + #define _ESP_TGZ_H #endif +#include // platformio retarded lib_ldf_mode needs this even though was already included by ESP32-targz.h + #define GZIP_DICT_SIZE 32768 #if defined ESP8266 @@ -304,7 +291,7 @@ struct TarGzUnpacker : public TarUnpacker, public GzUnpacker -#if defined ESP32 +#if defined ESP32 && defined HAS_OTA_SUPPORT // this class was inspired by https://github.com/vortigont/esp32-flashz @@ -390,4 +377,4 @@ struct TarGzUnpacker : public TarUnpacker, public GzUnpacker #include "helpers/path_tools.h" -#endif // #ifdef _ESP_TGZ_H +//#endif // #ifdef _ESP_TGZ_H diff --git a/src/ESP32-targz.h b/src/ESP32-targz.h index baed3ce..866fd36 100644 --- a/src/ESP32-targz.h +++ b/src/ESP32-targz.h @@ -1,11 +1,15 @@ +#pragma once + #ifndef _TGZ_FSFOOLS_ #define _TGZ_FSFOOLS_ - -// Figure out the fs::FS library to load for the **destination** filesystem - +#endif #if defined ESP32 + #include + #define HAS_OTA_SUPPORT + + // Figure out the chosen fs::FS library to load for the **destination** filesystem #if defined DEST_FS_USES_SPIFFS #include #define tarGzFS SPIFFS @@ -44,6 +48,9 @@ #elif defined ESP8266 + #include + #define HAS_OTA_SUPPORT + // ESP8266 has no SD_MMC or FFat.h library, so these are implicitely invalidated #undef DEST_FS_USES_SD_MMC // unsupported #undef DEST_FS_USES_FFAT // unsupported @@ -51,6 +58,8 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + // Figure out the chosen fs::FS library to load for the **destination** filesystem + #if defined DEST_FS_USES_SD #include #define tarGzFS SDFS @@ -101,6 +110,7 @@ #undef DEST_FS_USES_FFAT // unsupported #undef DEST_FS_USES_SPIFFS // unsupported + // Figure out the chosen fs::FS library to load for the **destination** filesystem #if defined DEST_FS_USES_SD #include #define tarGzFS SDFS @@ -173,7 +183,4 @@ __attribute__((unused)) static size_t targzTotalBytesFn() { #endif } - #include "ESP32-targz-lib.hpp" - -#endif