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

Add default limit to OLED dirty processing #19068

Merged
merged 3 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/oled/oled_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define OLED_UPDATE_INTERVAL 50
#endif

#if !defined(OLED_UPDATE_PROCESS_LIMIT)
# define OLED_UPDATE_PROCESS_LIMIT 1
#endif

typedef struct __attribute__((__packed__)) {
uint8_t *current_element;
uint16_t remaining_element_count;
Expand Down
3 changes: 2 additions & 1 deletion drivers/oled/ssd1306_sh1106.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ void oled_render(void) {
oled_on();

uint8_t update_start = 0;
while (oled_dirty) { // render all dirty blocks
uint8_t dirty_count = 0;
while (oled_dirty && dirty_count++ < OLED_UPDATE_PROCESS_LIMIT) { // render all dirty blocks (up to the configured limit)
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
// Find next dirty block
while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) {
++update_start;
Expand Down