How to Delete/End/Reset/Kill all LittlevGL related Settings/Processes?

Description

Hello there.
Solving my last Problem Can be found here lead me to a new Problem.

Because of reasons I don’t understand my HX711 Scale A/D Converter and LittlevGL can’t work together.
My ESP Code has 2 boot options.
Wakeup from Deepsleep by touch -> go to GUI
Wakeup from Deepsleep by timer -> go read your sensors and go back to deepsleep

My GUI has a button for going to Deepsleep. If I click this Button the ESP goes to deepsleep but the GUI is still drawn to the display and is frozen even if he wakes up.
Then after awakening from deepsleep HX711 and the half dead rests of LittlevGL are conflicting and the ESP dies.

What MCU/Processor/Board and compiler are you using?

ESP32, Wroom32, Devkit C, Arduino IDE

What do you want to achieve?

If I press the Deepsleep button on the GUI i want that my Display goes dead again before entering deepsleep mode.
Is there a way to end LittlevGL and the GUI? This would be really great.

What have you tried so far?

I searched the Forum and the documentation but didn’t find anything helpful.
I changed the esp_deep_sleep_start(); command against ESP.restart(); but the GUI keeps drawn on the Display and the ESP is crashing when the HX711 code is called. Just a

Code to reproduce

This is my code for the the 2 wakeup modes.

#LittlevGL Defines
#Sensor Defines
void loop()
{
  
 
  while (Touch == true){
   
    if (i == 0)        // on the first round(i=0)through the while all setup related things are set
                        // after i>0 just the else is repeated
  {
All LittlevGL setup stuff in here
} //end IF
else
    
    lv_task_handler(); /* let the GUI do its work */
    delay(5);
    timerWrite(timer, 0); //sets watchdog to 0
    ++i;
} //end of while

Rest of loop for normal sensor code

} //end of void_loop

This is my code in the Callback

static void event_handler(lv_obj_t * obj, lv_event_t event)
{
    if(event == LV_EVENT_CLICKED) {
        printf("Clicked\n");
        printf("Going to Deepsleep\n");
        esp_sleep_enable_timer_wakeup(SleepTime * ConversionSeconds);    //Set  Deep Sleep Time
        esp_deep_sleep_start();                       // Start Deep Sleep
    }
    else if(event == LV_EVENT_VALUE_CHANGED) {
        printf("Toggled\n");
    }
}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

What happens with the RAM content on deep sleep? is it cleared or retrieved?
Is it working if you go sleep from GUI go back to the GUI again?

1 Like

Hello there :slight_smile:
First of all let me thank you for LittlevGL. Big props to you guys for making such a decent piece of software and even answer all our questions. Thanks for your work @ Team LittlevGL

The ESP32 has a normal ram area and a RTC ram area. The normal ram area is cleared when the ESP32 enters the deepsleep.
The content of RTC ram is beeing saved and is available after waking up from deepsleep.
I use the rtc are for storing variables with the values of my sensor reads. And i call the variables in LittlevGL to display the values on my display.

And I tested the code a bit and figured out that i forgot set

i=0; beforre going to deepsleep. so after waking up from deepsleep i was > 0 and the littlevGL setup wasn’t called.
So the problem was infront of the screen and not behind.
But thanks for your time :blush:

Glad to hear that you have found the issue! :slight_smile: