-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
SPI Flash Data Compression and Optimisation #18879
Merged
thinkyhead
merged 19 commits into
MarlinFirmware:bugfix-2.0.x
from
rhapsodyv:spi-flash-compression
Aug 4, 2020
Merged
SPI Flash Data Compression and Optimisation #18879
thinkyhead
merged 19 commits into
MarlinFirmware:bugfix-2.0.x
from
rhapsodyv:spi-flash-compression
Aug 4, 2020
Conversation
This file contains 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
…ports compression and uncomression on the fly! Tests with TFT_LVGL_UI showed 85% space optimization!
For EEPROM it's better if the data (while it fits) is uncompressed, and we only write the changes, and each piece of data has a definite position. It is still a future plan to make the EEPROM data more structured and to have each feature manage its own persistent settings without affecting other settings. |
thinkyhead
reviewed
Aug 4, 2020
Speaka
pushed a commit
to Speaka/Marlin
that referenced
this pull request
Aug 13, 2020
albertogg
pushed a commit
to albertogg/Marlin
that referenced
this pull request
Aug 31, 2020
vgadreau
pushed a commit
to vgadreau/Marlin
that referenced
this pull request
Dec 9, 2020
ahmetcemturan
pushed a commit
to ahmetcemturan/Marlin
that referenced
this pull request
Jan 21, 2021
ahmetcemturan
added a commit
to ahmetcemturan/Marlin
that referenced
this pull request
Jan 23, 2021
This reverts commit 9cf1050.
kageurufu
pushed a commit
to CR30-Users/Marlin-CR30
that referenced
this pull request
Apr 30, 2021
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.
Description
The LVGL UI use up to 2.9MB of icons plus 500kb of fonts. So, the board needs a big SPI Flash to hold all its assets.
This PR add a SPIFlashStorage class, that optimise and compress data stored to spi flash on the fly. To do it, it uses a simple but really fast compression method: RLE.
The compression method works with both 1 and 2 bytes buffers. In the current code, I'm using 2 bytes, because the LVGL images are 16bits. So, it benefits from the repeated colours in the background.
Restriction I followed: the uncompression code must not be slower than just loading the uncompressed data from SPI Flash.
Benefits
Before this PR, in a screen with 5 icons, it did need read 163840 bytes from SPI Flash (32kb*5). Now, it only reads in average 5K per icon, summing up to 25.600 bytes reads!! The uncompression method is O(n) - n=>uncompressed length, so its really fast, its just a memory copy.
Related Issues