Skip to content

(fix) enable LV_USE_LOG #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gen/gen_mpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,11 @@ def register_int_ptr_type(convertor, *types):
int mp_lv_roots_initialized = 0;
int lvgl_mod_initialized = 0;

void mp_lv_log_cb(lv_log_level_t level, const char * buf){

mp_printf(&mp_plat_print, buf);
}

void mp_lv_init_gc()
{
if (!MP_STATE_VM(mp_lv_roots_initialized)) {
Expand Down
8 changes: 3 additions & 5 deletions lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,7 @@
*-----------*/

/*Enable the log module*/
#ifdef MICROPY_LV_USE_LOG
#define LV_USE_LOG MICROPY_LV_USE_LOG
#else
#define LV_USE_LOG 0
#endif
#define LV_USE_LOG 0

#if LV_USE_LOG

Expand All @@ -240,6 +236,8 @@
*0: User need to register a callback with `lv_log_register_print_cb()`*/
#define LV_LOG_PRINTF 0

#define LV_LOG_PRINT_CB mp_lv_log_cb

/*1: Enable print timestamp;
*0: Disable print timestamp*/
#define LV_LOG_USE_TIMESTAMP 1
Expand Down
1 change: 1 addition & 0 deletions micropython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if(ESP_PLATFORM)
idf_build_set_property(COMPILE_DEFINITIONS "-DLV_KCONFIG_IGNORE" APPEND)
idf_build_set_property(COMPILE_DEFINITIONS "${LV_CFLAGS}" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-Wno-unused-function" APPEND)
idf_build_set_property(COMPILE_OPTIONS "-Wno-format" APPEND)
idf_build_set_property(SRCS "${LV_SRC}" APPEND)
idf_build_set_property(INCLUDE_DIRS "${LV_INCLUDE}" APPEND)

Expand Down
Loading