diff --git a/.github/workflows/micropython_lvgl_ci.yml b/.github/workflows/micropython_lvgl_ci.yml index 5f7039345d..ed059a8079 100644 --- a/.github/workflows/micropython_lvgl_ci.yml +++ b/.github/workflows/micropython_lvgl_ci.yml @@ -83,12 +83,14 @@ jobs: make -j $(nproc) -C ports/rp2 BOARD=RPI_PICO USER_C_MODULES=../../user_modules/lv_binding_micropython/micropython.cmake # ESP32 port + # USER_C_MODULES defined in esp32_common.cmake - name: Build esp32 port if: matrix.port == 'esp32' run: | source tools/ci.sh && ci_esp32_idf_setup source tools/ci.sh && ci_esp32_build_common - make -C ports/esp32 BOARD=ESP32_GENERIC_S3 USER_C_MODULES=../../user_modules/lv_binding_micropython/micropython.cmake + make -C ports/esp32 BOARD=ESP32_GENERIC_S3 + # Unix port - name: Build unix port diff --git a/gen/gen_mpy.py b/gen/gen_mpy.py index 105c8032bb..b90d2ff5df 100644 --- a/gen/gen_mpy.py +++ b/gen/gen_mpy.py @@ -1362,11 +1362,23 @@ def register_int_ptr_type(convertor, *types): void mp_lv_deinit_gc() { - // mp_printf(&mp_plat_print, "[ DEINIT GC ]"); - mp_lv_roots = MP_STATE_VM(mp_lv_roots) = NULL; - mp_lv_user_data = MP_STATE_VM(mp_lv_user_data) = NULL; - mp_lv_roots_initialized = MP_STATE_VM(mp_lv_roots_initialized) = 0; - lvgl_mod_initialized = MP_STATE_VM(lvgl_mod_initialized) = 0; + + if (MP_STATE_VM(lvgl_mod_initialized)) { + // mp_printf(&mp_plat_print, "[ DEINIT GC ]"); + mp_lv_roots = MP_STATE_VM(mp_lv_roots) = NULL; + mp_lv_user_data = MP_STATE_VM(mp_lv_user_data) = NULL; + mp_lv_roots_initialized = MP_STATE_VM(mp_lv_roots_initialized) = 0; + lvgl_mod_initialized = MP_STATE_VM(lvgl_mod_initialized) = 0; + } + +} + +void mp_deinit_lvgl_mod() +{ + + if (MP_STATE_VM(lvgl_mod_initialized)) { + mp_lv_deinit_gc(); + } } diff --git a/include/lv_mp_port_soft_reset.h b/include/lv_mp_port_soft_reset.h new file mode 100644 index 0000000000..f4d6828831 --- /dev/null +++ b/include/lv_mp_port_soft_reset.h @@ -0,0 +1,5 @@ + + +extern void mp_deinit_lvgl_mod(); +#define MICROPY_PORT_DEINIT_FUNC mp_deinit_lvgl_mod() + diff --git a/lv_conf.h b/lv_conf.h index d5ad011a80..c21e3a24f7 100644 --- a/lv_conf.h +++ b/lv_conf.h @@ -434,6 +434,9 @@ extern void mp_lv_deinit_gc(); #define LV_GC_INIT() mp_lv_init_gc() #define LV_GC_DEINIT() mp_lv_deinit_gc() +// To enable deinit on soft-reset add in mpconfigboard.h +// #include + #define LV_ENABLE_GLOBAL_CUSTOM 1 #if LV_ENABLE_GLOBAL_CUSTOM extern void *mp_lv_roots;