Skip to content

Conversation

@matemaciek
Copy link
Contributor

@matemaciek matemaciek commented Mar 12, 2021

#109 Rebased over current master.

fixes #104

rm-hull and others added 2 commits March 12, 2021 16:36
Co-authored-by: Richard Hull <rm_hull@yahoo.co.uk>
@matemaciek matemaciek changed the base branch from feature/st7789 to master March 12, 2021 20:06
Copy link
Collaborator

@thijstriemstra thijstriemstra left a comment

Choose a reason for hiding this comment

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

thanks!

super(st7789, self).__init__(luma.lcd.const.st7789, serial_interface, **kwargs)
self.capabilities(240, 240, rotate, mode="RGB")

self.command(0x36)
Copy link
Owner

Choose a reason for hiding this comment

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

I think it may be possible to combine:

self.command(0x36)
self.data([0x70])

into:

self.command(0x36, 0x70)

have a look at the implementation for command for more details

Copy link
Owner

Choose a reason for hiding this comment

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

Also it would be quite nice to document each command, eg like: https://github.com/rm-hull/luma.lcd/blob/master/luma/lcd/device.py#L460-L482

Also here you can see the combined command/data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I like this combined syntax more, I wonder why author of the original PR went that way.

Copy link
Owner

@rm-hull rm-hull left a comment

Choose a reason for hiding this comment

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

