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

Pico Display rotated 180 degree y axis is off by 1 #562

Closed
rtitmuss opened this issue Nov 5, 2022 · 1 comment
Closed

Pico Display rotated 180 degree y axis is off by 1 #562

rtitmuss opened this issue Nov 5, 2022 · 1 comment
Labels
[- pico display pack -] https://shop.pimoroni.com/products/pico-display-pack

Comments

@rtitmuss
Copy link

rtitmuss commented Nov 5, 2022

When the Pico Display is used with 180 degree rotation the y axis is off by one pixel. The top row is inaccessible, on power on it displays random values, or the previous row if you've configured the display with 0 degree rotation. The bottom row is not displayed.

The following test demonstrates the issue. The expected behaviour is:

  1. black screen
  2. green box
  3. black screen
  4. red box

Actual behaviour is:

  1. on boot top row shows random values, or later iterations red line
  2. top row shows the previous value, green line on second row and the bottom row is missing
  3. black screen
  4. red box
20221105_111328_2.mp4
from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY, PEN_P4
import time

MIN_X = 0
MAX_X = 239       
MIN_Y = 0
MAX_Y = 134

def draw_outline(rotate):
    display = PicoGraphics(display=DISPLAY_PICO_DISPLAY, pen_type=PEN_P4, rotate=rotate)

    RED = display.create_pen(255, 0, 0)
    GREEN = display.create_pen(0, 255, 0)
    BLACK = display.create_pen(0, 0, 0)

    display.set_pen(BLACK)
    display.clear()
    display.update()

    time.sleep(1)

    display.set_pen(RED if rotate == 0 else GREEN)
    display.line(MIN_X, MIN_Y, MAX_X, MIN_Y)
    display.line(MAX_X, MIN_Y, MAX_X, MAX_Y)
    display.line(MAX_X, MAX_Y, MIN_X, MAX_Y)
    display.line(MIN_X, MAX_Y, MIN_X, MIN_Y)
    display.update()

while True:
    draw_outline(180)
    time.sleep(1)
    
    draw_outline(0)
    time.sleep(1)
@ZodiusInfuser ZodiusInfuser added the [- pico display pack -] https://shop.pimoroni.com/products/pico-display-pack label Jan 20, 2023
Gadgetoid added a commit that referenced this issue Mar 15, 2024
Gadgetoid added a commit that referenced this issue Mar 18, 2024
Pico Display would have a pixel offset at 90 and 180 degree rotations.

Add a special case offset tweak for these, and demystify the rotate_180 variable.
@Gadgetoid
Copy link
Member

Took an embarrassingly long time to look into this, but I think I've got a fix - #912

I can't fathom why it needs a little 1px nudge on these rotations but I suspect it has something to do with the scan order and inclusive vs exclusive ranges.

Gadgetoid added a commit that referenced this issue Apr 11, 2024
Pico Display would have a pixel offset at 90 and 180 degree rotations.

Add a special case offset tweak for these, and demystify the rotate_180 variable.
Gadgetoid added a commit that referenced this issue Apr 17, 2024
Pico Display would have a pixel offset at 90 and 180 degree rotations.

Add a special case offset tweak for these, and demystify the rotate_180 variable.
thirdr pushed a commit that referenced this issue Apr 24, 2024
Pico Display would have a pixel offset at 90 and 180 degree rotations.

Add a special case offset tweak for these, and demystify the rotate_180 variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[- pico display pack -] https://shop.pimoroni.com/products/pico-display-pack
Projects
None yet
Development

No branches or pull requests

3 participants