Post topics, source code that relate to the Arduino Platform

User avatar
By martinayotte
#50318 I have no idea !

I'm still using ESP 2.3.0, therefore SDK 1.5.3.

BTW, why are you accessing "*rtcStore" as a pointer ? for proper readability, it is better rtcStore[0] and rtcStore[1] ...
Is it because you wished to use it as a 16bits counter ? in such case, you've made a mistake since it is treated as byte pointer, except if you cast it as "*(uint16 *)rtcStore", but that would still be ugly code, better is declaring first as uint8 and cast it to "(byte *)" in the rtc_mem calls.
User avatar
By Rupak
#50414 Hi,

I debugged further and found that I am seeing issue for RTC memory read and write due to below API:

WiFi.softAPmacAddress(mac); //Here mem value is getting set as 239 and 240
clientName += getMacAddress(mac);


when the coed calls this API, mem value read starts showing 239 and it never gets reset. This API is not present in 8266 SDK doc and it comes from Arduino.
Is there any other API which I can use as workaround.

thanks,
Rupak
User avatar
By martinayotte
#50415 There is two ESP.softAPmacAddress() methods, one not having any argument and returning a String, and the other with "uint8_t* mac" argument to allow it to store result.
In your example, you seems to use the second one but we don't see how you've declared "mac" and what getMacAddress() function is doing.
You should simply use :
Code: Select allclientName += ESP.softAPmacAddress();

If you really wish to use the second one, it will becomes more complicated :
Code: Select alluint8_t mac[6];
char macStr[18];
ESP.softAPmacAddress(&mac);
sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
clientName += macStr;

Finally, I don't see the relation with rtc_mem issue you've faced. Maybe showing more code could help to have the full view.

BTW, when you say "This API is not present in 8266 SDK doc", which API are you talking about, the rtc_mem ? It is simply a memory location, so there is not really much API to be documented, other than system_rtc_mem_read() and system_rtc_mem_write() present in native SDK under sdk/include/user_interface.h, which is what Arduino core is using.