lv_port_esp32 icon indicating copy to clipboard operation
lv_port_esp32 copied to clipboard

LVGL控件边缘出现莫名亮点

Open 15172072715 opened this issue 2 years ago • 4 comments

LVGL控件边缘出现莫名亮点,并且这样的问题会随着设置LVGL初始化时候的缓冲buff大小而改变点点的数量,当把缓冲减小的时候点点就会明显变多,buff越大,点点越小,我使用的是ESP32S3芯片,采用LVGL8.3模板,以下是buff设置大小不同的情况 512size 512display 1024size 1024display 4096size Uploading 4096display.jpg…

15172072715 avatar Jun 25 '22 09:06 15172072715

image 无论是在guider上面还是用模拟器都不存在点点的情况

15172072715 avatar Jun 26 '22 02:06 15172072715

As this is usually an issue tracker in English, it's absolutely suggested to speak English. Or more directly, you're supposed to speak English for better understanding from others, even using a translator.

fred913 avatar Feb 23 '23 15:02 fred913

This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 20 '23 03:04 stale[bot]

/中文 start**********/ 参考(https://www.esp32.com/viewtopic.php?f=25&t=28324&p=118360#p118360),已解决问题哈哈,这个问题卡了我半年 在函数void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map) 里最后 ili9488_send_color((void ) mybuf, size * 3); ili9488_send_color((void ) (&mybuf[(size * 3) - 3]), 3);//增加的,本质是将最后一个像素再发一次 heap_caps_free(mybuf); /中文 END********/

/English start**********/ thanks for(https://www.esp32.com/viewtopic.php?f=25&t=28324&p=118360#p118360) The problem has been solved. The problem has stuck me for half a year In function: void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map) ili9488_send_color((void *) mybuf, size * 3); ili9488_send_color((void *) (&mybuf[(size * 3) - 3]), 3);//need add. Essentially, you send the last pixel again heap_caps_free(mybuf);

/English END**********/

asd3330303 avatar Aug 09 '23 15:08 asd3330303

/中文 start**********/ 根因已找到了,是因为数据加入发送队列的之后,我们就free掉buffer了,所以存在野数据问题,野数据是导致亮点的原因。在发送和free之间加入disp_wait_for_pending_transactions();也可以解决这问题(弊端是会降低刷新率) 最下面的代码是完美解决方案 /中文 END********/

/English start**********/ The root cause has been found, because after the data is added to the send queue, we will free the buffer, so there is a wild data problem, wild data is the cause of the bright spot. Add disp_wait_for_pending_transactions() between send and free; It can also solve this problem (the disadvantage is that it will reduce the refresh rate)

The bottom code is the perfect solution

/English END**********/

void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
{
    uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);

    lv_color16_t *buffer_16bit = (lv_color16_t *) color_map;
    static uint8_t *mybuf = NULL;

    if (mybuf != NULL){
        disp_wait_for_pending_transactions();//等待发完后重新申请地址
        heap_caps_free(mybuf);
        mybuf = NULL;
    }

    do {
        mybuf = (uint8_t *) heap_caps_malloc(3 * size * sizeof(uint8_t), MALLOC_CAP_DMA);
        if (mybuf == NULL)  ESP_LOGW(TAG, "Could not allocate enough DMA memory!");
    } while (mybuf == NULL);

    uint32_t LD = 0;
    uint32_t j = 0;

    for (uint32_t i = 0; i < size; i++) {
        LD = buffer_16bit[i].full;
        mybuf[j] = (uint8_t) (((LD & 0xF800) >> 8) | ((LD & 0x8000) >> 13));
        j++;
        mybuf[j] = (uint8_t) ((LD & 0x07E0) >> 3);
        j++;
        mybuf[j] = (uint8_t) (((LD & 0x001F) << 3) | ((LD & 0x0010) >> 2));
        j++;
    }

	/* Column addresses  */
	uint8_t xb[] = {
	    (uint8_t) (area->x1 >> 8) & 0xFF,
	    (uint8_t) (area->x1) & 0xFF,
	    (uint8_t) (area->x2 >> 8) & 0xFF,
	    (uint8_t) (area->x2) & 0xFF,
	};
	
	/* Page addresses  */
	uint8_t yb[] = {
	    (uint8_t) (area->y1 >> 8) & 0xFF,
	    (uint8_t) (area->y1) & 0xFF,
	    (uint8_t) (area->y2 >> 8) & 0xFF,
	    (uint8_t) (area->y2) & 0xFF,
	};

	/*Column addresses*/
	ili9488_send_cmd(ILI9488_CMD_COLUMN_ADDRESS_SET);
	ili9488_send_data(xb, 4);

	/*Page addresses*/
	ili9488_send_cmd(ILI9488_CMD_PAGE_ADDRESS_SET);
	ili9488_send_data(yb, 4);

	/*Memory write*/
	ili9488_send_cmd(ILI9488_CMD_MEMORY_WRITE);

	ili9488_send_color((void *) mybuf, size * 3);
    
	// heap_caps_free(mybuf);
}

asd3330303 avatar Aug 09 '23 17:08 asd3330303