Great effort @matemaciek! it would good to get this in "as-is" (with the PR comments resolved), and then look at another PR with an improved implementation that makes use of the framebuffering for better performance (see https://github.com/rm-hull/luma.lcd/blob/master/luma/lcd/device.py#L501-L508 for example)

@matemaciek
Copy link
Contributor Author

Glad you like it (-:

Let me implement review remarks.

@matemaciek matemaciek requested a review from rm-hull March 13, 2021 19:16
@matemaciek
Copy link
Contributor Author

matemaciek commented Mar 13, 2021

OK, significant speedup is on the way

@matemaciek
Copy link
Contributor Author

examples/perfloop.py on Pi Zero has ~10.5fps with this version.

@thijstriemstra
Copy link
Collaborator

examples/perfloop.py on Pi Zero has ~10.5fps with this version.

And before?

@matemaciek
Copy link
Contributor Author

<1fps

@thijstriemstra thijstriemstra changed the title feature/st7789 Add support for ST7789 Mar 13, 2021
@rm-hull rm-hull merged commit 093e53f into rm-hull:master Mar 14, 2021
@iceman1001
Copy link

Love this!
Is it possible to install this with pip ?

sudo python3 -m pip install --upgrade luma.lcd seem to install the 2020 December release.

@matemaciek
Copy link
Contributor Author

I think there has been no release yet, it should land in 2.9.0

@iceman1001
Copy link

Hm, can't find a release schedule...
Looks like I have to clone and install it..

@thijstriemstra
Copy link
Collaborator

release schedule is in CHANGES.md. It'll be released within a few days I expect.

@iceman1001
Copy link

no problem , I installed it locally. Excited to test it out. Been having this waveshare shield for some time and no easy way to use it.

@matemaciek
Copy link
Contributor Author

I developed on waveshare shield to, let me share some commands...

@matemaciek
Copy link
Contributor Author

Running examples from luma.examples:
python3 examples/bounce.py -i spi -d st7789 --gpio-reset 27 --gpio-data-command 25 --gpio-backlight 24 --backlight-active high --spi-bus-speed 52000000

Python:

from PIL import Image
import luma.core.interface.serial
import luma.lcd.device
image = Image.open("/home/pi/logo.png").resize((240,240))
serial = luma.core.interface.serial.spi(gpio_DC=25, gpio_RST=27, bus_speed_hz=52000000)
device = luma.lcd.device.st7789(serial, gpio_LIGHT=24, active_low=False)
device.display(image)

@thijstriemstra
Copy link
Collaborator

@matemaciek can you add that config to luma.examples/config/ ?

@matemaciek
Copy link
Contributor Author

Sure! Also just testing on pi 4, ~21.5fps \o/

@iceman1001
Copy link

odd.. is there a discord where we can chat? I don't want to pollute this closed issue..

pi@raspberrypi:~/luma.lcd $  python3 setup.py build
pi@raspberrypi:~/luma.lcd $  sudo python3 setup.py install
....

pi@raspberrypi:~/luma.lcd $  python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import luma.lcd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'luma.lcd'
>>>

@matemaciek
Copy link
Contributor Author

I install with sudo python3 setup.py develop

@rm-hull
Copy link
Owner

rm-hull commented Mar 14, 2021

@thijstriemstra im trying to upload to pypi, but fails .. any ideas:

$ python3 setup.py clean sdist bdist_wheel upload -r pypi
running clean
running sdist
running egg_info
writing luma.lcd.egg-info/PKG-INFO
writing dependency_links to luma.lcd.egg-info/dependency_links.txt
writing namespace_packages to luma.lcd.egg-info/namespace_packages.txt
writing requirements to luma.lcd.egg-info/requires.txt
writing top-level names to luma.lcd.egg-info/top_level.txt
reading manifest file 'luma.lcd.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'doc/_build'
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
warning: no previously-included files matching '*~' found under directory '*'
warning: no previously-included files matching '.coverage' found under directory '*'
warning: no previously-included files matching '.DS_Store' found under directory '*'
warning: no previously-included files matching '.ropeproject' found under directory '*'
writing manifest file 'luma.lcd.egg-info/SOURCES.txt'
running check
creating luma.lcd-2.9.0
creating luma.lcd-2.9.0/doc
creating luma.lcd-2.9.0/doc/fritzing
creating luma.lcd-2.9.0/doc/images
creating luma.lcd-2.9.0/doc/old
creating luma.lcd-2.9.0/doc/tech-spec
creating luma.lcd-2.9.0/luma
creating luma.lcd-2.9.0/luma.lcd.egg-info
creating luma.lcd-2.9.0/luma/lcd
copying files to luma.lcd-2.9.0...
copying .coveragerc -> luma.lcd-2.9.0
copying CHANGES.rst -> luma.lcd-2.9.0
copying CONTRIBUTING.rst -> luma.lcd-2.9.0
copying LICENSE.rst -> luma.lcd-2.9.0
copying MANIFEST.in -> luma.lcd-2.9.0
copying README.rst -> luma.lcd-2.9.0
copying pyproject.toml -> luma.lcd-2.9.0
copying pytest.ini -> luma.lcd-2.9.0
copying setup.cfg -> luma.lcd-2.9.0
copying setup.py -> luma.lcd-2.9.0
copying tox.ini -> luma.lcd-2.9.0
copying doc/HD44780.rst -> luma.lcd-2.9.0/doc
copying doc/Makefile -> luma.lcd-2.9.0/doc
copying doc/api-documentation.rst -> luma.lcd-2.9.0/doc
copying doc/conf.py -> luma.lcd-2.9.0/doc
copying doc/hardware.rst -> luma.lcd-2.9.0/doc
copying doc/index.rst -> luma.lcd-2.9.0/doc
copying doc/install.rst -> luma.lcd-2.9.0/doc
copying doc/intro.rst -> luma.lcd-2.9.0/doc
copying doc/python-usage.rst -> luma.lcd-2.9.0/doc
copying doc/references.rst -> luma.lcd-2.9.0/doc
copying doc/software.rst -> luma.lcd-2.9.0/doc
copying doc/fritzing/PCD8544 LCD.fzpz -> luma.lcd-2.9.0/doc/fritzing
copying doc/fritzing/RPi GPIO Header.fzpz -> luma.lcd-2.9.0/doc/fritzing
copying doc/fritzing/schematic.fzz -> luma.lcd-2.9.0/doc/fritzing
copying doc/images/IMG_2539.JPG -> luma.lcd-2.9.0/doc/images
copying doc/images/IMG_2540.JPG -> luma.lcd-2.9.0/doc/images
copying doc/images/IMG_2541.JPG -> luma.lcd-2.9.0/doc/images
copying doc/images/IMG_2544.JPG -> luma.lcd-2.9.0/doc/images
copying doc/images/IMG_2774.JPG -> luma.lcd-2.9.0/doc/images
copying doc/images/RPi_P5_header.png -> luma.lcd-2.9.0/doc/images
copying doc/images/clock_anim.gif -> luma.lcd-2.9.0/doc/images
copying doc/images/crawl_anim.gif -> luma.lcd-2.9.0/doc/images
copying doc/images/hd44780_20x4.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/hd44780_clock.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/hd44780_progress.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/ht1621.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/ili9341.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/invaders_anim.gif -> luma.lcd-2.9.0/doc/images
copying doc/images/pcd8544.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/pcd8544.png -> luma.lcd-2.9.0/doc/images
copying doc/images/pcd8544.svg -> luma.lcd-2.9.0/doc/images
copying doc/images/pcd8544_schematic_bb.png -> luma.lcd-2.9.0/doc/images
copying doc/images/serial_config.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/st7567.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/st7735.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/st7735_pin_outs.jpg -> luma.lcd-2.9.0/doc/images
copying doc/images/st7735_schematic_bb.png -> luma.lcd-2.9.0/doc/images
copying doc/images/uc1701x.png -> luma.lcd-2.9.0/doc/images
copying doc/images/wiring-diagram.png -> luma.lcd-2.9.0/doc/images
copying doc/images/wiring-diagram.svg -> luma.lcd-2.9.0/doc/images
copying doc/old/veroboard-schematic.diy -> luma.lcd-2.9.0/doc/old
copying doc/tech-spec/HD44780.pdf -> luma.lcd-2.9.0/doc/tech-spec
copying doc/tech-spec/HT1621.pdf -> luma.lcd-2.9.0/doc/tech-spec
copying doc/tech-spec/ILI9341.pdf -> luma.lcd-2.9.0/doc/tech-spec
copying doc/tech-spec/PCD8544.pdf -> luma.lcd-2.9.0/doc/tech-spec
copying doc/tech-spec/ST7735.pdf -> luma.lcd-2.9.0/doc/tech-spec
copying doc/tech-spec/ST7789.pdf -> luma.lcd-2.9.0/doc/tech-spec
copying doc/tech-spec/ST7920.pdf -> luma.lcd-2.9.0/doc/tech-spec
copying doc/tech-spec/UC1701X.pdf -> luma.lcd-2.9.0/doc/tech-spec
copying luma/__init__.py -> luma.lcd-2.9.0/luma
copying luma.lcd.egg-info/PKG-INFO -> luma.lcd-2.9.0/luma.lcd.egg-info
copying luma.lcd.egg-info/SOURCES.txt -> luma.lcd-2.9.0/luma.lcd.egg-info
copying luma.lcd.egg-info/dependency_links.txt -> luma.lcd-2.9.0/luma.lcd.egg-info
copying luma.lcd.egg-info/namespace_packages.txt -> luma.lcd-2.9.0/luma.lcd.egg-info
copying luma.lcd.egg-info/not-zip-safe -> luma.lcd-2.9.0/luma.lcd.egg-info
copying luma.lcd.egg-info/requires.txt -> luma.lcd-2.9.0/luma.lcd.egg-info
copying luma.lcd.egg-info/top_level.txt -> luma.lcd-2.9.0/luma.lcd.egg-info
copying luma/lcd/__init__.py -> luma.lcd-2.9.0/luma/lcd
copying luma/lcd/const.py -> luma.lcd-2.9.0/luma/lcd
copying luma/lcd/device.py -> luma.lcd-2.9.0/luma/lcd
copying luma/lcd/segment_mapper.py -> luma.lcd-2.9.0/luma/lcd
Writing luma.lcd-2.9.0/setup.cfg
Creating tar archive
removing 'luma.lcd-2.9.0' (and everything under it)
running bdist_wheel
running build
running build_py
installing to build/bdist.macosx-11-arm64/wheel
running install
running install_lib
Skipping installation of build/bdist.macosx-11-arm64/wheel/luma/__init__.py (namespace package)
copying luma/lcd/device.py -> build/bdist.macosx-11-arm64/wheel/luma/lcd
copying luma/lcd/__init__.py -> build/bdist.macosx-11-arm64/wheel/luma/lcd
copying luma/lcd/segment_mapper.py -> build/bdist.macosx-11-arm64/wheel/luma/lcd
copying luma/lcd/const.py -> build/bdist.macosx-11-arm64/wheel/luma/lcd
running install_egg_info
Copying luma.lcd.egg-info to build/bdist.macosx-11-arm64/wheel/luma.lcd-2.9.0-py3.9.egg-info
Installing build/bdist.macosx-11-arm64/wheel/luma.lcd-2.9.0-py3.9-nspkg.pth
running install_scripts
adding license file "LICENSE.rst" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-11-arm64/wheel/luma.lcd-2.9.0.dist-info/WHEEL
creating 'dist/luma.lcd-2.9.0-py2.py3-none-any.whl' and adding 'build/bdist.macosx-11-arm64/wheel' to it
adding 'luma.lcd-2.9.0-py3.9-nspkg.pth'
adding 'luma/lcd/__init__.py'
adding 'luma/lcd/const.py'
adding 'luma/lcd/device.py'
adding 'luma/lcd/segment_mapper.py'
adding 'luma.lcd-2.9.0.dist-info/LICENSE.rst'
adding 'luma.lcd-2.9.0.dist-info/METADATA'
adding 'luma.lcd-2.9.0.dist-info/WHEEL'
adding 'luma.lcd-2.9.0.dist-info/namespace_packages.txt'
adding 'luma.lcd-2.9.0.dist-info/top_level.txt'
adding 'luma.lcd-2.9.0.dist-info/RECORD'
removing build/bdist.macosx-11-arm64/wheel
running upload
Submitting dist/luma.lcd-2.9.0.tar.gz to https://upload.pypi.org/legacy/
Upload failed (400): Invalid value for blake2_256_digest. Error: Use a valid, hex-encoded, BLAKE2 message digest.
error: Upload failed (400): Invalid value for blake2_256_digest. Error: Use a valid, hex-encoded, BLAKE2 message digest.

@iceman1001
Copy link

@matemaciek the develop install worked!!!! Yesssss!!!

@thijstriemstra
Copy link
Collaborator

@rm-hull upgrade wheel and setuptools to latest and try again?

@thijstriemstra
Copy link
Collaborator

also looks like its trying to build for arm:

build/bdist.macosx-11-arm64/wheel

@thijstriemstra
Copy link
Collaborator

thijstriemstra commented Mar 14, 2021

would be better to publish using github actions only to prevent these issues @rm-hull

@rm-hull
Copy link
Owner

rm-hull commented Mar 14, 2021

also looks like its trying to build for arm:

build/bdist.macosx-11-arm64/wheel

ah yes ... that will be my shiny new macbook

@rm-hull
Copy link
Owner

rm-hull commented Mar 15, 2021

Publishes ok on linux...

https://pypi.org/project/luma.lcd/2.9.0/ released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for ST7789 driver

5 participants