Skip to content

Commit 1872239

Browse files
committed
(fix) lvgl deinit on soft-reset
Include `lv_conf.h` in `mpconfigboard.h` so lvgl deinit is called on soft-reset, so calling `lvgl.deinit()` is no longer necessary. This closes #343
1 parent 44f70b1 commit 1872239

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

gen/gen_mpy.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,15 @@ def register_int_ptr_type(convertor, *types):
13651365
13661366
}
13671367
1368+
void mp_deinit_lvgl_mod()
1369+
{
1370+
1371+
if (MP_STATE_VM(lvgl_mod_initialized)) {
1372+
lv_deinit();
1373+
}
1374+
1375+
}
1376+
13681377
static mp_obj_t lvgl_mod___init__(void) {
13691378
if (!MP_STATE_VM(lvgl_mod_initialized)) {
13701379
// __init__ for builtins is called each time the module is imported,

lv_conf.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ extern void mp_lv_deinit_gc();
306306
#define LV_GC_INIT() mp_lv_init_gc()
307307
#define LV_GC_DEINIT() mp_lv_deinit_gc()
308308

309+
// include lv_conf.h in "mpconfigboard.h" for this to take effect.
310+
extern void mp_deinit_lvgl_mod();
311+
#define MICROPY_PORT_DEINIT_FUNC mp_deinit_lvgl_mod()
312+
309313
#define LV_ENABLE_GLOBAL_CUSTOM 1
310314
#if LV_ENABLE_GLOBAL_CUSTOM
311315
extern void *mp_lv_roots;

0 commit comments

Comments
 (0)