mirror of
https://github.com/arendst/Tasmota.git
synced 2026-10-26 22:11:22 +00:00
WifiManager: name the setup AP as it is turned on (#25169)
WifiManagerBegin() turned the AP on with WifiSetMode() and named it with WiFi.softAP() only after WifiSetMode()'s delay(100): for that time the AP beaconed under the SDK's default name, ESP_ and the AP MAC, which a phone or computer then lists beside the real name, often for a minute after. WiFi.softAP() turns the AP on and names it at once, so it now comes first; WifiSetMode() then sets the station side as before.
This commit is contained in:
1 parent
9515f82b23
commit
805fc7cb01
1 file changed
+8
-6
@@ -730,6 +730,14 @@ void WebserverStartSocket(void) {
|
||||
void WifiManagerBegin(bool reset_only) {
|
||||
// setup AP
|
||||
if (!Web.initial_config) { AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); }
|
||||
|
||||
int channel = WIFI_SOFT_AP_CHANNEL;
|
||||
if ((channel < 1) || (channel > 13)) { channel = 1; }
|
||||
|
||||
// Name the AP as it is turned on: WifiSetMode() first would bring it up under
|
||||
// the SDK default name (ESP_ and the AP MAC) for its delay(100)
|
||||
// bool softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4);
|
||||
WiFi.softAP(TasmotaGlobal.hostname, WIFI_AP_PASSPHRASE, channel, 0, 1);
|
||||
if (!TasmotaGlobal.global_state.wifi_down) {
|
||||
WifiSetMode(WIFI_AP_STA);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION));
|
||||
@@ -741,12 +749,6 @@ void WifiManagerBegin(bool reset_only) {
|
||||
//StopWebserver();
|
||||
|
||||
DnsServer = new DNSServer();
|
||||
|
||||
int channel = WIFI_SOFT_AP_CHANNEL;
|
||||
if ((channel < 1) || (channel > 13)) { channel = 1; }
|
||||
|
||||
// bool softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4);
|
||||
WiFi.softAP(TasmotaGlobal.hostname, WIFI_AP_PASSPHRASE, channel, 0, 1);
|
||||
delay(500); // Without delay I've seen the IP address blank
|
||||
/* Setup the DNS server redirecting all the domains to the apIP */
|
||||
DnsServer->setErrorReplyCode(DNSReplyCode::NoError);
|
||||
|
||||
Reference in new issue
Block a user