@@ -95,7 +95,7 @@ static const char *TAG = "platform_jc3248w";
9595#define BUF_SIZE (1024)
9696#define I2C_MASTER_TIMEOUT_MS 1000
9797#define I2C_AXS15231B_ADDRESS (0x3B)
98-
98+ #define TRANS_DONE_TIMEOUT 100 //msec
9999typedef bool (* lvgl_port_wait_cb )(void * handle );
100100
101101static SemaphoreHandle_t I2CMutexHandle ;
@@ -106,7 +106,7 @@ static esp_lcd_panel_handle_t lcd_panel = NULL;
106106static esp_lcd_touch_handle_t tp = NULL ;
107107static esp_lcd_panel_io_handle_t tp_io_handle = NULL ;
108108static lv_indev_drv_t indev_drv ; // Input device driver (Touch)
109- static uint32_t trans_size = LCD_BUFFER_SIZE / 15 ;
109+ static uint32_t trans_size = LCD_BUFFER_SIZE / 5 ;
110110static lv_color_t * trans_buf_1 = NULL ;
111111static lv_color_t * trans_buf_2 = NULL ;
112112static lv_color_t * trans_act = NULL ;
@@ -448,13 +448,27 @@ static void lvgl_port_flush_callback(lv_disp_drv_t *drv, const lv_area_t *area,
448448 {
449449 draw_wait_cb (drv -> user_data );
450450 }
451- xSemaphoreGive (trans_done_sem );
451+
452+ if (xSemaphoreGive (trans_done_sem ) != pdTRUE )
453+ {
454+ //ESP_LOGE(TAG, "Transfer sempahore give timeout");
455+ }
452456 }
453457
454- xSemaphoreTake (trans_done_sem , portMAX_DELAY );
458+ if (xSemaphoreTake (trans_done_sem , pdMS_TO_TICKS (TRANS_DONE_TIMEOUT )) == pdTRUE )
459+ {
460+ esp_err_t res = esp_lcd_panel_draw_bitmap (panel_handle , x_draw_start , y_draw_start , x_draw_end + 1 , y_draw_end + 1 , to );
461+ if (res != ESP_OK )
462+ {
463+ ESP_LOGE (TAG , "Failed to draw bitmap %d" , res );
464+ }
465+ }
466+ else
467+ {
468+ ESP_LOGE (TAG , "Transfer sempahore take timeout" );
469+ break ;
470+ }
455471
456- esp_lcd_panel_draw_bitmap (panel_handle , x_draw_start , y_draw_start , x_draw_end + 1 , y_draw_end + 1 , to );
457-
458472 if (LV_DISP_ROT_90 == rotation_setting )
459473 {
460474 x_start_tmp += max_width ;
@@ -550,13 +564,13 @@ void platform_init(i2c_master_bus_handle_t bus_handle, SemaphoreHandle_t I2CMute
550564 lv_color_t * buf2 = NULL ;
551565 lv_color_t * buf3 = NULL ;
552566
553- buf1 = heap_caps_malloc ( LCD_BUFFER_SIZE * sizeof (lv_color_t ), MALLOC_CAP_SPIRAM );
567+ buf1 = heap_caps_aligned_alloc ( 32 , LCD_BUFFER_SIZE * sizeof (lv_color_t ), MALLOC_CAP_SPIRAM );
554568
555- buf2 = heap_caps_malloc ( trans_size * sizeof (lv_color_t ), MALLOC_CAP_SPIRAM );
569+ buf2 = heap_caps_aligned_alloc ( 32 , trans_size * sizeof (lv_color_t ), MALLOC_CAP_SPIRAM );
556570 assert (buf2 );
557571 trans_buf_1 = buf2 ;
558572
559- buf3 = heap_caps_malloc ( trans_size * sizeof (lv_color_t ), MALLOC_CAP_SPIRAM );
573+ buf3 = heap_caps_aligned_alloc ( 32 , trans_size * sizeof (lv_color_t ), MALLOC_CAP_SPIRAM );
560574 assert (buf3 );
561575 trans_buf_2 = buf3 ;
562576
0 commit comments