Lua-RTOS-ESP32 icon indicating copy to clipboard operation
Lua-RTOS-ESP32 copied to clipboard

Display ILI9341 red and blue values are reversed

Open Mynogs opened this issue 6 years ago • 7 comments

{255, 0, 0} produces blue, {0, 0, 255} produces red

Mynogs avatar Nov 21 '19 11:11 Mynogs

Ok. It looks the different versions of the M5STACK blocks have different wiring.

Black version: {255, 0, 0} produces blue, {0, 255, 0} produces green {0, 0, 255} produces red

Red version {0, 0, 0} produces white {255, 255, 255} produces black {255, 255, 0} produces red {255, 0, 255, 0} produces green {0, 255, 255} produces blue

Mynogs avatar Nov 21 '19 14:11 Mynogs

Same Here. Screen Mirrored and color (kind-of) reversed. Sparkfun. Last update with wcc.

gmenier avatar Dec 18 '19 10:12 gmenier

I think we have two options:

  • The color mapping is in the configuration for the board. Now means three different types for the M5STACK: black, gray and red.
  • We configure the color mapping with your own command (similar to e.g. gdisplay.invert()) gdisplay.colormapping()

Suggestion:

gdisplay.colormapping({rbitstart, rbitend, rinv},{gbitstart, gbitend, ginv},{bbitstart, bbitend, binv})
?bitstart: bitnumber start
?bitend: bitnumber end
?inv: invert bits (option)

Disadvantage: all color constants like gdisplay.BLACK have to be implemented differently.

Mynogs avatar Dec 19 '19 06:12 Mynogs

Hi there,

I Have 2 different ILI9341 screens :

  1. QVGA 240x320: QVGA

  2. 2.4 TFT SPI 240x320

2.4 TFT

I had to patch the ili9341 driver to get correct colors (BGR) and not mirrored display.

I don't know how to make my changes so they benefit others. I see different options:

  1. Make this 2 modifications
  • Add a _MIRROR variant to the orientation flag. Then there will be 4 new flags like gdisplay.LANDSCAPE_MIRROR ... gdisplay.PORTRAIT_FLIP_MIRROR https://github.com/whitecatboard/Lua-RTOS-ESP32/wiki/GDISPLAY-module#gdisplaysetorientorientation But I do not know how to implement that for other drivers (except ST7735* who share most of the code with the ILI9341). Care must be taken for the touch orientation also.
  • Add a gdisplay.colormapping() as you suggest, But I don't know how to implement that for other drivers.
  1. Make a new drivers called ILI9341_BGR, ILI9341_MIRROR and ILI9341_BGR_MIRROR

  2. Add some compile time options like in this patch https://github.com/whitecatboard/Lua-RTOS-ESP32/pull/271/commits/fbdf82382936044ad1be6094228b3870798dc3fc from @c-logic

  3. Add some parameters to the gdisplay.attach() function

My personal preference goes for a new driver ILI9341_BGR and new orientation flags *_MIRROR

What do you think ?

chowette avatar Aug 19 '20 11:08 chowette

Hi there,

I Have 2 different ILI9341 screens :

1. QVGA 240x320:
   ![QVGA](https://camo.githubusercontent.com/0c9f93cd0e6a7559b2185d081ac10005ba88ff75a8c1984813f503326dcb8291/68747470733a2f2f63646e2e696e73747275637461626c65732e636f6d2f46364b2f4845374e2f485639465738394d2f46364b4845374e485639465738394d2e4d454449554d2e6a7067)

2. 2.4 TFT SPI 240x320

2.4 TFT

I had to patch the ili9341 driver to get correct colors (BGR) and not mirrored display.

I don't know how to make my changes so they benefit others. I see different options:

1. Make this 2 modifications


* Add a `_MIRROR `variant to the orientation flag. Then there will be 4 new flags like `gdisplay.LANDSCAPE_MIRROR`  ... `gdisplay.PORTRAIT_FLIP_MIRROR` https://github.com/whitecatboard/Lua-RTOS-ESP32/wiki/GDISPLAY-module#gdisplaysetorientorientation But I do not know how to implement that for other drivers (except ST7735* who share most of the code with the ILI9341). Care must be taken for the touch orientation also.

* Add a `gdisplay.colormapping()` as you suggest, But I don't know how to implement that for other drivers.


1. Make a new drivers called `ILI9341_BGR`, `ILI9341_MIRROR` and `ILI9341_BGR_MIRROR`

2. Add some compile time options like in this patch [fbdf823](https://github.com/whitecatboard/Lua-RTOS-ESP32/commit/fbdf82382936044ad1be6094228b3870798dc3fc) from @c-logic

3. Add some parameters to the `gdisplay.attach()` function

My personal preference goes for a new driver ILI9341_BGR and new orientation flags *_MIRROR

What do you think ?

Could you please share the code to correct the mirrored screen?

ghost avatar Jun 22 '21 16:06 ghost

Done, see PR #393

chowette avatar Jun 23 '21 08:06 chowette

Thank you so much!

ghost avatar Jun 23 '21 15:06 ghost