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
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.