Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi: clean up AP SSID setter & getter, support 32 chars #7941

Merged
merged 9 commits into from
May 15, 2021

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Mar 25, 2021

This was updated for STA some time ago.
Plus, clean up ssid & pass copy routines similar to the #7940

Comparison also adjusted to take into an account the ssid_len and limit itself by the passphrase length, including '\0' if I read the strncmp man correctly.
Adds note in the comments that softAp only works with passphrases (...not WEP key. Terminology used is a bit confusing in regards to password vs. psk vs. passphrase)

@arihantdaga
Copy link

arihantdaga commented Mar 30, 2021

@mcspr I am facing a problem where Calling WiFi.softAP(SSIDS.c_str(), PASSS.c_str()); Isnt working, and not updating the ssid and password.
It is only taking for the first time, next time if i upload code with different SSID and PASS, it is not updated(The wifi discovered by phone is still have the same older name). I even tried this pr, but still the same.

Is it a related problem ?
Sketch

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>


String SSIDS = "NewSSID"; // If next time i change this and upload the code again, ssid displayed doesnt actually change. 
String PASSS = "NewPassword";


/* Just a little test message.  Go to http://192.168.4.1 in a web browser
   connected to this access point to see it.
*/


void setup() {
  delay(1000);
  Serial.begin(115200);
  Serial.println();
  Serial.print("Configuring access point...");
  /* You can remove the password parameter if you want the AP to be open. */
  WiFi.softAP(SSIDS.c_str(), PASSS.c_str());

  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
 
}

void loop() {
  server.handleClient();
}

This is misbehaving when the new password is different.
Example -
Next time keep

String SSIDS = "ArihnatNK"; 
String PASSS = "Generic";

In that case the ssid will not be updated,

Also, calling WiFi.softAP(SSIDS.c_str()); without password is leading to continous crash due to exception.

@mcspr
Copy link
Collaborator Author

mcspr commented Mar 30, 2021

@arihantdaga not likely. If you are using Android, just restart the WiFi via toggle or Airplane mode, or just filter out by bssid if this is some app. Scan results are cached, it could be switched into a passive mode, etc. e.g.
https://gist.github.com/mcspr/430ba0b302faf9497c9492a41bad7dd6
Will probably display both at the same time.

@arihantdaga
Copy link

@mcspr . I am sure, i can verify this is some bug, not problem with my mobile, I have tried with laptop and I have tried setting up different wifi names etc. I startee seeing it a while ago, today I verified multiple times.

@arihantdaga
Copy link

I'll check the gist also.

@mcspr
Copy link
Collaborator Author

mcspr commented Mar 31, 2021

Open an issue? This is not related to the PR here.
Note the example above also toggles wifi on -> off -> on, which is to showcase the simultaneous display

remove comment about passphrase & wpa2, retrieve 64byte psk from the sdk
update softAP to accept 64byte psk
rename password -> psk
update docs
@arihantdaga
Copy link

@mcspr Thank you. I got it, the actual problem was because i was setting a password that was less than 8 characters long.
Found this issue. xoseperez/espurna#1151
Thank you.

@earlephilhower earlephilhower merged commit 4436e32 into esp8266:master May 15, 2021
@mcspr mcspr deleted the wifi-ap-32 branch October 24, 2021 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants