Skip to content

Commit

Permalink
Merge pull request #494 from limes007/32_char_ssid
Browse files Browse the repository at this point in the history
workaround to enable ssid with 32 chars
  • Loading branch information
Blueforcer authored Mar 8, 2024
2 parents dd82cf9 + a845077 commit e99c1b5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/webserver/esp-fs-webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ IPAddress FSWebServer::startWiFi(uint32_t timeout, const char *apSSID, const cha
_ssid = reinterpret_cast<const char *>(conf.sta.ssid);
_pass = reinterpret_cast<const char *>(conf.sta.password);

char * my_ssid;
my_ssid = new char[32+1];
strncpy(my_ssid, _ssid, 32);
my_ssid[32] = '\0';
if (strlen(my_ssid) < strlen(_ssid))
_ssid = my_ssid;

if (strlen(_ssid) && strlen(_pass))
{
WiFi.begin(_ssid, _pass, 0, 0, true);
Expand All @@ -198,6 +205,7 @@ IPAddress FSWebServer::startWiFi(uint32_t timeout, const char *apSSID, const cha
{
ip = WiFi.localIP();
WiFi.persistent(true);
delete[] my_ssid;
return ip;
}
// If no connection after a while go in Access Point mode
Expand All @@ -218,6 +226,8 @@ IPAddress FSWebServer::startWiFi(uint32_t timeout, const char *apSSID, const cha
Serial.print(F("\nAP mode.\nServer IP address: "));
Serial.println(ip);
Serial.println();

delete[] my_ssid;
return ip;
}

Expand Down

0 comments on commit e99c1b5

Please sign in to comment.