Esp32 deep sleep and oled display

Here is what I want to do. A simple watch displaying the time as HH:MM each minute on an oled display, and put the esp32 in deep sleep during the interval.

Additionally, I want to update the display by changing only the digits that changed. For example, at time 05:17, I just want to change the 7, all the other numbers should remain on the display.

I use the library u8g2lib

But when the esp32 wakes from deep sleep, I have to declare and init the display, which erases it entirely. So this implies that I need to display the time completely.

Is there a solution to prevent the display from erasing?
Thanks for your help.

Edit. Oled display is for testing, my final objective is to use e-paper

Some display libraries write the screen output to a RAM buffer and then in a single operation write the entire buffer to the screen.

In other words does the library you are using allows a partial write to the screen (without an entire screen update) in the first place ?

I believe so. I've tried a simplified sketch doing the complete display in the setup and changing only one digit every 2 seconds in the loop. Works OK, but no deep sleep in this test, just some digit update.

I found this thread, that you may understand better than me (not native english speaker). I think it says that I can try to replace
display.begin();bydisplay.initDisplay();which would not empty the buffer.

what do you think ? Do you have the same understanding ?

As the ESP8266, ESP32 has some RTC non volatile Memory, so I think the right solution is to save , e.g. a boolean variable into the RTC non volatile memory ( e.g. RTC_DATA_ATT boolean InitDisplay) to tell the ESP32 that the display has already been initialized at the end of setup().

After waking up from deep sleep, there is a Reset and code runs from Setup(), not loop(). In setup(), test InitDisplay to initialize or not the display.

See this video, at 3:51 :

I tried that already but the display remains frozen, it does not update

If deep sleep is not the solution, try light sleep. IMO in light sleep mode, after waking up, code runs from loop().

Of course current consumption should be higher:

If you are continuously displaying the OLED, that current will be way more than the sleep current of the ESP.

If you are continuously displaying the OLED, that current will be way more than the sleep current of the ESP.

Yes, OLED is the display I use to design my code while waiting for e-paper displays.