Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LVGL控件边缘出现莫名亮点 #315

Open
15172072715 opened this issue Jun 25, 2022 · 4 comments
Open

LVGL控件边缘出现莫名亮点 #315

15172072715 opened this issue Jun 25, 2022 · 4 comments

Comments

@15172072715
Copy link

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

@15172072715
Copy link
Author

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

@stale
Copy link

stale bot commented Apr 20, 2023

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 stale bot added the stale This will not be worked on label Apr 20, 2023
@asd3330303
Copy link

asd3330303 commented Aug 9, 2023

/中文 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**********/

@stale stale bot removed the stale This will not be worked on label Aug 9, 2023
@asd3330303
Copy link

asd3330303 commented Aug 9, 2023

/中文 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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants