koenvervloesem/M5Stack-Air-Quality-ESPHome

m5stack_air_quality.yaml not giving expected result: display not working

screenagerbe opened this issue · 1 comments

When uploading the firmware based on your m5stack_air_quality.yaml my M5stack display stays black. The backlight is working and the device is also recognized by Home-Assistant and my router though. The middle button is switching off the display too. So everything is working okay, except for the display.

To get the display to work I had to define the colors like this:

color:
  - id: RED
    red: 100%
    green: 0%
    blue: 0%
  - id: BLUE
    red: 0%
    green: 0%
    blue: 100%
  - id: WHITE
    red: 100%
    green: 100%
    blue: 100%

and remove the old color definitions in the lambda

display:
  - platform: ili9341
    id: m5stack_display
    model: M5Stack
    cs_pin: 14
    dc_pin: 27
    led_pin: 32
    reset_pin: 33
    rotation: 0
    lambda: |-
      it.rectangle(0,  0, it.get_width(), it.get_height(), BLUE);
      it.rectangle(0, 22, it.get_width(), it.get_height(), BLUE);   // header bar
      it.print(it.get_width() / 2, 11, id(font_roboto_medium22), RED, TextAlign::CENTER, "Particulate matter");
      [...]

Ah yes, I changed it in my other M5Stack project, but forgot it here. Thanks for pointing this out!