esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

ili9431 display colors inverted on M5Stack Core #3624

Open lancepuk opened 1 year ago

lancepuk commented 1 year ago

The problem

All colors are inverted

Color used in code / Expected / Color shown on display COLOR_BLACK / Black / White COLOR_WHITE / White / Black Color(1,0,0) / Red / Purple Color(0,1,0) / Green / orange Color(0,0,1) / Blue / Light Blue

Which version of ESPHome has the issue?

2022.9.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

Home Assistant 2022.9.0

What platform are you using?

ESP32

Board

M5stack Core (2018.3)

Component causing the issue

https://esphome.io/components/display/ili9341.html

Example YAML snippet

display:
  - platform: ili9341
    model: M5Stack
    cs_pin: 14
    dc_pin: 27
    led_pin: 32 
    reset_pin: 33
    rotation: 0
    lambda: |-

      it.rectangle(1, 1, 318, 238);
      it.line(1, 26, 318, 26);

      it.strftime(160, 2, id(font_roboto_medium22), TextAlign::TOP_CENTER, "%X", id(homeassistant_time).now());
      it.printf(it.get_width() / 50, 50, id(font_roboto_medium22), my_red,  TextAlign::LEFT, "Temperature: %.1f°C", id(T).state);      
      it.graph(2, 110, id(single_temperature_graph), my_blue);

graph:

  - id: single_temperature_graph
    sensor: T
    line_type: DOTTED
    duration: 1h
    x_grid: 10min
    y_grid: 1.0      
    width: 316
    height: 100
    max_range: 50

Anything in the logs that might be useful for us?

No response

Additional information

the ESPHome driver for the ili9342 display is hardcoded to invert the display on the M5 Stack

esphome\components\ili9341\ili9341_display.cpp

// M5Stack display void ILI9341M5Stack::initialize() { this->initlcd(INITCMDM5STACK); this->width = 320; this->height_ = 240; this->invertdisplay(true); }

// 24_TFT display void ILI9341TFT24::initialize() { this->initlcd(INITCMDTFT); this->width = 240; this->height_ = 320; }

// 24_TFT rotated display void ILI9341TFT24R::initialize() { this->initlcd(INITCMDTFT); this->width = 320; this->height_ = 240; }

This problem has been reported before, but there is no fix yet. https://github.com/esphome/issues/issues/1893

github-actions[bot] commented 1 year ago

This issue 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.