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

Don't reinit i2c LCDs #27194

Merged

Conversation

dbuezas
Copy link
Contributor

@dbuezas dbuezas commented Jun 21, 2024

Description

LCDs are restarted when the SD CARD is inserted or released. From what I can gather, this is because SPI LCDs share pins with the the sd card, which introduces noise in the lines and the LCD draws gibberish.
This cannot be the case for i2c displays, and it adds a visibly long delay when:

  • The SD Card is inserted/removed
  • The user enters the main menu.

This PR disables unnecessary LCD reinits for i2c displays.

I'm not sure if the way I detect i2c displays is the best one, I couldn't find anything more explicit

Requirements

I2C LCD and SDCARD

Benefits

Snappier UI

Configurations

Related Issues

@dbuezas dbuezas force-pushed the dbuezas/dont-reinit-i2c-lcds branch 3 times, most recently from c852f2e to 9a1d7ed Compare June 21, 2024 18:17
# Conflicts:
#	Marlin/src/inc/Conditionals_post.h
@dbuezas dbuezas force-pushed the dbuezas/dont-reinit-i2c-lcds branch from 9a1d7ed to 815d6f9 Compare June 21, 2024 18:18
@dbuezas
Copy link
Contributor Author

dbuezas commented Jun 21, 2024

Before

  • Black screens on card insertion and when opening the main menu
before.mp4

After

  • Faster and no black screen interruptions
after.mp4

@thinkyhead
Copy link
Member

The current conditions based on certain displays being immune is obviously unwieldy. Eventually we could more directly compare the MOSI pin for the LCD to the MOSI pin for the SD card and only reinit when they match. Also there is a pending LCD pins refactor, and there each LCD model will be able to set appropriate flags for its particular quirks.

@dbuezas
Copy link
Contributor Author

dbuezas commented Jun 22, 2024

The current conditions based on certain displays being immune is obviously unwieldy

100% but still better than what I did checking the U8GPARAM. I thought those lcds could also work in SPI mode.
Actually, the ssd1309 itself can.

Also there is a pending LCD pins refactor

Looking forward to it. I have multiple hacks to get software i2c working with different busses at good speed

@dbuezas
Copy link
Contributor Author

dbuezas commented Jun 22, 2024

I just found HAS_U8GLIB_I2C_OLED in Conditionals_LCD.h, that one may be slightly more clear

#if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106)
  #define HAS_U8GLIB_I2C_OLED 1
  #define HAS_WIRED_LCD 1
  #define DOGLCD
#endif

@thinkyhead thinkyhead merged commit 7b21cd5 into MarlinFirmware:bugfix-2.1.x Jun 26, 2024
62 checks passed
@dbuezas
Copy link
Contributor Author

dbuezas commented Jun 27, 2024

1f9fc66 accidentally reverted these changes, was that accidental?

@dbuezas dbuezas mentioned this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants