Closed BrianPugh closed 1 year ago
Hi @BrianPugh,
I've uncovered this because in order to get the correct colors on my ILI9341 display, I have to:
- Set the
BGR
flag inMADCTL
.- Set the
self.disp_drv.color_format = lv.COLOR_FORMAT.NATIVE_REVERSE
I'm not sure why you think this indicates bugs in the St77x_hw.
Have a look at the ESP32 ILI9341 driver:
Here too, you can see that colormode=COLOR_MODE_BGR
and color_format=lv.COLOR_FORMAT.NATIVE_REVERSE
, so it makes sense you would need the same configuration.
With the current code as-is, this is an impossible configuration. Also, I'm not even sure if the current implementation logically makes sense, as it's "double applying" the color swap.
Could you explain why it's "impossible configuration"?
At least on ili9XXX.py
, it doesn't "double apply" the color swap. It configures everything and starts DMA:
(On ILI9488 it can be improved as it does some conversion, but not on ILI9341.)
Ok thanks for your response!
Could you explain why it's "impossible configuration"?
With the St77xx
code, it isn't a valid configuration based on how self.bgr
is interpreted. But what you said makes sense; I just wasn't confident enough to initially override it. I'll open up a PR soon!
@amirgon
I'm currently writing a generic ILI9341 display driver (color depth 16; RGB565) that inherits from
St77xx_hw
, and finally have it working, but I think there are some bugs in theSt77x_hw
implementation but don't have the hardware to test it. I've uncovered this because in order to get the correct colors on my ILI9341 display, I have to:BGR
flag inMADCTL
.self.disp_drv.color_format = lv.COLOR_FORMAT.NATIVE_REVERSE
With the current code as-is, this is an impossible configuration. Also, I'm not even sure if the current implementation logically makes sense, as it's "double applying" the color swap.
My solution currently, works, but I'm just wondering if the generic
St77xx_hw
code contains a bug.For reference, my current ILI9341 driver code is listed below. It could be that the
St77xx_hw
code is correct and somehow I'm double flipping something. For example, you'll notice I modified the rotation lookup; for portrait to render correctly I need to set_MADCTL_MX
.