-
Notifications
You must be signed in to change notification settings - Fork 1.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
Fix reading 4-bit data #4454
Fix reading 4-bit data #4454
Conversation
There was a problem hiding this 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!
shared-module/bitmaptools/__init__.c
Outdated
@@ -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; |
There was a problem hiding this comment.
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
.
There was a problem hiding this 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.
One action has been stuck in "upload artifacts" for 4 hours. Gonna merge without green. |
Related to adafruit/Adafruit_CircuitPython_ImageLoad#47
An incorrect mask was being used when extracting 4-bit data from a file.