-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
WiFi.macAddress(uint8_t mac) doesn't work anymore to retrieve mac, it returns 00:00:00:00:00:00 - Network.macAddress does perform as expected. #9509
Comments
@me-no-dev think this is not expected |
I can't reproduce it. It returns the MAC address in my test with 3.0.0-rc1 |
Oh strange, thanks, I'll investigate further. |
Strictly speaking I'm on this branch with one commit to make the actions on the main adafruit repo pass (tested on my local using platformio, but action passed all builds except C3 due to size - known internal issue): The end of the changeset contains the relevant change: |
since the network refactoring, macAdress comes from the interface and you are asking for it before you have started that interface. Network.macAddress gives you the base MAC of the ESP chip. From it are derived STA, AP and ETH MACs |
Thank you so much for the explanation! So effectively it's not set on either of those three interfaces until they connect or are brought up, does that sound right? |
WiFi Scan will enable STA, so it should give you the MAC after it runs. You can get the MAC right after the proper By far the best way is to use the new network interfaces: // Get the base MAC of the ESP chip (works always)
Network.macAddress(mac);
// Get the MAC address of WiFi STA (must first start interface)
WiFi.STA.begin();
WiFi.STA.macAddress(mac);
// Get the MAC address of WiFi AP (must first start interface)
WiFi.AP.begin();
WiFi.AP.macAddress(mac);
// Get the MAC address of ETH (must first start interface)
ETH.begin();
ETH.macAddress(mac); |
off topic: it would be nice if the mac in the examples above could be of MacAddress type |
@JAndrassy yup. on the way also :) |
ESP32 Boards library has been updated to version 3.0 Now we can not ask the mac address before wifi is started. see issue espressif/arduino-esp32#9509 I changed the way we get the mac address from WiFi.macaddress() to Network.macaddress(). It results in the same numbers.
Thanks everyone. Very useful info. |
Hello, Due to the overwhelming volume of issues currently being addressed, we have decided to close the previously received tickets. If you still require assistance or if the issue persists, please don't hesitate to reopen the ticket. Thanks. |
Board
ESP32
Device Description
Hardware Configuration
Version
latest master (checkout manually)
IDE Name
Operating System
Flash frequency
PSRAM enabled
yes
Upload speed
Description
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: