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

The 'DISABLE_SD' Build-Flag does not work! #633

Closed toqix closed 7 months ago

toqix commented 7 months ago

Describe the bug When using the 'DISABLE_SD' build-flag in PlatformIO the library still imports its SD libraries and tries to create its own SD objects. This leads to compile errors when working with a custom SD implementation such as SDFat on ESP32.

To Reproduce Using PlatformIO install the library and use any basic example, use the 'ESP32 Dev Kit' board, include "-D DISABLE_SD" in the platformio.ini file and try to compile the sketch.

Expected behavior The build-flag should disable all SD implementations, thus no SD specific libraries or objects should be referenced or created.

Screenshots When running a quick search through the library source code, you find that the only time "DISABLE_SD" is referenced is in the following comment: Firebase Arduino Client Library for ESP8266 and ESP32/src/FirebaseFS.h:

  158   * ⛔ Use following build flags to disable.
  159:  * -D DISABLE_SD or -DDISABLE_SD in PlatformIO
  160   */

IDE and its version:

Board

Additional context I will create a pull-request that tries to implement the expected behaviour soon.

mobizt commented 7 months ago

That is the behavior of PlatformIO that will create all objects even that header was just included but the class will never be used.

You can compare the program size between disable and enable that option instead of just seeing compiling log.

mobizt commented 7 months ago

There is nothing to do in this case.

At least you can remove or comment these from FirebaseFS.h.

#include <SD.h>
#define DEFAULT_SD_FS SD
#define CARD_TYPE_SD 1

This will exclude FS.h which takes a lot of flash space, from library compilation.

toqix commented 7 months ago

Thank you for your help. I also now understand that part of the 'issue' lies within PlatformIO.