Skip to content

Commit

Permalink
full rewrite of TarPacker & TarGzPacker
Browse files Browse the repository at this point in the history
  • Loading branch information
tobozo committed Jan 28, 2025
1 parent 5d0dd5a commit 8feb5bc
Show file tree
Hide file tree
Showing 10 changed files with 489 additions and 879 deletions.
4 changes: 2 additions & 2 deletions src/ESP32-targz-lib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@

#elif defined ARDUINO_ARCH_RP2040

#pragma message "Experimental RP2040 support"
#pragma message "Experimental RP2040 support, compression is disabled"

#undef DEST_FS_USES_SD_MMC // unsupported
#undef DEST_FS_USES_FFAT // unsupported
Expand All @@ -156,7 +156,7 @@
#define FS_NAME "LITTLEFS (picolib)"
#endif

static FSInfo fsinfo;
[[maybe_unused]] static FSInfo fsinfo;

#else

Expand Down
9 changes: 7 additions & 2 deletions src/ESP32-targz-log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#pragma once

inline void NullLoggerCallback( [[maybe_unused]] const char* format, ...) { yield(); }
inline void NullLoggerCallback( [[maybe_unused]] const char* format, ...) { }

#if defined ESP8266 || defined ESP32
// those have OTA and common device API
Expand Down Expand Up @@ -86,6 +86,9 @@ inline void NullLoggerCallback( [[maybe_unused]] const char* format, ...) { yiel
#define DEVICE_RESTART() rp2040.restart()
#define HEAP_AVAILABLE() rp2040.getFreeHeap()

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat"

// ESP like log functions turned to macros to allow gathering of file name, log level, etc
#define log_v(format, ...) TGZ::LOG(__FILE__, __LINE__, TGZ::LogLevelVerbose, format, ##__VA_ARGS__)
#define log_d(format, ...) TGZ::LOG(__FILE__, __LINE__, TGZ::LogLevelDebug, format, ##__VA_ARGS__)
Expand Down Expand Up @@ -119,7 +122,8 @@ inline void NullLoggerCallback( [[maybe_unused]] const char* format, ...) { yiel
#endif

#if !defined TGZ_DEFAULT_LOG_LEVEL
#define TGZ_DEFAULT_LOG_LEVEL LogLevelWarning
//#define TGZ_DEFAULT_LOG_LEVEL LogLevelWarning
#define TGZ_DEFAULT_LOG_LEVEL LogLevelDebug
#endif

namespace TGZ
Expand Down Expand Up @@ -189,6 +193,7 @@ inline void NullLoggerCallback( [[maybe_unused]] const char* format, ...) { yiel
vsnprintf(log_buffer, LOG_MAXLENGTH, fmr, arg);
va_end(arg);
if( log_buffer[0] != '\0' ) {
printf("log_level %d", loglevel);
switch( loglevel ) {
case LogLevelVerbose: LOG_PRINTF("[V][%d][%s:%d] %s\r\n", HEAP_AVAILABLE(), TGZ_PATHNAME(path), line, log_buffer); break;
case LogLevelDebug: LOG_PRINTF("[D][%d][%s:%d] %s\r\n", HEAP_AVAILABLE(), TGZ_PATHNAME(path), line, log_buffer); break;
Expand Down
Loading

0 comments on commit 8feb5bc

Please sign in to comment.