I am having a problem after my new shipment of S3 chips that came are now ver 0.2.
I have a feature in my code that will basically enter into AP mode and serve up a webpage that will allow a user to change configuration settings. This basically uses the preferences.h and webserver.h library.
However, when I “save” the settings, it does not actually save and when it reads it again, it is still the old value.
The interesting thing is that when I use the same code on an earlier board which is V0.1 of the S3 chip, it works without any problem.
The other thing that I have found is that here is some conflict between the webserver library and the preference.h library because when I remove the routine of going through the webserver, then it will work.
So if I do something like this in the setup routine, it will work.
- String ssid = "IZEEM_2G";
- String ssid = "12345678";
- StoreData("ssid",ssid);
- StoreData("wifi_password",wifi_password);
- void StoreData(const char* key, const String val) {
- Serial.print("Storing : ");
- Serial.println(val);
- preferences.begin(MEM_ID,false);
- size_t tmp = preferences.putString(key, val);
- Serial.println(tmp);
- preferences.end();
- }
- void APconfig::handleSubmit(){
- String response_success="<h1>Success</h1>";
- response_success +="<h2>Set the device to the correct ID and reboot</h2>";
- String response_error="<h1>Error</h1>";
- response_error +="<h2><a href='/config'>Go back</a>to try again";
- String ssid = String(server.arg("ssid"));
- String wifi_password = String(server.arg("wifi_password"));
- StoreData("ssid",ssid);
- StoreData("wifi_password",wifi_password);
- server.send(200, "text/html", response_success);
- }
size_t tmp = preferences.putString(key, val);
Serial.println(tmp);
So I get something like this from the Serial monitor
IZEEM_2G
12345678
Storing : IZEEM_2G
8
Storing : 12345678
8
So it looks like the data was "saved" correctly. But when I reset the board, it will still read the old value that was previously saved.
Does anyone have any idea or have had the same issue?