Skip to content

Commit

Permalink
Fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed May 27, 2023
1 parent ca3585b commit a22cd6a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ Let's use the Zig Compiler to compile `lv_label.c` from C to WebAssembly....

- Add `-DFAR=` (because we won't need Far Pointers)

- Add `-DLV_USE_LOG` (to enable logging)
- Add `-DLV_USE_LOG=1` (to enable logging)

- Add `-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE` (for detailed logging)

Expand Down Expand Up @@ -502,7 +502,7 @@ zig cc \
-rdynamic \
-lc \
-DFAR= \
-DLV_USE_LOG \
-DLV_USE_LOG=1 \
-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE \
-DLV_MEM_SIZE=1000000 \
"-DLV_ASSERT_HANDLER={void lv_assert_handler(void); lv_assert_handler();}" \
Expand Down Expand Up @@ -561,7 +561,7 @@ Let's ask Zig Compiler to link `lv_label.o` with our Zig LVGL App [`lvglwasm.zig
-rdynamic \
-lc \
-DFAR= \
-DLV_USE_LOG \
-DLV_USE_LOG=1 \
-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE \
-DLV_MEM_SIZE=1000000 \
"-DLV_ASSERT_HANDLER={void lv_assert_handler(void); lv_assert_handler();}" \
Expand Down
6 changes: 4 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ function build_zig {
-rdynamic \
-lc \
-DFAR= \
-DLV_USE_LOG \
-DLV_USE_LOG=1 \
-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE \
-DLV_LOG_TRACE_OBJ_CREATE=1 \
-DLV_MEM_SIZE=1000000 \
"-DLV_ASSERT_HANDLER={void lv_assert_handler(void); lv_assert_handler();}" \
-I . \
Expand Down Expand Up @@ -223,8 +224,9 @@ function compile_lvgl {
-rdynamic \
-lc \
-DFAR= \
-DLV_USE_LOG \
-DLV_USE_LOG=1 \
-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE \
-DLV_LOG_TRACE_OBJ_CREATE=1 \
-DLV_MEM_SIZE=1000000 \
"-DLV_ASSERT_HANDLER={void lv_assert_handler(void); lv_assert_handler();}" \
\
Expand Down
Binary file modified lvglwasm.wasm
Binary file not shown.
4 changes: 4 additions & 0 deletions lvglwasm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ pub export fn lv_demo_widgets() void {
);

// Register the Display Driver
debug("before lv_disp_drv_register", .{}); ////
const disp = c.lv_disp_drv_register(disp_drv);
debug("after lv_disp_drv_register", .{}); ////
_ = disp;

// Create the widgets for display (with Zig Wrapper)
Expand All @@ -74,7 +76,9 @@ pub export fn lv_demo_widgets() void {
// TODO: Call `lv_timer_handler()` every few milliseconds to handle LVGL related tasks
var i: usize = 0;
while (i < 10) : (i += 1) {
debug("lv_timer_handler: start", .{});
_ = c.lv_timer_handler();
debug("lv_timer_handler: end", .{});
}
}

Expand Down

0 comments on commit a22cd6a

Please sign in to comment.