Change AP SSID generator
This commit is contained in:
parent
f835aa0122
commit
1c6d4eaaba
11
src/netman.h
11
src/netman.h
@ -53,11 +53,16 @@ void netman::init(String ssid, String pass, bool hidden) {
|
||||
pass = "8characters";
|
||||
}
|
||||
|
||||
// Get the last 4 characters of the MAC address
|
||||
String macAddress = WiFi.macAddress();
|
||||
String macSuffix = macAddress.substring(macAddress.length() - 5).replace(":", "");
|
||||
|
||||
// Set default SSID if none provided
|
||||
_ssid = ssid.isEmpty() ? "SmartCube_" + String(ESP.getChipId()) : ssid;
|
||||
_ssid = ssid.isEmpty() ? "SmartCube_" + macSuffix : ssid;
|
||||
_pass = pass;
|
||||
_hidden = hidden;
|
||||
|
||||
|
||||
// Initialize LittleFS with error handling
|
||||
if (!LittleFS.begin()) {
|
||||
display.clearDisplay();
|
||||
@ -159,8 +164,12 @@ void netman::createAP() {
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.println("AccessPoint created");
|
||||
display.setCursor(0, 12);
|
||||
display.println("SSID:");
|
||||
display.setTextSize(2);
|
||||
display.println(_ssid.c_str());
|
||||
display.setTextSize(1);
|
||||
display.setCursor(0, 32);
|
||||
display.println("IP:");
|
||||
display.println(WiFi.softAPIP().toString());
|
||||
display.display();
|
||||
|
Loading…
Reference in New Issue
Block a user