feature/netman #1
11
src/netman.h
11
src/netman.h
@ -53,11 +53,16 @@ void netman::init(String ssid, String pass, bool hidden) {
|
|||||||
pass = "8characters";
|
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
|
// Set default SSID if none provided
|
||||||
_ssid = ssid.isEmpty() ? "SmartCube_" + String(ESP.getChipId()) : ssid;
|
_ssid = ssid.isEmpty() ? "SmartCube_" + macSuffix : ssid;
|
||||||
_pass = pass;
|
_pass = pass;
|
||||||
_hidden = hidden;
|
_hidden = hidden;
|
||||||
|
|
||||||
|
|
||||||
// Initialize LittleFS with error handling
|
// Initialize LittleFS with error handling
|
||||||
if (!LittleFS.begin()) {
|
if (!LittleFS.begin()) {
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
@ -159,8 +164,12 @@ void netman::createAP() {
|
|||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setCursor(0, 0);
|
display.setCursor(0, 0);
|
||||||
display.println("AccessPoint created");
|
display.println("AccessPoint created");
|
||||||
|
display.setCursor(0, 12);
|
||||||
display.println("SSID:");
|
display.println("SSID:");
|
||||||
|
display.setTextSize(2);
|
||||||
display.println(_ssid.c_str());
|
display.println(_ssid.c_str());
|
||||||
|
display.setTextSize(1);
|
||||||
|
display.setCursor(0, 32);
|
||||||
display.println("IP:");
|
display.println("IP:");
|
||||||
display.println(WiFi.softAPIP().toString());
|
display.println(WiFi.softAPIP().toString());
|
||||||
display.display();
|
display.display();
|
||||||
|
Loading…
Reference in New Issue
Block a user