Finally, something that is missing from the start, the ability to write some text on display. In Doton we needed an ability to display numbers and we have done it via images. It was a partial solution but good enough. But we want more 🙂
So this time fonts, text and another step in endless struggle with displaying anything anywhere 🙂
We can rotate both ILI displays but NJU and SSD are awaiting their turn. Let’s give them some attention and add rotation to them.
This will close another task on endless list of improvements 🙂
From what I see we should change drawing functions (recalculate coordinates) and flushing buffer should stay the same because it works directly on hardware.
We have tests for page drawing algorithm. We can move on and add tests for area one. Writing tests for area drawing is much harder. This mode works on the device directly.
We need to create a dummy driver and chip class in such way that it would translate device’s command to an array.
We need tests for GfxLCD and we need it now! But this is a driver so what can we test? W can and must test all drawing functions. We have two algorithms the page and the area. Let’ begin with page one.
We can mock a chip class in such way that it won’t use a driver and all drawing would go to a buffer and we always can check if buffer looks as we want.
Last time we ignored a touch panel. But without it, our Waveshare shield is half-functional. So let’s do something about it: )
We have an XPT2046 panel that is compatible with AD7843 and it is compatible with AD7846 🙂 XPT has additionally a pressure sensor.
Recently I bought an LCD 4″ IPS with an ILI9486 chip from Waveshare. It should be better than 2.8″ 🙂 In instruction states that this display can work as system screen and I thought that maybe we can use PyQt or something instead of a custom driver.
The idea died quickly. I tried to run it on Raspberry Pi Zero W and this is not trivial 🙂 First, I hit the bug with inability to use GPIO #17 and driver couldn’t be loaded. After some googling, I know that this is caused by the newest kernel. So I reverted to old one and… screen booted up but WiFi and Bluetooth did not.
So this way is no go. Back to the original idea and custom driver for ILI9486.
At least, I mentioned touch so many times. Today we will create a new driver and add it to GfxLCD library.
GfxLCD @ GitHub
During the work on GUI, I had to add a new function, ability to load and display an image. First, this post was a part of bigger one but I think it should be a post on its own.
I tried to display numbers but we have no ability to display a text. So I thought about using images and that’s why we are here:)
It took some time but finally, we can exclude GfxLCD package from The Doton project. After this, we may focus on the next stage of Doton project.
But back to now:) We need to create a new package and publish it on the PyPi.
pip install gfxlcd
GfxLCD on PyPi
Old code, before module extraction, is under tag before-split. This way old posts still have some sense:)
In previous three articles, we managed to create a united interface for NJU and SSD based LCD. Today we will add another LCD, the most important one, with ILI9325 chip and 240×320 size.
This one brings a new way of drawing. Not on pages but on pixels and with colours.
– part one
– part two
– part three
Source @ GitHub