LVGL simulator with v9.x

Description

In v8 the simulator had lv_win32_quit_signal, in v9 how is this achieved?

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

PC Simulator Visual Studio Windows

What do you want to achieve?

I have timers running on my screens and when I close the app, it ends up with an exception, if I do not start the timer, it closes nicely.

What have you tried so far?

Disable the timer when compiling.

Code to reproduce

void init_screen(void)
{
static lv_style_t style_bg;
static lv_obj_t * bg_box;
static lv_obj_t* tbl_box;

lv_timer_create(update_cb, 33,  NULL);



}

The code block(s) should be between ```c and ``` tags:

/*You code here*/

Screenshot and/or video

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

I suspect you need to delete the timer upon closing the app?

lv_timer_create() returns an lv_timer* . I do not know how the simulator works but is there something that is called when the application closes? You should delete the timer there I guess.

I always create a delete event for when a screen gets deleted in which I delete the timer, perhaps this is an option for you? If you do not delete the timer manually it will stay alive. Here’s how I do it:


static void ev_Delete_cb(lv_event_t* event)
{
    lv_timer_t* timer = lv_event_get_user_data(event);
    if (timer != NULL)
    {
        lv_timer_delete(timer);
    }
}

void initScreen(lv_obj_t* screen)
{
    lv_timer_t* timer = lv_timer_create(tim_Update_cb, 100, labStatus);
    lv_obj_add_event_cb(screen, ev_Delete_cb, LV_EVENT_DELETE, timer);
}

Thank you, it works!

1 Like