Skip to content

Commit

Permalink
Workaround for Linux build getting black screen on some computers.
Browse files Browse the repository at this point in the history
See issue for more details zephyrproject-rtos/zephyr#71410
Workaround is to run lv_task_handler from main thread and disable CONFIG_LV_Z_FLUSH_THREAD.
  • Loading branch information
jakkra committed May 31, 2024
1 parent 323e612 commit a309a33
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/boards/native_posix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ CONFIG_SPI_FLASH_LOADER=n
CONFIG_BT_EXT_ADV=n

CONFIG_SDL_DISPLAY_ZOOM_PCT=200
CONFIG_LV_Z_FLUSH_THREAD=n
4 changes: 4 additions & 0 deletions app/src/drivers/zsw_display_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,16 @@ void zsw_display_control_set_brightness(uint8_t percent)

static void lvgl_render(struct k_work *item)
{
// Workaround due to https://github.com/zephyrproject-rtos/zephyr/issues/71410
// we need to run lv_task_handler from main thread and disable CONFIG_LV_Z_FLUSH_THREAD
#ifndef CONFIG_BOARD_NATIVE_POSIX
const int64_t next_update_in_ms = lv_task_handler();
if (first_render_since_poweron) {
zsw_display_control_set_brightness(last_brightness);
first_render_since_poweron = false;
}
k_work_schedule(&lvgl_work, K_MSEC(next_update_in_ms));
#endif
}

static void set_brightness_level(uint8_t brightness)
Expand Down
10 changes: 10 additions & 0 deletions app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,16 @@ int main(void)
// it has the required amount of stack.
k_work_submit(&init_work);

// Workaround due to https://github.com/zephyrproject-rtos/zephyr/issues/71410
// we need to run lv_task_handler from main thread and disable CONFIG_LV_Z_FLUSH_THREAD
#ifdef CONFIG_BOARD_NATIVE_POSIX
int64_t next_update_in_ms;
while (true) {
next_update_in_ms = lv_task_handler();
k_msleep(next_update_in_ms);
}
#endif

return 0;
}

Expand Down

0 comments on commit a309a33

Please sign in to comment.