|
253 | 253 |
|
254 | 254 | rgb_bus_lock_release(&self->tx_color_lock); |
255 | 255 |
|
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 | + } |
285 | 285 |
|
286 | 286 | if (last_update) { |
287 | 287 |
|
|
0 commit comments