Skip to content

Commit

Permalink
updated example with LittleFS
Browse files Browse the repository at this point in the history
  • Loading branch information
tobozo committed Sep 30, 2021
1 parent 9b8ae3c commit 2914f52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#endif

// Set **destination** filesystem by uncommenting one of these:
#define DEST_FS_USES_SPIFFS
//#define DEST_FS_USES_LITTLEFS
//#define DEST_FS_USES_SPIFFS
#define DEST_FS_USES_LITTLEFS
#include <ESP32-targz.h>
#include <WiFi.h>
#include <HTTPClient.h>
Expand Down Expand Up @@ -76,13 +76,16 @@ void stubbornConnect()
uint8_t wifi_retry_count = 0;
uint8_t max_retries = 10;
unsigned long stubbornness_factor = 3000; // ms to wait between attempts

Serial.print( "MAC Address: " );
Serial.println(WiFi.macAddress());

while (WiFi.status() != WL_CONNECTED && wifi_retry_count < max_retries) {
#if defined WIFI_SSID && defined WIFI_PASS
WiFi.begin( WIFI_SSID, WIFI_PASS ); // put your ssid / pass if required, only needed once
#else
WiFi.begin();
#endif
Serial.print(WiFi.macAddress());
Serial.printf(" => WiFi connect - Attempt No. %d\n", wifi_retry_count+1);
delay( stubbornness_factor );
wifi_retry_count++;
Expand Down
11 changes: 8 additions & 3 deletions examples/Test_tar_gz_tgz/Test_tar_gz_tgz.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@
#define sourceFS tarGzFS // assume source = destination unless stated otherwise in the test function

#if defined ESP32 && defined BOARD_HAS_PSRAM && defined DEST_FS_USES_PSRAMFS
#undef sourceFS

#include <LITTLEFS.h> // https://github.com/lorol/LITTLEFS
#if defined ESP_IDF_VERSION_MAJOR && ESP_IDF_VERSION_MAJOR >= 4
#include <LittleFS.h> // core 2.0.0 has built-in LittleFS
#define sourceFS LittleFS
#else
#include <LITTLEFS.h> // https://github.com/lorol/LITTLEFS
#define sourceFS LITTLEFS
#endif
#include <PSRamFS.h> // https://github.com/tobozo/ESP32-PsRamFS
#undef tarGzFS
#undef FS_NAME
#undef sourceFS

#define sourceFS LITTLEFS
#define SOURCE_FS_NAME "LittleFS"

#define tarGzFS PSRamFS
Expand Down

0 comments on commit 2914f52

Please sign in to comment.