Hie, i am having problem in understanding some part of the code.
RTC_DATA_ATTR static time_t last;
RTC_DATA_ATTR static uint32_t bootcount;
What is RTC_DATA_ATTR mean here.? and why are we using it?
Your email is safe with us, we don’t spam.
Be a part of our ever growing community.
Abhimanyu Pandit
Permalinkwhen you define a global variable with RTC_DATA_ATTR attribute, the variable will be placed into RTC_SLOW_MEM memory. So the structure declared as RTC_DATA_ATTR and copy the dynamic memory to this structure before a deep sleep helps recovering this into dynamic memory after wake up. In simple words we are saving the time in static memory from dynamic memory to recover it again after a deep sleep. Here the two variables are defined. The ‘last’ is used to get the last time when the ESP32 went to deep sleep and bootcount is used count number of resets.
I would suggest to post the complete code and then we can clear a bit more.
- Log in or register to post comments
Joined January 21, 2019 42Monday at 12:12 PM