Hi guys,
I think I'm having an issue with the function "WiFi.clearCredentials()" or/and when the Photon works as Acces Point with "WiFi.listen()".
Through serial communication I send a command which sets a flag and then, in the loop() function, "WiFi.clearCredentials()" and "Wifi.listen()".
loop()
{
//OTHER CODE
if(clearCredFlag) {
WiFi.clearCredentials();// I want only one wifi stored
delay(100);
WiFi.listen();
delay(100);
}
}
In this way the Photon goes correctly in AP (blinking blue) and waits the new WiFi credentials but when I connect to it doesn't respond. A message from your app appears and says:
Error
Please try running setup again after resetting your Photon and putting it back in blinking blue listen mode if needed.
If I press the reset the Photon goes correctly on listen mode as soon as is called WiFi.connect() (I'm in semi-automatic mode) but I receive the red SOS blinking when I try to connect and set the credentials (with the app).
If I press the setup button untill blink fast blue (manually clean credentials) then the app can connect to the Photon and I can set a WiFi credential.
I'm using software timers but they do nothing until I got new WiFi credentials.
I think something goes wrong when I clear the WiFi credentials. Probably they get corrupted somehow.
Some questions:
1)Have you some advise? Are there differences between WiFi.clearCredentials() + WiFi.listen() and pressing the setup button for more than 10s?
2)Instead of using the device setup library in my app is it possible to use directly UDP and/or TCP communications with the app (the classes UDP and TCPclient) to set WiFi credentials?
- I tried to use the Soft HTTP Pages sample (here) to set Wi-Fi credentials through a web browser interface, but it works correctly only with a simple firmware. When I merge my FW with that sample, the web browser gives me some errors while loading the page, namely it seems that it can not load some css or js files ("/rsa-utils/jsbn_2.js" , etc.)
Do you have any hint about why this behavior occurs and what I could do to make it work with my FW?
Thank you very much
Claudio