Skip to content

Commit 97638c1

Browse files
(#198): custom access point SSID can now be provided
- A unique SSID is now set for the Krake during the setup process - It is of the form 'Krake_<unique mac address>'
1 parent 6defa75 commit 97638c1

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

Firmware/GPAD_API/GPAD_API/GPAD_API.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,10 @@ void setup()
488488
// We call this a second time to get the MAC on the screen
489489
// clearLCD();
490490
// req for Wifi Man and OTA
491-
WiFiMan();
491+
char setupSsid[20] = "Krake_\0";
492+
strcat(setupSsid, macAddressString);
493+
494+
WiFiMan(setupSsid);
492495
initLittleFS();
493496
server.begin(); // Start server web socket to render pages
494497
ElegantOTA.begin(&server);

Firmware/GPAD_API/GPAD_API/WiFiManagerOTA.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "WiFiManagerOTA.h"
22
#include <LittleFS.h>
33

4-
const char *default_ssid = "ESP32-Setup"; // Default AP Name
4+
const char *DEFAULT_SSID = "ESP32-Setup"; // Default AP Name
55
String ssid_wf = "";
66
String password_wf = "";
77
String ledState = "";
@@ -42,13 +42,24 @@ bool loadCredentials()
4242
return true;
4343
}
4444

45-
void WiFiMan()
45+
void WiFiMan(const char *accessPointSsid)
4646
{
4747
WiFiManager wifiManager;
4848

4949
if (!loadCredentials())
5050
{
51-
if (!wifiManager.autoConnect(default_ssid))
51+
boolean connectSuccess = false;
52+
53+
if (accessPointSsid == "")
54+
{
55+
connectSuccess = wifiManager.autoConnect(DEFAULT_SSID);
56+
}
57+
else
58+
{
59+
connectSuccess = wifiManager.autoConnect(accessPointSsid);
60+
}
61+
62+
if (!connectSuccess)
5263
{
5364
Serial.println("Failed to connect. Restarting...");
5465
ESP.restart();

Firmware/GPAD_API/GPAD_API/WiFiManagerOTA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
#include <FS.h>
88
#include <LittleFS.h>
99

10-
extern const char *default_ssid;
10+
extern const char *DEFAULT_SSID;
1111
// extern String ssid;
1212
// extern String password;
1313
extern String ledState;
1414
extern int WiFiLed;
1515

1616
void saveCredentials(const char *ssid, const char *password);
1717
bool loadCredentials();
18-
void WiFiMan();
18+
void WiFiMan(const char *accessPointSsid);
1919
void initLittleFS();
2020
void initWiFi();
2121
String processor(const String &var);

0 commit comments

Comments
 (0)