Hi,
I’m having a problem that is rather difficult to explain, let alone illustrate using code. What I mean by that is that when I try to boil down the code to just the items that have the problem, it doesn’t actually show me the problem. If there’s anyone who’s interested in accessing my github page to see of they can find the problem, be sure to let me know.
Hardware: Adafruit ESP32 and DOIT DevKit 1
Here’s what I’m building:
I have an application that reads wifi settings from a json (ArduinoJson 6) file to set up a webserver (ASyncWebServer).
Original json file:
{
"wifi_ssid": "shufobox",
"wifi_password": "",
"shutter_duration": 20,
"focus_mode": "SIMULTANEOUS"
}
On there I have an html page that gives the user the option to change the ssid and password, among other things. When I submit and save these settings back into a json file, the file is perfectly normal and all the settings are exactly what I expected they would be when printing to the browser or Serial prompt.
Here’s what the saved json file looks like:
{
"wifi_ssid": "shufoboxxes",
"wifi_password": "shootit",
"shutter_duration": 25,
"focus_mode": "SIMULTANEOUS"
}
However, after restarting the webserver, the SSID (even though the Serial prompt shows me the correct one) is a nonsense word with characters I don’t even recognize. If I load the html page again (assuming I can connect), there seems to be random text where the SSID and password fields should be:
<input type="text" name="wifi_ssid" placeholder="AP SSID" required value="�?H!�?" />
<input type="text" name="wifi_password" placeholder="AP password" value="" />
I’m not sure where to start looking for the error. I thought it was perhaps that I’m restarting the board before it’s finished writing, but I do have a clean and finished JSON file that I can read on the next boot. Could it be that variables are lingering in memory and therefor are scrambling up my settings on future boots? I reset the board and even unplugged it but that doesn’t seem to change it.
Any help would be greatly appreciated, and again I’m happy to give access to the github repo.
Thanks,
Jan