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

Can't draw on LCD screen #463

Closed
obo opened this issue Apr 30, 2018 · 7 comments
Closed

Can't draw on LCD screen #463

obo opened this issue Apr 30, 2018 · 7 comments

Comments

@obo
Copy link

obo commented Apr 30, 2018

I'm trying to draw the smiley-frowney demo mentioned in #194 on the LCD screen of my EV3.

  • ev3dev version: 4.14.35-ev3dev-2.0.0-ev3
  • ev3dev-lang-python version: (don't know how to get, I'm rather new to python)

The demo code I used is this:

#!/usr/bin/env python3
# from https://github.com/ev3dev/ev3dev-lang-python/issues/194

from time import sleep
import ev3dev.auto as ev3

screen = ev3.Screen()

smile = True

while True:
    screen.clear()

    # Screen.draw returns a PIL.ImageDraw handle
    screen.draw.ellipse(( 20, 20,  60, 60))
    screen.draw.ellipse((118, 20, 158, 60))

    if smile:
        screen.draw.arc((20, 80, 158, 100), 0, 180)
    else:
        screen.draw.arc((20, 80, 158, 100), 180, 360)

    smile = not smile

    # Update lcd display
    screen.update()

    sleep(1)

I can run this from ssh using this trick:

sudo openvt -s -w -- sudo --user robot -- ./draw-smiley-frowney.py

The LCD goes blank, then quickly shows a tiny error message and I get Brickman again.

When I run the demo from Brickman, the error log is collected, so I can read the message:

robot@ev3dev:~/lego/random-bits$ cat draw-smiley-frowney.py.err.logTraceback (most recent call last):
  File "/home/robot/lego/random-bits/draw-smiley-frowney.py", line 26, in <module>
    screen.update()
  File "/usr/lib/python3/dist-packages/ev3dev/core.py", line 3325, in update
    raise Exception("Not supported")

(The simpler demo http://www.ev3dev.org/docs/tutorials/using-ev3-lcd/ behaves similarly, screen goes blank, debug prints get printed, no error is reported but nothing is drawn on screen.)

@obo
Copy link
Author

obo commented May 3, 2018

Just tested also your photo-booth:
https://github.com/dlech/ev3dev-photo-booth

The picture is taken and stored in the file but nothing appears on the LCD, not even the Smile! string.

The only error message I get is this:

** (brickrun:1826): CRITICAL **: brickrun.vala:100: Failed to send signal: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method 'SignalGroup'

@dlech
Copy link
Member

dlech commented May 5, 2018

Duplicate of #455

sudo openvt -s -w -- sudo --user robot -- ./draw-smiley-frowney.py

Better "trick":

brickrun ./draw-smiley-frowney.py

The only error message I get is this:

upgrade your packages

# make sure EV3 is connected to Internet
sudo apt update
sudo apt upgrade

@dlech
Copy link
Member

dlech commented May 5, 2018

Should be fixed in v1.2.0

ev3dev-lang-python version: (don't know how to get, I'm rather new to python)

dpkg -s python3-ev3dev | grep Version

@dlech
Copy link
Member

dlech commented May 5, 2018

Also, you can now use grayscale 😄

#!/usr/bin/env python3

from time import sleep

import ev3dev.auto as ev3

screen = ev3.Screen()

smile = True

while True:
    screen.clear()

    screen.draw.ellipse((20, 20, 60, 60))
    screen.draw.ellipse((30, 30, 50, 50), fill=128)
    screen.draw.ellipse((118, 20, 158, 60))
    screen.draw.ellipse((128, 30, 148, 50), fill=128)

    if smile:
        screen.draw.arc((20, 80, 158, 100), 0, 180)
    else:
        screen.draw.arc((20, 80, 158, 100), 180, 360)

    smile = not smile

    screen.update()

    sleep(1)

image

@dlech
Copy link
Member

dlech commented May 5, 2018

ev3dev-lang-python version: (don't know how to get, I'm rather new to python)

Also:

python3 -c 'import ev3dev.version; print(ev3dev.version.__version__)'

@obo
Copy link
Author

obo commented May 9, 2018

Yes, works with:

python3 -c 'import ev3dev.version; print(ev3dev.version.__version__)'
1.2.0

(At the first attempt of brickrun, the screen remained blank, but the second and subsequent attempts worked well.)

Wonderful grayscale!

@obo obo closed this as completed May 9, 2018
@dlech
Copy link
Member

dlech commented May 10, 2018

At the first attempt of brickrun, the screen remained blank

Please open a new issue at https://github.com/ev3dev/ev3dev/issues if this continues to be a problem.

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

No branches or pull requests

2 participants