Skip to content

Commit ad5a36c

Browse files
authored
(fix) enable LV_USE_LOG (#386)
1 parent fdb27aa commit ad5a36c

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

gen/gen_mpy.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,11 @@ def register_int_ptr_type(convertor, *types):
13451345
int mp_lv_roots_initialized = 0;
13461346
int lvgl_mod_initialized = 0;
13471347
1348+
void mp_lv_log_cb(lv_log_level_t level, const char * buf){
1349+
1350+
mp_printf(&mp_plat_print, buf);
1351+
}
1352+
13481353
void mp_lv_init_gc()
13491354
{
13501355
if (!MP_STATE_VM(mp_lv_roots_initialized)) {

lv_conf.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@
219219
*-----------*/
220220

221221
/*Enable the log module*/
222+
222223
#ifdef MICROPY_LV_USE_LOG
223-
#define LV_USE_LOG MICROPY_LV_USE_LOG
224+
#define LV_USE_LOG MICROPY_LV_USE_LOG
224225
#else
225226
#define LV_USE_LOG 0
226227
#endif
@@ -240,6 +241,8 @@
240241
*0: User need to register a callback with `lv_log_register_print_cb()`*/
241242
#define LV_LOG_PRINTF 0
242243

244+
#define LV_LOG_PRINT_CB mp_lv_log_cb
245+
243246
/*1: Enable print timestamp;
244247
*0: Disable print timestamp*/
245248
#define LV_LOG_USE_TIMESTAMP 1

micropython.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ if(ESP_PLATFORM)
1010
idf_build_set_property(COMPILE_DEFINITIONS "-DLV_KCONFIG_IGNORE" APPEND)
1111
idf_build_set_property(COMPILE_DEFINITIONS "${LV_CFLAGS}" APPEND)
1212
idf_build_set_property(COMPILE_OPTIONS "-Wno-unused-function" APPEND)
13+
idf_build_set_property(COMPILE_OPTIONS "-Wno-format" APPEND)
1314
idf_build_set_property(SRCS "${LV_SRC}" APPEND)
1415
idf_build_set_property(INCLUDE_DIRS "${LV_INCLUDE}" APPEND)
1516

0 commit comments

Comments
 (0)