Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By chriscook8
#15426
ian wrote:I was testing your code at a friend's house at the weekend. Her router SSID is two words, eg 'my router' with a space character between the two words.
Your code seemed to indicate a '+' character rather than ' '
I have no idea if this is significant. I couldn't test at the time & can't test easily now without setting up another router.
Cheers
Ian


Oh yeah, that would totally be a thing. The browser would submit the SSID url encoded so spaces would become '+' and certain other characters would be turned into their encoded equivalents. I don't have any decoding in place in the script so all these extended characters would be stored wrong, same for passwords.

I'll look around for a small decoding library to add in.
User avatar
By geing
#15688
ian wrote:
Funny thing about version control... needing to commit your changes.


Life's a bitch! ;)

I was testing your code at a friend's house at the weekend. Her router SSID is two words, eg 'my router' with a space character between the two words.
Your code seemed to indicate a '+' character rather than ' '
I have no idea if this is significant. I couldn't test at the time & can't test easily now without setting up another router.
Cheers
Ian



Thanks chris for the code , I think we may also add an option with SoftAP to run Wifi network independently away from wifi route.

When it find no WiFi network , then allow to input ssid and pwd for SoftAP run.

I find that it only support 10 wifi clients max. in SoftAP mode , it that right ?
User avatar
By Davy
#15857 Just as a heads up (or reminder), if you set wifi_station_set_auto_connect(true) the esp8266 will try to auto connect using the last setting.
So, when you set wifi_station_set_auto_connect(true) and then call WiFi.begin(ssid, password) the esp will always try to connect on startup (without needing to use WiFi.begin). In setup you can do something like this:

void setup()
{
Serial.begin(115200);

// Wait for the WiFi to connect (10 sec timeout)
if( false == WaitForWiFiConnect(10) )
{
Serial.println("unable to auto connect to WiFi");
setupAP();
return;
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.println("WiFi SSID: ");
Serial.println(WiFi.SSID());

launchWeb(0);
}

bool WaitForWiFiConnect(int Timeout)
{
Serial.println("Waiting for WiFi connection");
for(int i = 0; i < Timeout * 2 && WiFi.status() != WL_CONNECTED; i++)
{
Serial.print(".");
delay(500);
}

return WiFi.status() == WL_CONNECTED? true: false;
}

Then for webtype==1 you can call WiFi.begin(ssid, password) with the new ssid/password and switch webtype if it connects.


Using this you should be able to avoid the EEPROM read/writes and save some code space.
I haven't tried merging this into your code but this is the basic process of what I'm doing and it seems to work well.
User avatar
By drmpf
#15940 I have been working on a solution for this and have example code for a number of Arduino wifi devices
and a supporting Android Application that guides the user through the steps
see http://www.forward.com.au/pfod/pfodWifi ... index.html

Currently working on an ESP2866 AT command version connected to an Arduino.

Could also do this in native ESP code (later)