GithubHelp home page GithubHelp logo

Comments (4)

khoih-prog avatar khoih-prog commented on July 2, 2024

Thanks for identifying the misleading message in the examples. It happened because time spent in them were so small, and not considered so serious.

I have been aware of this minor issue and knew it's better to have something like the following code, such as in BlynkSimpleEsp32_WM.h#L1510-L1520 or BlynkSimpleEsp8266_WM.h#L1467-L1480

I won't let it slipping this time and will fix it in next release.

  1. For ESP32
     // Format SPIFFS if not yet
      if (!FileFS.begin(true))
      {
        Serial.println(F("SPIFFS/LittleFS failed! Already tried formatting."));
        
        if (!FileFS.begin())
        {
          Serial.println(F("SPIFFS/LittleFS failed! Pls use EEPROM."));
          return false;
        }
      }
  1. For ESP8266
      if (!FileFS.begin())
      {
        FileFS.format();
        
        if (!FileFS.begin())
        {
#if USE_LITTLEFS
          Serial.println(F("LittleFS failed!. Please use SPIFFS or EEPROM."));
#else
          Serial.println(F("SPIFFS failed!. Please use LittleFS or EEPROM."));
#endif 
          return false;
        }
      }
  1. Combined, to be in new release
  // Format FileFS if not yet
#ifdef ESP32
  if (!FileFS.begin(true))
#else
  if (!FileFS.begin())
#endif
  {
#ifdef ESP8266
    FileFS.format();
#endif

    Serial.println(F("SPIFFS/LittleFS failed! Already tried formatting."));
  
    if (!FileFS.begin())
    {     
#if USE_LITTLEFS
      Serial.println(F("LittleFS failed!. Please use SPIFFS or EEPROM. Stay forever"));
#else
      Serial.println(F("SPIFFS failed!. Please use LittleFS or EEPROM. Stay forever"));
#endif

      while (true)
      {
        delay(1);
      }
    }
  }

from espasync_wifimanager.

robcazzaro avatar robcazzaro commented on July 2, 2024

I know it's not really a meaningful contribution, but I'm glad to have been of help :)

Your new code looks great to me. I cannot thank you enough for contributing this library and the examples. It really helped me a lot, and I learned a lot just following the examples

Just keep in mind that, if using LittleFS at least, the debug messages from LittleFS will preempt your Serial.print() and the user won't see a debug message, just the code hanging. If you do something like the code below, on the other hand, the error message will be correctly displayed. Truly minor, but it took me a bit to figure out what was happening, and remembering that all ESP32 code is dual thread, unlike other Arduino platforms

  // Format FileFS if not yet
#ifdef ESP32
  if (!FileFS.begin(true))
#else
  if (!FileFS.begin())
#endif
  {
#ifdef ESP8266
    FileFS.format();
#endif

    Serial.println(F("SPIFFS/LittleFS failed! Already tried formatting."));
  
    if (!FileFS.begin())
    {     
       delay(100); // prevents debug info from the library to hide err message. The code stops anyway, so a delay is not an issue
#if USE_LITTLEFS
      Serial.println(F("LittleFS failed!. Please use SPIFFS or EEPROM. Stay forever"));
#else
      Serial.println(F("SPIFFS failed!. Please use LittleFS or EEPROM. Stay forever"));
#endif

      while (true)
      {
        delay(1);
      }
    }
  }

from espasync_wifimanager.

khoih-prog avatar khoih-prog commented on July 2, 2024

That's great. I'll certainly use it and have some note about your contribution.
Regards,

from espasync_wifimanager.

khoih-prog avatar khoih-prog commented on July 2, 2024

The new ESPAsync_WiFiManager Release v1.6.2 has been published, with a note to thank you at Contributions and Thanks


Releases v1.6.2

  1. Fix example misleading messages. Check Minor: examples/Async_ESP32_FSWebServer/ wrongly uses FileFS.begin(true) #47

from espasync_wifimanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.