Skip to content

Version 1.0.6. no matching function for call to 'LITTLEFSImpl::open(const char*&, const char [2])' #69

Description

@VolodymyrBaisa

Hi All.
I got issue when I start using 1.0.6 version. No issue with 1.0.5 version.
Error message:

C:\Users\user\OneDrive\Documents\Arduino\libraries\LittleFS_esp32\src\LITTLEFS.cpp: In member function 'virtual bool LITTLEFSImpl::exists(const char*)':
C:\Users\user\OneDrive\Documents\Arduino\libraries\LittleFS_esp32\src\LITTLEFS.cpp:44:18: error: no matching function for call to 'LITTLEFSImpl::open(const char*&, const char [2])'
44 | File f = open(path, "r");
| ~~~~^~~~~~~~~~~
In file included from C:\Users\user\OneDrive\Documents\Arduino\libraries\LittleFS_esp32\src\LITTLEFS.cpp:17:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\FS\src/vfs_api.h:37:15: note: candidate: 'virtual fs::FileImplPtr VFSImpl::open(const char*, const char*, bool)'
37 | FileImplPtr open(const char *path, const char *mode, const bool create) override;
| ^~~~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\FS\src/vfs_api.h:37:15: note: candidate expects 3 arguments, 2 provided

exit status 1

Compilation error: exit status 1

My code:

#include "Stream.h"
#include "storage.h" 

Storage::Storage(){}

bool Storage::mount() {
  if (!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED)) {
        Serial.println("LITTLEFS Mount Failed");
        return false;
    }
    return true;
}

bool Storage::readWifiConfig(String &ssid, String &password) {
    File file = LITTLEFS.open(wifiConfigFile, FILE_READ, false);
    if (!file) {
        Serial.println("Failed to open WiFi config file");
        return false;
    }

    // Allocate a temporary JsonDocument
    StaticJsonDocument<256> doc;

    // Deserialize the JSON document
    DeserializationError error = deserializeJson(doc, file);
    if (error) {
        Serial.print(F("deserializeJson() failed: "));
        Serial.println(error.f_str());
        file.close();
        return false;
    }

    ssid = doc["ssid"].as<String>();
    password = doc["password"].as<String>();

    file.close();
    return true;
}

Please advice.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions