Fix bugs in the file selector screen and icon not being displayed correctly #31
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.
Requirements
This is a general MKS LVGL code update, not specific printer is required
Description
When using the WIFI's Cura plugin to upload a gcode file, the resulting file breaks the printer when listed on the SD-card.
Opening the file show that they are many difference between what the printer's firmware expect and what it gets.
For example, the file I get (see attachement) crash the printer when asked to list the file (in the "Print file" menu). It happens because the small image is 50x50 in the file and the code expect a 100x100. It also happens because the firmware is unable to deal with different new lines characters (which happens when using HTTP to send file) and expect fixed position data so it's seeking in the middle of nowhere when fetching a line.
This pull request replace the image parser with one that is a lot more resilient and it's able to deal with both 100x100 small images and 50x50 (in that case, it's zooming the picture by a factor 2x2).
In a future work, I'm wondering if it would not be even better to downscale the big picture (gimage) instead of upscaling the small image. In case you accept this change, I'll try to deal with this case as well so the displayed picture is top quality.
Also, I think the code that's creating a fake
.bin
file for LVGL is completely useless, it would be better to throw this code completely and let LVGL display the ".gcode" directly, that would reduce the flash code size and memory requirement by a lot of bytes (since you don't need to store temporary.bin
filename anymore, you don't need seeking/patching code, you don't need special cases, etc...) but this is not part of this patch.Benefits
With this PR, the printer no long crashes.
Related Issues
See attached file that's generated by Cura with MKS Wifi plugin and place it in the SD card. It'll crash the printer immediately when listed.
SP_MU~1.GCO.zip