1

I would like to save my Circular Buffer in the RTC memory of my ESP32 when I use deep sleep. So I have initialized it with RTC_DATA_ATTR but when I go into Deep Sleep I lose the data I've saved. Is there a way to do this?

Here is my function:

RTC_DATA_ATTR CircularBuffer<Datas, 178> test_SensorsDatas;

void test_RTC_memory(){

for(int i=1; i&lt;=20; i++){
    test_SensorsDatas.push(Datas);
    ID_msg.value++;
}

for(int i=0; i&lt;test_SensorsDatas.size(); i++){
    Serial.println(String(Datas.value));
}


esp_deep_sleep_start();

}

Thank you very much! Ask me questions if something isn't clear ;)

EDIT: I tried something much simplier:

RTC_DATA_ATTR sensorsRecord newrecord{20, ID_sensor, ID_msg, epochUnion, ValueUnion, intValue, 30};
RTC_DATA_ATTR CircularBuffer<sensorsRecord, 50> test_SensorsDatas;

void test_RTC_memory2(){ newrecord.ID_msg.value++; ID_msg.value++; Serial.println(String(newrecord.ID_msg.value)); test_SensorsDatas.push(newrecord); Serial.println("buffer size: " + String(test_SensorsDatas.size())); esp_deep_sleep_start(); }```

But still not working, the ID_msg is incrementing well but not the buffer size even if I push a new value at every wake up. Any suggestion?

EMall
  • 11
  • 2

0 Answers0