Skip to content

AP Configuration Fails after updating from 3.0.1 to 3.0.2 and Later #10322

@Bolbolito

Description

@Bolbolito

Board

Lolin ESP32 S2 Mini

Device Description

None

Hardware Configuration

Not Applicable

Version

v3.0.4

IDE Name

Arduino IDE

Operating System

Windows 11

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

115200

Description

If updated to 3.0.2 the AP cannot be configured it just returns the old or default settings when calling the initializeOTA() function in my code and logs shows that AP cannot be configured. Works fine with 3.0.1.

Sketch

#include <WiFi.h>
#include <esp_now.h>
#include "esp_wifi.h"

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

  setCpuFrequencyMhz(80);

  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_LR);

  delay(1000);

  initESPNow();
}

void initializeOTA() {
  isUpdating = true;
  esp_now_deinit();
  delay(1000);

  String macAddress = WiFi.macAddress();
  macAddress.replace(":", "");  // Remove colons from MAC address

  // Define the SSID using the full MAC address
  String ssid = macAddress;

  // Define the password using the first 5 characters of the MAC address
  String password = "TEST-" + macAddress.substring(0, 5);

  // Print the SSID and password to the serial monitor
  Serial.print("SSID: ");
  Serial.println(ssid);
  Serial.print("Password: ");
  Serial.println(password);

  esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);

  WiFi.mode(WIFI_AP);
  
  esp_wifi_set_protocol(WIFI_IF_AP, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N);

  // Initialize the WiFi in AP mode with the custom SSID and password
  WiFi.softAP(ssid.c_str(), password.c_str());

  // Configure the static IP address
  if (!WiFi.softAPConfig(local_IP, gateway, subnet)) {
    Serial.println("Failed to configure AP");
  }

  // Print the IP address of the AP
  Serial.print("AP IP address: ");
  Serial.println(WiFi.softAPIP());
}

Debug Message

16:10:57.763 -> SSID: XXXXXXXXXXXX
16:10:57.763 -> Password: XXXXX-XXXXXX
16:10:58.767 -> Failed to configure AP
16:10:59.756 -> AP IP address: 192.168.4.1

Other Steps to Reproduce

Compiled using my two other pc with the same result when version is 3.0.2 or later.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions