anavi-thermometer-sw icon indicating copy to clipboard operation
anavi-thermometer-sw copied to clipboard

Migrate to LittleFS for ESP8266

Open andypiper opened this issue 3 years ago • 7 comments

Compiling against the current version of the libraries and Generic 8266 board support, results in these warnings:

Compiling sketch...
/Users/andypiper/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 -I /Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/signing.py --mode header --publickey /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/public.key --out /var/folders/3t/s2qs3f713zvgvt7kq31rkrxc0000gn/T/arduino_build_441567/core/Updater_Signing.h
/Users/andypiper/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/sdk/include -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/sdk/lwip2/include -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/sdk/libc/xtensa-lx106-elf/include -I/var/folders/3t/s2qs3f713zvgvt7kq31rkrxc0000gn/T/arduino_build_441567/core -c -Werror=return-type -Os -g -free -fipa-pta -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10813 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 "-DARDUINO_BOARD=\"ESP8266_GENERIC\"" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266 -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/variants/generic -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/ESP8266WiFi/src -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/ESP8266httpUpdate/src -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/ESP8266HTTPClient/src -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/DNSServer/src -I/Users/andypiper/Documents/Arduino/libraries/NTPClient -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/ESP8266WebServer/src -I/Users/andypiper/Documents/Arduino/libraries/WiFiManager -I/Users/andypiper/Documents/Arduino/libraries/ArduinoJson/src -I/Users/andypiper/Documents/Arduino/libraries/PubSubClient/src -I/Users/andypiper/Documents/Arduino/libraries/DHT_sensor_library -I/Users/andypiper/Documents/Arduino/libraries/U8g2/src -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire -I/Users/andypiper/Documents/Arduino/libraries/OneWire -I/Users/andypiper/Documents/Arduino/libraries/DallasTemperature -I/Users/andypiper/Documents/Arduino/libraries/Adafruit_HTU21DF_Library -I/Users/andypiper/Documents/Arduino/libraries/Adafruit_BusIO -I/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/libraries/SPI -I/Users/andypiper/Documents/Arduino/libraries/Adafruit_APDS9960_Library -I/Users/andypiper/Documents/Arduino/libraries/Adafruit_Unified_Sensor -I/Users/andypiper/Documents/Arduino/libraries/Adafruit_BMP085_Unified /var/folders/3t/s2qs3f713zvgvt7kq31rkrxc0000gn/T/arduino_build_441567/sketch/anavi-thermometer-sw.ino.cpp -o /var/folders/3t/s2qs3f713zvgvt7kq31rkrxc0000gn/T/arduino_build_441567/sketch/anavi-thermometer-sw.ino.cpp.o
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino: In function 'void load_calibration()':
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:887:10: warning: 'SPIFFS' is deprecated: SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
  887 |     if (!SPIFFS.exists("/calibration.json"))
      |          ^~~~~~
In file included from /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:2:
/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/FS.h:275:15: note: declared here
  275 | extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
      |               ^~~~~~
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:889:23: warning: 'SPIFFS' is deprecated: SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
  889 |     File configFile = SPIFFS.open("/calibration.json", "r");
      |                       ^~~~~~
In file included from /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:2:
/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/FS.h:275:15: note: declared here
  275 | extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
      |               ^~~~~~
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino: In function 'void save_calibration()':
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:923:23: warning: 'SPIFFS' is deprecated: SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
  923 |     File configFile = SPIFFS.open("/calibration.json", "w");
      |                       ^~~~~~
In file included from /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:2:
/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/FS.h:275:15: note: declared here
  275 | extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
      |               ^~~~~~
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino: In function 'void saveConfig()':
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:953:23: warning: 'SPIFFS' is deprecated: SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
  953 |     File configFile = SPIFFS.open("/config.json", "w");
      |                       ^~~~~~
In file included from /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:2:
/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/FS.h:275:15: note: declared here
  275 | extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
      |               ^~~~~~
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino: In function 'void setup()':
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:1117:9: warning: 'SPIFFS' is deprecated: SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
 1117 |     if (SPIFFS.begin())
      |         ^~~~~~
In file included from /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:2:
/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/FS.h:275:15: note: declared here
  275 | extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
      |               ^~~~~~
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:1120:13: warning: 'SPIFFS' is deprecated: SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
 1120 |         if (SPIFFS.exists("/config.json")) {
      |             ^~~~~~
In file included from /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:2:
/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/FS.h:275:15: note: declared here
  275 | extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
      |               ^~~~~~
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:1123:31: warning: 'SPIFFS' is deprecated: SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
 1123 |             File configFile = SPIFFS.open("/config.json", "r");
      |                               ^~~~~~
In file included from /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:2:
/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/FS.h:275:15: note: declared here
  275 | extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
      |               ^~~~~~
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino: In function 'void factoryReset()':
/Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:1516:13: warning: 'SPIFFS' is deprecated: SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
 1516 |             SPIFFS.format();
      |             ^~~~~~
In file included from /Users/andypiper/Development/third-party/anavi-thermometer-sw/anavi-thermometer-sw/anavi-thermometer-sw.ino:2:
/Users/andypiper/Library/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/FS.h:275:15: note: declared here
  275 | extern fs::FS SPIFFS __attribute__((deprecated("SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems.")));
      |               ^~~~~~

These are only warnings, but it looks like LittleFS is the way to go for future compatibility.

andypiper avatar Dec 17 '21 11:12 andypiper

According to the esp8266 core docs this may depend on whether the Anavi board can support LittleFS - and would need more information provided about how to rebuild the filesystem if a board was re-flashed.

andypiper avatar Dec 17 '21 11:12 andypiper

Hi @andypiper,

Thank you for pointing out this warning and the recommendation for moving on to LittleFS. The thermometer is using Ai Thinker ESP-12E ESP8266 module with 4MB SPI flash memory so I expect it should be capable of supporting LittleFS.

Thanks, Leon

leon-anavi avatar Dec 17 '21 22:12 leon-anavi

Cool, good to know - thanks! I'll have a look at this.

(also, I've flashed the sketch successfully now on Arduino IDE 2.0 from an M1 Mac - it looks like this has refreshed the software on the board, since initially it was not working with the tempformat command until this evening - moving forward!)

andypiper avatar Dec 17 '21 23:12 andypiper

That actually makes sense because the boards are provided to distributors with the latest firmware as of the moment when they are shipped to them but by the time they are purchased by individuals from the distributor there might be a new firmware version.

Btw I am happy to hear the dev workflow works with Arduino IDE 2.0 on an M1 Mac :)

Thanks, Leon

leon-anavi avatar Dec 17 '21 23:12 leon-anavi

I sent a couple of PRs, and I'll do some more testing and look up refreshing to LittleFS when I have some more time. Thank you!

andypiper avatar Dec 18 '21 00:12 andypiper

Has the bug where over a long period of time, the temperature reading goes to 32 degrees (F), and stays there?

Thanks! --Mark

On Fri, Dec 17, 2021 at 7:36 PM Andy Piper @.***> wrote:

I sent a couple of PRs, and I'll do some more testing and look up refreshing to LittleFS when I have some more time. Thank you!

— Reply to this email directly, view it on GitHub https://github.com/AnaviTechnology/anavi-thermometer-sw/issues/47#issuecomment-997107790, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMT7APWGQTGEUSGJMYUKSRTURPJPVANCNFSM5KIUSQEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

MarkKociscin avatar Dec 18 '21 00:12 MarkKociscin

I have not seen that, what is “a long period of time”? I only had the sensors drop to zero (C, aka 32F) once, when I reflashed the board, and restarting it resolved that. Did you previously open this as an issue? Maybe reopen or log this as a separate bug to this discussion :-) I can try to reproduce.

andypiper avatar Dec 18 '21 01:12 andypiper