diff --git a/docs/esptool.md b/docs/esptool.md index 33957d1..606a634 100644 --- a/docs/esptool.md +++ b/docs/esptool.md @@ -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"). diff --git a/src/ESP01Firmware/ESP01Firmware.ino b/src/ESP01Firmware/ESP01Firmware.ino index e8927c8..932084d 100644 --- a/src/ESP01Firmware/ESP01Firmware.ino +++ b/src/ESP01Firmware/ESP01Firmware.ino @@ -13,7 +13,7 @@ void setup() { WiFi.setSleepMode(WIFI_NONE_SLEEP); - WiFi.softAP(ssid, password); + WiFi.softAP(ssid + get_suffix(), password); server.begin(); } @@ -35,4 +35,17 @@ void loop() { } client.stop(); } -} \ No newline at end of file +} + +/** + * @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; +}