Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By diffstorm
#67887 Thanks, I have tried and it works with hard coded MAC value, but I cannot read any value from EEPROM or SPIFFS in the initVariant() function.

I have tried EEPROM.begin, then EEPROM.read but it returns zero value.

How can I change STATION MAC dynamically from a FILE or EEPROM or any non-volatile memory?

Thanks.
User avatar
By torntrousers
#67892 I wonder it RTC user memory is available in initVariant?

If so you could have a flag and mac address in RTC user memory. initVariant checks the flag, if its not set which it wouldn't be at first power on then just carry on. In setup it also checks the RTC flag and if not set then gets the mac address from wherever and saves it in RTC user memory, sets the flag in RTC memory, and does a restart with deepSleep(1) (or perhaps just ESP.restart might work?). On this next startup initVariant sees the RTC flag is set so it gets the mac address from RTC user memory and calls wifi_set_macaddr.

A little convoluted!
User avatar
By diffstorm
#67899 Thanks, I was thinking the same idea, but it is a bit dirty with 2 restarts every time. It could work since you also mentioned the same idea.
So this is a solution, but I would be happy to hear if there is a better idea than that without restarting?

Thanks in advance for your support.