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

[help-needed] MKS TFT thumbnails #3387

Draft
wants to merge 89 commits into
base: master
Choose a base branch
from

Conversation

adripo
Copy link

@adripo adripo commented Oct 30, 2022

Implementation of MKS TFT thumbnails for other printers than Biqu.
I was inspired by this PR ArtificalSUN/MKS-WIFI_PS_uploader#5 but I don't have much experience in c++.

I would like to get some help to convert the logic that can be found here:
https://github.com/Jeredian/mks-wifi-plugin/blob/develop/MKSPreview.py#L21
and here
https://github.com/SH1NZ33/MKS-WIFI_PS_uploader/blob/patch-1/MKS_WIFI_PS_upload.pyw#L31

For the moment I copied the conversion from Biqu.
The sections that need to be checked and edited are:

I can test any file on my FlyingBear 4S.

fix #3064

LuckyTurtleDev and others added 30 commits July 19, 2022 20:12
fix createrelease as the mac arm can't be compiled on github anymore
Added a piece of code into handle_legacy to check for aliases.
'.mf3 files won't open 2.4.58.3' supermerill#2939
…one click instead of two (recovering the old behavior).
Mitigation: remove shallow angles that seems to make it appear.
As the previous remove_colinear was on a fixed dist (taht became too small on long segments)
I created a new one that work from an angle.
supermerill#2971
And fix for the visualization of the spiral start.
supermerill and others added 21 commits September 16, 2022 16:13
fix refresh for float/&percent
fixed ask_for_refresh() for non-bool
supermerill#3175
(maybe still some quirks for raft with many extruders).
@adripo
Copy link
Author

adripo commented Oct 30, 2022

The previews are visible, but the colors are not correct. Here are some examples:

original:
image

preview:
photo_2022-10-30_22-33-05

thumbnail:
photo_2022-10-30_22-33-08

@adripo adripo changed the title TFT thumbnails [help-needed] TFT thumbnails Oct 30, 2022
@adripo adripo changed the title [help-needed] TFT thumbnails [help-needed] MKS TFT thumbnails Oct 30, 2022
@supermerill
Copy link
Owner

can you try instead of

            uint16_t pixel = 0;
            //r
            pixel |= uint16_t((rgba_pixels[y * row_size + x * 4 + 0 ] & 0x000000F8) >> 3);
            //g
            pixel |= uint16_t((rgba_pixels[y * row_size + x * 4 + 1 ] & 0x000000FC) << 3);
            //b
            pixel |= uint16_t((rgba_pixels[y * row_size + x * 4 + 2 ] & 0x000000F8) << 8);
            tohex << std::setw(4) << pixel;

to use

            uint16_t pixel = 0;
            //r
            pixel |= uint16_t(((rgba_pixels[y * row_size + x * 4 + 0 ] & 0x000000FF) >> 3) << 11);
            //g
            pixel |= uint16_t(((rgba_pixels[y * row_size + x * 4 + 1 ] & 0x000000FF)  >> 2) <<5);
            //b
            pixel |= uint16_t((rgba_pixels[y * row_size + x * 4 + 2 ] & 0x000000FF) >> 3);
            tohex << std::setw(4) << pixel;

supermerill pushed a commit that referenced this pull request Jan 6, 2023
@supermerill
Copy link
Owner

also it seems you didn't pushed a working version, as it doesn't compile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MKS Thumbnail Support?