Initialize refresh task before creating display objects
@@ -133,6 +133,10 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
lv_disp_t * disp_def_tmp = disp_def;
disp_def = disp; /*Temporarily change the default screen to create the default screens on the
new display*/
+ /*Create a refresh task*/
+ disp->refr_task = lv_task_create(lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, LV_REFR_TASK_PRIO, disp);
+ LV_ASSERT_MEM(disp->refr_task);
+ if(disp->refr_task == NULL) return NULL;
disp->inv_p = 0;
@@ -146,11 +150,6 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
disp_def = disp_def_tmp; /*Revert the default display*/
- /*Create a refresh task*/
- disp->refr_task = lv_task_create(lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, LV_REFR_TASK_PRIO, disp);
- LV_ASSERT_MEM(disp->refr_task);
- if(disp->refr_task == NULL) return NULL;
-
lv_task_ready(disp->refr_task); /*Be sure the screen will be refreshed immediately on start up*/
return disp;
