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: fix white screen on binary displays #4991

Merged
merged 1 commit into from Jun 22, 2023

Conversation

ayufan
Copy link
Contributor

@ayufan ayufan commented Jun 22, 2023

What does this implement/fix?

This a bug introduced by #4600.

It changed COLOR_OFF for reasons not related to the merged PR.
The potential problem with COLOR_OFF is steaming from sometimes
a wrong assumption that Color represents RGBA, where-as it does
in fact represents RGBW.

In case of some displays the W is considered as a white-level,
and binary displays expect the value of a pixel to be 0 for pixel to be off.
The binary pixel is checked via Color#is_on() which does look at this->raw_32 != 0.

This does not change how of transparent images are displayed on color/grayscale displays.
Since for transparent pixels are not render at all.

It does not fix rendering of the PNG images on binary displays (which is broken currently),
as incorrect luminance is used.

Types of changes

  • Bugfix (non-breaking change which fixes an issue): SSD1306 contrast issue since 2023.06 dev issues#4587
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Test Environment

  • ESP32: TTGO with LoRa, and SSD1306 (binary)
  • ESP32S3: Fly HALO with gc9a01 (RGB565)
  • ESP32 IDF
  • ESP8266
  • RP2040

Example entry for config.yaml:

esp32:

esphome:
  name: lora8

i2c:
  sda: SDA
  scl: SCL

logger:

font:
  - file: "gfonts://Roboto"
    id: roboto
    size: 20

image:
  - id: standby_image
    file: "rgb.png"
    resize: 128x64
    type: BINARY
    use_transparency: true

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.print(0, 0, id(roboto), "Hello World");
      it.image(0, 0, id(standby_image));

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

@randybb
Copy link

randybb commented Jun 22, 2023

For now tested with SSD1306 and it is working fine.SH1107 is still broken - like wrong init.

@ayufan
Copy link
Contributor Author

ayufan commented Jun 22, 2023

SH1107 is still broken - like wrong init

I guess, it is another issue :)

@nagyrobi
Copy link
Member

nagyrobi commented Jun 22, 2023

SH1107 (which is still driven by ssd1306 component; eg. FeatherWing OLED - 128x64) works with this patch:

  - source: github://bekriebel/esphome@sh1107_fix
    components:
      - ssd1306_base
      - ssd1306_i2c
      - ssd1306_spi

Anybody who has review capabilites would care to make a PR out of it?

@randybb
Copy link

randybb commented Jun 22, 2023

SH1107 is still broken - like wrong init

I guess, it is another issue :)

yea, I thought it was merged as I tested it a long time ago :D - so we need to wait for that PR.

@guillempages
Copy link
Contributor

guillempages commented Jun 22, 2023

Anybody who has review capabilites would care to make a PR out of it?

Actually you don't need review capabilities to create a PR; just to get it merged ;-)
so if @nikitakuklev or @bekriebel
has already a patch, it would be easiest if he/she creates the PR

Copy link
Contributor

@guillempages guillempages left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Seems to fix the issue (according to the feedback), and it does not break the transparency implementation.

@kbx81 kbx81 merged commit 85608a8 into esphome:dev Jun 22, 2023
25 checks passed
@jesserockz jesserockz added this to the 2023.6.1 milestone Jun 22, 2023
@jesserockz jesserockz mentioned this pull request Jun 22, 2023
@ayufan ayufan deleted the display-fix-white-screen branch June 22, 2023 20:51
@github-actions github-actions bot locked and limited conversation to collaborators Jun 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants