GerLech / WebConfig

For ESP8266 and ESP32 edit configuration with web page and save it on SPIFFS. If no connection to a local WLAN exists configuration over web page can be done using an access point
GNU Lesser General Public License v3.0
78 stars 17 forks source link

conf.deleteConfig(); giving error #16

Closed sadatusa closed 2 years ago

sadatusa commented 2 years ago

Hi Dear, Nice lib... I tried to use conf.deleteConfig(); but receive following error in the example... boolean x = conf.deleteConfig();

_Arduino: 1.8.15 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E 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), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

c:/users/sadathussain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.3-gcc10.3-9bcba0b/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/sadathussain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.3-gcc10.3-9bcba0b/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-remove.o):(.literal+0x0): undefined reference to `_unlink_r'

c:/users/sadathussain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.3-gcc10.3-9bcba0b/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/sadathussain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.3-gcc10.3-9bcba0b/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-remove.o): in function _remove_r': /workdir/repo/newlib/newlib/libc/stdio/remove.c:65: undefined reference to_unlinkr' collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module).

mitchsf commented 2 years ago

The conf.deleteConfig() function returns true, but it does not delete the configuration. I don't get the error, though. I'm using IDE 1.8.19, the latest version of ArduinoJson, and ESP32.

GerLech commented 2 years ago

This is an error in the code. In lines 469 to 471 in WebConfig.cpp should be

//delete configuration file boolean WebConfig::deleteConfig(const char * filename){ return SPIFFS.remove(filename); }

I forgot the SPIFFS in front of remove. I will create a new release where this error will be fixed.

mitchsf commented 2 years ago

Works fine now. Thanks! I am finding that a delay must be added after deleteConfig(), or values can still be read, if read quickly enough.

Add conf.deleteConfig() after WiFi.mode(), in the example, to demonstrate this behavior.