Skip to content

Commit 41a0bc6

Browse files
committed
moves calling of flush_ready callback to the main task.
This should keep LVGL from using a spinning wheels to stall. Instead, the main task will yield so other tasks are able to run.
1 parent c08083a commit 41a0bc6

File tree

2 files changed

+32
-29
lines changed

2 files changed

+32
-29
lines changed

ext_mod/lcd_bus/esp32_src/rgb_bus.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,9 @@
476476
self->rotation = rotation;
477477

478478
rgb_bus_lock_release(&self->copy_lock);
479+
if (self->callback != mp_const_none) {
480+
mp_call_function_n_kw(self->callback, 0, 0, NULL);
481+
}
479482

480483
return LCD_OK;
481484
}

ext_mod/lcd_bus/esp32_src/rgb_bus_rotation.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -253,35 +253,35 @@
253253

254254
rgb_bus_lock_release(&self->tx_color_lock);
255255

256-
if (self->callback != mp_const_none) {
257-
volatile uint32_t sp = (uint32_t)esp_cpu_get_sp();
258-
259-
void *old_state = mp_thread_get_state();
260-
261-
mp_state_thread_t ts;
262-
mp_thread_set_state(&ts);
263-
mp_stack_set_top((void*)sp);
264-
mp_stack_set_limit(CONFIG_FREERTOS_IDLE_TASK_STACKSIZE - 1024);
265-
mp_locals_set(mp_state_ctx.thread.dict_locals);
266-
mp_globals_set(mp_state_ctx.thread.dict_globals);
267-
268-
mp_sched_lock();
269-
gc_lock();
270-
271-
nlr_buf_t nlr;
272-
if (nlr_push(&nlr) == 0) {
273-
mp_call_function_n_kw(self->callback, 0, 0, NULL);
274-
nlr_pop();
275-
} else {
276-
ets_printf("Uncaught exception in IRQ callback handler!\n");
277-
mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val));
278-
}
279-
280-
gc_unlock();
281-
mp_sched_unlock();
282-
283-
mp_thread_set_state(old_state);
284-
}
256+
// if (self->callback != mp_const_none) {
257+
// volatile uint32_t sp = (uint32_t)esp_cpu_get_sp();
258+
//
259+
// void *old_state = mp_thread_get_state();
260+
//
261+
// mp_state_thread_t ts;
262+
// mp_thread_set_state(&ts);
263+
// mp_stack_set_top((void*)sp);
264+
// mp_stack_set_limit(CONFIG_FREERTOS_IDLE_TASK_STACKSIZE - 1024);
265+
// mp_locals_set(mp_state_ctx.thread.dict_locals);
266+
// mp_globals_set(mp_state_ctx.thread.dict_globals);
267+
//
268+
// mp_sched_lock();
269+
// gc_lock();
270+
//
271+
// nlr_buf_t nlr;
272+
// if (nlr_push(&nlr) == 0) {
273+
// mp_call_function_n_kw(self->callback, 0, 0, NULL);
274+
// nlr_pop();
275+
// } else {
276+
// ets_printf("Uncaught exception in IRQ callback handler!\n");
277+
// mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val));
278+
// }
279+
//
280+
// gc_unlock();
281+
// mp_sched_unlock();
282+
//
283+
// mp_thread_set_state(old_state);
284+
// }
285285

286286
if (last_update) {
287287

0 commit comments

Comments
 (0)