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

Incorrect calculation of color data size using bits_per_pixel for ST7789 LCD driver (IDFGH-8241) #9729

Closed
3 tasks done
MulattoKid opened this issue Sep 6, 2022 · 1 comment
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@MulattoKid
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v4.4.2 1b16ef6

Operating System used.

Linux

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

No response

Development Kit.

Custom Board

Power Supply used.

External 5V

What is the expected behavior?

When calling

static esp_err_t panel_st7789_draw_bitmap(esp_lcd_panel_t *panel, int x_start, int y_start, int x_end, int y_end, const void *color_data)
to write pixel data to the ST7789 display controller configured in 18bpp mode, 3 bytes should be written per pixel, both in SPI and 8-bit parallel interface mode.

What is the actual behavior?

I believe the way that the size of the color data to be transferred to the display is calculated in panel_st7789_draw_bitmap

size_t len = (x_end - x_start) * (y_end - y_start) * st7789->bits_per_pixel / 8;
is incorrect.

The ST7789 controller (and other similar ones) support both R5G6B5 (16bpp) and R6G6B6 (18bpp). In the case of 16bpp the calculation works fine as 16 / 8 = 2. However, for 18bpp, we still get 18 / 8 = 2, which is wrong; it should be 3. The specification states that each color component should occupy the 6 high bits of a byte, which means 3 full bytes are required.

Steps to reproduce.

  1. Configure the ST7789 driver to 18bpp mode
  2. Call panel_st7789_draw_bitmap
  3. Check the value of len in panel_st7789_draw_bitmap and see that it's not equal to pixel_count * 3bpp

Debug Logs.

No response

More Information.

No response

@MulattoKid MulattoKid added the Type: Bug bugs in IDF label Sep 6, 2022
@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 6, 2022
@github-actions github-actions bot changed the title Incorrect calculation of color data size using bits_per_pixel for ST7789 LCD driver Incorrect calculation of color data size using bits_per_pixel for ST7789 LCD driver (IDFGH-8241) Sep 6, 2022
@espressif-bot espressif-bot added Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new Status: In Progress Work is in progress labels Sep 7, 2022
@suda-morris
Copy link
Collaborator

@MulattoKid Nice catch! We will fix it ASAP.

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed Resolution: NA Issue resolution is unavailable labels Sep 8, 2022
antmak pushed a commit to antmak/dev-idf that referenced this issue Sep 12, 2022
espressif-bot pushed a commit that referenced this issue Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants