0

After updating ESP32 to core version 2.0.4 (file in Arduino IDE preferences was replaced tohttps://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json to upgrade), I get the following error:

/Users/guydvir/Dropbox/Arduino/libraries/LittleFS_esp32/src/LITTLEFS.cpp: In member function 'virtual bool LITTLEFSImpl::exists(const char*)':
/Users/guydvir/Dropbox/Arduino/libraries/LittleFS_esp32/src/LITTLEFS.cpp:44:28: error: no matching function for call to 'LITTLEFSImpl::open(const char*&, const char [2])'
     File f = open(path, "r");
                            ^
In file included from /Users/guydvir/Dropbox/Arduino/libraries/LittleFS_esp32/src/LITTLEFS.cpp:17:
/Users/guydvir/Library/Arduino15/packages/esp32/hardware/esp32/2.0.4/libraries/FS/src/vfs_api.h:38:17: note: candidate: 'virtual fs::FileImplPtr VFSImpl::open(const char*, const char*, bool)'
     FileImplPtr open(const char* path, const char* mode, const bool create) override;
                 ^~~~

I minimized code to headers only ( and empty setup and loop:

#include "FS.h" //#include "LITTLEFS.h" // <----- commenting out stops the error message #include <time.h> #include <WiFi.h>

What may be the error and how to fix it ?

guyd
  • 898
  • 1
  • 13
  • 39

2 Answers2

2

As you experienced, the Lorol's LittleFS_esp32 library was merged into ESP32 core from v1.0.6 and creates compile error to some old codes.

The difference is you have to use #include <LittleFS.h> instead of #include <LITTLEFS.h> for new cores (v1.0.6, v2.0.0+)

Check and modify the following snippet (used widely in my ESP_WiFiManager library ) for your purpose

// Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h
//#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) )  //(ESP_ARDUINO_VERSION_MAJOR >= 2)
#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) )
  #if (_WIFIMGR_LOGLEVEL_ > 3)
    #warning Using ESP32 Core 1.0.6 or 2.0.0+
  #endif
  
  // The library has been merged into esp32 core from release 1.0.6
  #include <LittleFS.h>       // https://github.com/espressif/arduino-esp32/tree/master/libraries/LittleFS
  
  FS* filesystem =      &LittleFS;
  #define FileFS        LittleFS
  #define FS_Name       "LittleFS"
#else
  #if (_WIFIMGR_LOGLEVEL_ > 3)
    #warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
  #endif
  
  // The library has been merged into esp32 core from release 1.0.6
  #include <LITTLEFS.h>       // https://github.com/lorol/LITTLEFS
  
  FS* filesystem =      &LITTLEFS;
  #define FileFS        LITTLEFS
  #define FS_Name       "LittleFS"
#endif
khoih-prog
  • 431
  • 3
  • 6
0

As Juraj commented - no need for LittleFS_esp32 library, after upgrade to esp32 Arduino 2.0.4

Juraj
  • 17,050
  • 4
  • 27
  • 43
guyd
  • 898
  • 1
  • 13
  • 39