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

Fix reading 4-bit data #4454

Merged
merged 2 commits into from
Mar 22, 2021
Merged

Conversation

jepler
Copy link
Member

@jepler jepler commented Mar 21, 2021

Related to adafruit/Adafruit_CircuitPython_ImageLoad#47

An incorrect mask was being used when extracting 4-bit data from a file.

kmatch98
kmatch98 previously approved these changes Mar 21, 2021
Copy link
Collaborator

@kmatch98 kmatch98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. You beat me to it!

@@ -464,7 +464,7 @@ void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, pyb_file_obj_t *f
int byte_offset = x / 2;
int bit_offset = 4 * (reverse_pixels_in_element ? (1 - x % 2) : x % 2);

value = (rowdata8[byte_offset] >> bit_offset) & 7;
value = (rowdata8[byte_offset] >> bit_offset) & 15;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be more obvious if written as 0x0f.

Copy link
Collaborator

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this successfully with a Feather RP2040 and the imageload simpletest script. Confirmed this does resolve the issue.

@jepler
Copy link
Member Author

jepler commented Mar 22, 2021

One action has been stuck in "upload artifacts" for 4 hours. Gonna merge without green.

@jepler jepler merged commit a05aab8 into adafruit:main Mar 22, 2021
@jepler jepler deleted the bitmaptools-readinto-4bit branch November 3, 2021 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants