Skip to content

feat: add NIC specific part of MAC address as suffix to SSID #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/esptool.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ You should see something like this:
Leaving...
Hard resetting via RTS pin...

Now pull the ESP-01's GPIO_0 pin high and reset it. If the new firmware was flashed successfully, it will start broadcasting an SSID called "PSLab".
Now pull the ESP-01's GPIO_0 pin high and reset it. If the new firmware was flashed successfully, it will start broadcasting an SSID starting with "PSLab_" followed by the last three octets of the MAC address of the ESP-01 (e.g. "PSLab_0DCE2F").
17 changes: 15 additions & 2 deletions src/ESP01Firmware/ESP01Firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void setup() {

WiFi.setSleepMode(WIFI_NONE_SLEEP);

WiFi.softAP(ssid, password);
WiFi.softAP(ssid + get_suffix(), password);

server.begin();
}
Expand All @@ -35,4 +35,17 @@ void loop() {
}
client.stop();
}
}
}

/**
* @brief Return a suffix based on the NIC specific part of the MAC address
*
* @return The final three octets of the MAC address, prefixed with underscore
*/
String get_suffix() {
// Remove vendor ID
String mac = WiFi.macAddress().substring(9, 17);
// Remove colons
mac.replace(":", "");
return "_" + mac;
}