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

Display ILI9341 red and blue values are reversed #318

Open
Mynogs opened this issue Nov 21, 2019 · 7 comments
Open

Display ILI9341 red and blue values are reversed #318

Mynogs opened this issue Nov 21, 2019 · 7 comments

Comments

@Mynogs
Copy link
Contributor

Mynogs commented Nov 21, 2019

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

@Mynogs
Copy link
Contributor Author

Mynogs commented Nov 21, 2019

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

@gmenier
Copy link

gmenier commented Dec 18, 2019

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

@Mynogs
Copy link
Contributor Author

Mynogs commented Dec 19, 2019

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.

@chowette
Copy link
Contributor

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 fbdf823 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 ?

@ghost
Copy link

ghost commented Jun 22, 2021

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?

@chowette
Copy link
Contributor

Done, see PR #393

@ghost
Copy link

ghost commented Jun 23, 2021

Thank you so much!

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

3 participants