mobizt / Firebase-ESP-Client

[DEPRECATED]🔥Firebase Arduino Client Library for ESP8266, ESP32 and RP2040 Pico. The complete, fast, secured and reliable Firebase Arduino client library that supports RTDB, Cloud Firestore, Firebase and Google Cloud Storage, Cloud Messaging and Cloud Functions for Firebase.
MIT License
471 stars 100 forks source link

not compiling Multiple libraries were found for "LittleFS.h" #546

Closed demoking23 closed 1 year ago

demoking23 commented 1 year ago

Arduino: 1.8.19 (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Multiple libraries were found for "SDFS.h"

In file included from C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src/wcs/esp8266/FB_TCP_Client.h:62,

Used: C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\SDFS

Not used: C:\Users\ERSHITHVARAN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS

             from C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src/common.h:45,

Multiple libraries were found for "SdFat.h"

Used: C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\SdFat_-_Adafruit_Fork

             from C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src/Utils.h:37,

Not used: C:\Users\ERSHITHVARAN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266SdFat

Multiple libraries were found for "LittleFS.h"

Used: C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\LittleFS

             from C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src/signer/Signer.h:37,

Not used: C:\Users\ERSHITHVARAN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\LittleFS

Multiple libraries were found for "ESP8266WiFi.h"

Used: C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\ESP8266WiFi

Not used: C:\Users\ERSHITHVARAN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi

             from C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src/Firebase_ESP_Client.h:41,

Multiple libraries were found for "SPI.h"

Used: C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\SPI

             from C:\Users\ERSHIT~1\AppData\Local\Temp\arduino_modified_sketch_336116\sketch_aug23b.ino:18:

Not used: C:\Users\ERSHITHVARAN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SPI

C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\LittleFS\src/LittleFS.h:38:10: fatal error: ../lib/littlefs/lfs.h: No such file or directory

Multiple libraries were found for "SD.h"

38 | #include "../lib/littlefs/lfs.h"

Used: C:\Users\ERSHITHVARAN\Documents\Arduino\libraries\SD

  |          ^~~~~~~~~~~~~~~~~~~~~~~

Not used: C:\Program Files (x86)\Arduino\libraries\SD

compilation terminated.

Not used: C:\Users\ERSHITHVARAN\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SD

exit status 1

Error compiling for board NodeMCU 0.9 (ESP-12 Module).

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. coding /* Rui Santos Complete project details at our blog.

include

if defined(ESP32)

include

elif defined(ESP8266)

include

endif

include

// Provide the token generation process info.

include "addons/TokenHelper.h"

// Provide the RTDB payload printing info and other helper functions.

include "addons/RTDBHelper.h"

// Insert your network credentials

define WIFI_SSID "REPLACE_WITH_YOUR_SSID"

define WIFI_PASSWORD "REPLACE_WITH_YOUR_PASSWORD"

// Insert Firebase project API Key

define API_KEY "REPLACE_WITH_YOUR_PROJECT_API_KEY"

// Insert Authorized Username and Corresponding Password

define USER_EMAIL "REPLACE_WITH_THE_USER_EMAIL"

define USER_PASSWORD "REPLACE_WITH_THE_USER_PASSWORD"

// Insert RTDB URLefine the RTDB URL

define DATABASE_URL "REPLACE_WITH_YOUR_DATABASE_URL"

// Define Firebase objects FirebaseData stream; FirebaseAuth auth; FirebaseConfig config;

// Variables to save database paths String listenerPath = "board1/outputs/digital/";

// Declare outputs const int output1 = 12; const int output2 = 13; const int output3 = 14;

// Initialize WiFi void initWiFi() { WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.print("Connecting to WiFi .."); while (WiFi.status() != WL_CONNECTED) { Serial.print('.'); delay(1000); } Serial.println(WiFi.localIP()); Serial.println(); }

// Callback function that runs on database changes void streamCallback(FirebaseStream data){ Serial.printf("stream path, %s\nevent path, %s\ndata type, %s\nevent type, %s\n\n", data.streamPath().c_str(), data.dataPath().c_str(), data.dataType().c_str(), data.eventType().c_str()); printResult(data); //see addons/RTDBHelper.h Serial.println();

// Get the path that triggered the function String streamPath = String(data.dataPath());

// if the data returned is an integer, there was a change on the GPIO state on the following path /{gpio_number} if (data.dataTypeEnum() == fb_esp_rtdb_data_type_integer){ String gpio = streamPath.substring(1); int state = data.intData(); Serial.print("GPIO: "); Serial.println(gpio); Serial.print("STATE: "); Serial.println(state); digitalWrite(gpio.toInt(), state); }

/ When it first runs, it is triggered on the root (/) path and returns a JSON with all keys and values of that path. So, we can get all values from the database and updated the GPIO states/ if (data.dataTypeEnum() == fb_esp_rtdb_data_type_json){ FirebaseJson json = data.to();

// To iterate all values in Json object
size_t count = json.iteratorBegin();
Serial.println("\n---------");
for (size_t i = 0; i < count; i++){
    FirebaseJson::IteratorValue value = json.valueAt(i);
    int gpio = value.key.toInt();
    int state = value.value.toInt();
    Serial.print("STATE: ");
    Serial.println(state);
    Serial.print("GPIO:");
    Serial.println(gpio);
    digitalWrite(gpio, state);
    Serial.printf("Name: %s, Value: %s, Type: %s\n", value.key.c_str(), value.value.c_str(), value.type == FirebaseJson::JSON_OBJECT ? "object" : "array");
}
Serial.println();
json.iteratorEnd(); // required for free the used memory in iteration (node data collection)

}

//This is the size of stream payload received (current and max value) //Max payload size is the payload size under the stream path since the stream connected //and read once and will not update until stream reconnection takes place. //This max value will be zero as no payload received in case of ESP8266 which //BearSSL reserved Rx buffer size is less than the actual stream payload. Serial.printf("Received stream payload size: %d (Max. %d)\n\n", data.payloadLength(), data.maxPayloadLength()); }

void streamTimeoutCallback(bool timeout){ if (timeout) Serial.println("stream timeout, resuming...\n"); if (!stream.httpConnected()) Serial.printf("error code: %d, reason: %s\n\n", stream.httpCode(), stream.errorReason().c_str()); }

void setup(){ Serial.begin(115200); initWiFi();

// Initialize Outputs pinMode(output1, OUTPUT); pinMode(output2, OUTPUT); pinMode(output3, OUTPUT);

// Assign the api key (required) config.api_key = API_KEY;

// Assign the user sign in credentials auth.user.email = USER_EMAIL; auth.user.password = USER_PASSWORD;

// Assign the RTDB URL (required) config.database_url = DATABASE_URL;

Firebase.reconnectWiFi(true);

// Assign the callback function for the long running token generation task */ config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h

// Assign the maximum retry of token generation config.max_token_generation_retry = 5;

// Initialize the library with the Firebase authen and config Firebase.begin(&config, &auth);

// Streaming (whenever data changes on a path) // Begin stream on a database path --> board1/outputs/digital if (!Firebase.RTDB.beginStream(&stream, listenerPath.c_str())) Serial.printf("stream begin error, %s\n\n", stream.errorReason().c_str());

// Assign a calback function to run when it detects changes on the database Firebase.RTDB.setStreamCallback(&stream, streamCallback, streamTimeoutCallback);

delay(2000); }

void loop(){ if (Firebase.isTokenExpired()){ Firebase.refreshToken(&config); Serial.println("Refresh token"); } }

mobizt commented 1 year ago

SdFat conflicts in ESP8266 and must be removed

The SdFat or fork version is already implemented as wrapper class in ESP8266 core library.

For Arduino IDE, the SdFat library should be removed from libraries folder when you compile this library for ESP8266 because of conclicts with core library SDFS.h.