WiFi101 WiFi.macAddress() returns different MAC addresses

If I call WiFi.macAddress() before calling WiFi.begin I get a random incorrect mac address returned. a call to begin, even if no parameters are supplied or connection is made, is needed for the correct mac to be returned.


byte mac[6];

returns a random address in the variable mac but

byte mac[6];

Returns the the address printed on my MKR1000.

Although the example code includes a connection to an access point there is no mention of this requirement in the documentation or an explanation as to why it should be necessary.

I realise that good programming practise dictates that initialising the device is a good idea but, since it confused me, I'm sure it will mislead others as well. The random mac looked genuine until I realised it was the wrong number.

Basically I'm asking if either a warning could be added to the documentation or the behaviour of the library changed to return all FFs prior to initialisation which would be consistent with what happens after you've called WiFi.end() and far more obvious.

esp_system.h is not found when I try to compile for my MKR1000.

is this a component of the older WiFi library that is used for esp8266 based cards?

(I should have made it clear that I’m using the WiFi101 needed by the MKR1000 board).