Skip to content

Commit

Permalink
fix for platformio lib_ldf_mode=deep+
Browse files Browse the repository at this point in the history
  • Loading branch information
tobozo committed Jan 10, 2024
1 parent 85fb553 commit 92d9735
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/ESP32-targz-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 **/

Expand Down
27 changes: 7 additions & 20 deletions src/ESP32-targz-lib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,14 @@
\*/

#pragma once

#ifndef _ESP_TGZ_H
#define _ESP_TGZ_H

#include <FS.h>

#if defined( ESP32 )
#include <Update.h>
#define HAS_OTA_SUPPORT
#elif defined( ESP8266 )
//#ifdef USE_LittleFS
// #define SPIFFS LittleFS
// #include <LittleFS.h>
//#endif
#include <Updater.h>
#define HAS_OTA_SUPPORT
#elif defined ARDUINO_ARCH_RP2040
// TODO: RP2040 OTA implementation?
#else
#error Unsupported architecture
#define _ESP_TGZ_H
#endif

#include <FS.h> // platformio retarded lib_ldf_mode needs this even though <FS.h> was already included by ESP32-targz.h

#define GZIP_DICT_SIZE 32768

#if defined ESP8266
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
19 changes: 13 additions & 6 deletions src/ESP32-targz.h
Original file line number Diff line number Diff line change
@@ -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 <Update.h>
#define HAS_OTA_SUPPORT
// Figure out the chosen fs::FS library to load for the **destination** filesystem
#if defined DEST_FS_USES_SPIFFS
#include <SPIFFS.h>
#define tarGzFS SPIFFS
Expand Down Expand Up @@ -44,13 +48,18 @@

#elif defined ESP8266

#include <Updater.h>
#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
// the fuck with spamming the console
#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 <SD.h>
#define tarGzFS SDFS
Expand Down Expand Up @@ -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 <SD.h>
#define tarGzFS SDFS
Expand Down Expand Up @@ -173,7 +183,4 @@ __attribute__((unused)) static size_t targzTotalBytesFn() {
#endif
}


#include "ESP32-targz-lib.hpp"

#endif

0 comments on commit 92d9735

Please sign in to comment.