Skip to content

Update display for 4.14 kernel#462

Merged
ddemidov merged 4 commits intostretchfrom
display-4.14
May 20, 2018
Merged

Update display for 4.14 kernel#462
ddemidov merged 4 commits intostretchfrom
display-4.14

Conversation

@ddemidov
Copy link
Copy Markdown
Member

Tested on the latest (2018-04-22) stretch image. It works, and is indeed able to produce grayscale images:

from time import sleep
from ev3dev2.auto import Display, Sound
from ev3dev2 import fonts

Sound().beep()

d = Display()
d.clear()
d.draw.rectangle((10,10,60,20,), fill='black')
d.draw.rectangle((10,20,60,30,), fill='gray')
d.draw.text((10,40), 'Hello1', font=fonts.load('luBS14'), fill='black')
d.draw.text((10,50), 'Hello2', font=fonts.load('luBS14'), fill='gray')
d.draw.text((10,60), 'Hello3', font=fonts.load('luBS14'))
d.update()
sleep(5)

test

Fixes #455

Comment thread ev3dev2/display.py Outdated
im_type = "1"
elif self.var_info.bits_per_pixel == 16:
im_type = "RGB"
elif self.var_info.bits_per_pixel == 32:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm... we can probably get away with this since there aren't currently any other XRGB displays on ev3dev devices, but if there ever are, then they won't be usable in color.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do you suggest to use platform here instead of bits_per_pixel?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggest using both.

elif self.var_info.bits_per_pixel == 32:
    if platform == EV3:
        grayscale
    else:
        really 32-bit

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

69accdf does something similar. Tested on the EV3.

Comment thread ev3dev2/display.py Outdated
elif self.platform == "ev3" and self.var_info.bits_per_pixel == 32:
# Post 4.14 kernel
im_type = "L"
elif self.platform == "pistorms" and self.var_info.bits_per_pixel == 16:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please only check for the special case of platform on EV3. We use 16bpp on at least 3 different devices.

@dlech
Copy link
Copy Markdown
Member

dlech commented May 5, 2018

Why is the background yellow?

@ddemidov
Copy link
Copy Markdown
Member Author

ddemidov commented May 5, 2018

Probably just a side effect of fbcat followed by convert to png. The ev3 screen looks normal, but it also could be because 'x' in 'xrgb' is in the wrong position. Since we are now using same byte for all three components, we could also put it into 'x', since it's not used anyway.

@dlech
Copy link
Copy Markdown
Member

dlech commented May 5, 2018

I have a hunch that it is because of this line:

return ((v << 24) | (v << 16) | (v << 8))

this fills XRG and leaves B as 0, which would make yellow.

@ddemidov
Copy link
Copy Markdown
Member Author

ddemidov commented May 5, 2018

b18428b results in
test

@WasabiFan
Copy link
Copy Markdown
Member

I saw a comment elsewhere that this or a related fix was released already; what's the status here?

@ddemidov
Copy link
Copy Markdown
Member Author

This is waiting for an approval (I think it can be merged).

Copy link
Copy Markdown
Member

@dlech dlech left a comment

Choose a reason for hiding this comment

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

LGTM

@ddemidov ddemidov merged commit 70b7b44 into stretch May 20, 2018
@ddemidov ddemidov deleted the display-4.14 branch May 20, 2018 18:41
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.

3 participants