Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This branch reduces avoidable UI-time heap allocation in two hot paths:
OLEDDisplay::drawString()to scan the source string directly instead of copying it withstrdup()and splitting it withstrtok().Changes
ST7789 scanline buffer reuse
What changed:
_pixbufscratch buffer and_pixbuf_capacitytoST7789Spi.connect()when needed and reuses it acrossdisplay()calls.rtos_malloc()/rtos_free()calls from both ST7789display()code paths.Why:
display()was doing repeated heap allocation in a render hot path.OLED drawString heap removal
What changed:
strdup()+strtok()inOLEDDisplay::drawString()with direct pointer-based scanning overstrUser.c_str().Why:
drawString()previously allocated and copied the full input string on every call.Behavior
Expected behavior is unchanged aside from allocation strategy:
OLEDDisplay::drawString()still renders the same logical lines and alignment behavior as before.Benefit
These changes remove unnecessary heap allocation from two UI rendering paths.