Fix slow UI when DISPLAY_SLEEP_MINUTES is used #26964
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
My LCD became noticeably slower when I enabled DISPLAY_SLEEP_MINUTES.
This is because
refresh_screen_timeout()
is called on each encoder action, which results in this chain of calls:wake_display();
sleep_display(false);
sleep ? u8g.sleepOn() : u8g.sleepOff();
And either u8g call results in sending extra data to the LCD.
This PR keeps track of the state of the display and omits calls to u8g unless necessary.
Requirements
u8g display.
Benefits
Performant LCD with sleep timeout
Configurations
#define DISPLAY_SLEEP_MINUTES 2
Related Issues
Fixes #26467