feature/netman #1

Merged
tomislav merged 12 commits from feature/netman into master 2024-11-05 19:43:41 +00:00
Showing only changes of commit 1c6d4eaaba - Show all commits

View File

@ -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();