From 80dc8af6ed5d62b148e7046350d0e18f3d5064d4 Mon Sep 17 00:00:00 2001 From: Decstar77 <34284628+Decstar77@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:37:37 +0200 Subject: [PATCH] fix(spi-lcd-touch-example): Fix for an infinite wait caused by UINT32_MAX --- .../spi_lcd_touch/main/spi_lcd_touch_example_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/peripherals/lcd/spi_lcd_touch/main/spi_lcd_touch_example_main.c b/examples/peripherals/lcd/spi_lcd_touch/main/spi_lcd_touch_example_main.c index ad5d8b1bfb..32ce7c152b 100644 --- a/examples/peripherals/lcd/spi_lcd_touch/main/spi_lcd_touch_example_main.c +++ b/examples/peripherals/lcd/spi_lcd_touch/main/spi_lcd_touch_example_main.c @@ -164,9 +164,15 @@ static void example_lvgl_port_task(void *arg) _lock_acquire(&lvgl_api_lock); time_till_next_ms = lv_timer_handler(); _lock_release(&lvgl_api_lock); - // in case of triggering a task watch dog time out - time_till_next_ms = MAX(time_till_next_ms, time_threshold_ms); - usleep(1000 * time_till_next_ms); + if ( time_till_next_ms == LV_NO_TIMER_READY ) { + //most probably lvgl display not ready yet + usleep( 1000 * 1000 ); + } + else { + // in case of triggering a task watch dog time out + time_till_next_ms = MAX(time_till_next_ms, time_threshold_ms); + usleep(1000 * time_till_next_ms); + } } }