This code was conflating the need to adjust address offset with the rotation
calculation. The rotation calculation should be done in a coordinate
system equal to the display height and width. The address offset must be
done using a 'height' that represents the total number of addressable bytes
of memory configured.
I noticed this problem using the Adafruit 2.13" Monochrome eInk board, but I believe the issue will exist for most boards in this library. When using the setRotation function with values of 2 or 3 (180 or 270 degrees of rotation), the image is shifted off of the panel by a few pixels (6 pixels in the case of this board). Any board whose height is not a multiple of 8 will have this problem.
Below is a test program and an image that shows it running at rotations 0, 1, 2, and 3. The last two are shifted down too far. This patch fixes the issue. I don't have another board to test this on, but if I understand the problem correctly, this should work with all of the other boards as well.
This code was conflating the need to adjust address offset with the rotation calculation. The rotation calculation should be done in a coordinate system equal to the display height and width. The address offset must be done using a 'height' that represents the total number of addressable bytes of memory configured.
I noticed this problem using the Adafruit 2.13" Monochrome eInk board, but I believe the issue will exist for most boards in this library. When using the
setRotation
function with values of 2 or 3 (180 or 270 degrees of rotation), the image is shifted off of the panel by a few pixels (6 pixels in the case of this board). Any board whose height is not a multiple of 8 will have this problem.Below is a test program and an image that shows it running at rotations 0, 1, 2, and 3. The last two are shifted down too far. This patch fixes the issue. I don't have another board to test this on, but if I understand the problem correctly, this should work with all of the other boards as well.