keep variable after restart

mvadu!
Posts: 1
Joined: Mon Nov 26, 2018 2:06 am

Re: keep variable after restart

Postby mvadu! » Mon Nov 26, 2018 2:08 am

Is this bug been fixed? Or should we still be using another dummy RTC_DATA_ATTR variable just to keep the memory powered up?

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: keep variable after restart

Postby ESP_igrr » Mon Nov 26, 2018 3:31 am

Yes, has been fixed in https://github.com/espressif/esp-idf/co ... 158dbf6b4b for master and release/v3.2, and in https://github.com/espressif/esp-idf/co ... 7143985edc for release/v3.1.

j4e8a16n
Posts: 9
Joined: Mon Nov 18, 2019 5:55 pm

Re: keep variable after restart

Postby j4e8a16n » Tue Jul 07, 2020 2:36 pm

Hi,


RTC_NOINIT_ATTR int waitFlag = 0;

Serial.println((String)waitFlag);

Why do I get this?
1881730620


Regards

JPD
Arduino 1.8.10; Windows 10; ESP32 VROOM

ESP_Sprite
Posts: 9761
Joined: Thu Nov 26, 2015 4:08 am

Re: keep variable after restart

Postby ESP_Sprite » Tue Jul 07, 2020 6:18 pm

...because you tell the compiler not to initialize the variable, and that seemingly takes precedence over the fact that you tell it to initialize the variable.

Who is online

Users browsing this forum: No registered users and 93 guests