From 663b432caeec3d12c00667abfb21bc64cba8762b Mon Sep 17 00:00:00 2001 From: Federico Osti <113505533+ostifede02@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:09:56 +0100 Subject: [PATCH] Update spi_lcd_touch_example_main.c Set uint32_t to int32_t. If lv_timer_handler() is called too fast, returns -1. If time_till_next_ms is unsigned, it becomes 0xFFFFFF... (very large). Therefore it overrides the threshold and code locks in usleep(). --- .../lcd/spi_lcd_touch/main/spi_lcd_touch_example_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 7388ae80b98..7611626a671 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 @@ -156,8 +156,8 @@ static void example_increase_lvgl_tick(void *arg) static void example_lvgl_port_task(void *arg) { ESP_LOGI(TAG, "Starting LVGL task"); - uint32_t time_till_next_ms = 0; - uint32_t time_threshold_ms = 1000 / CONFIG_FREERTOS_HZ; + int32_t time_till_next_ms = 0; + int32_t time_threshold_ms = 1000 / CONFIG_FREERTOS_HZ; while (1) { _lock_acquire(&lvgl_api_lock); time_till_next_ms = lv_timer_handler();