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 Pack V2 x 2? #299
Comments
It was worth a try, but in hindsight, a bit of an unreasonable request. Do it for one and you'd have to do it for others. |
It's something I've wanted to fix for a while, since there are some real warts with the module (singleton) driver approach that Display Pack uses. But it's also a lot of effort for very little payoff, so knowing it would also help in cases like this (rare, but relevant) gives me some motivation to prioritise it! |
An "generic" ST7789 module that wasn't locked into a preset width and height would work for me, and likely others. |
The ST7789 driver that underpins Pico Display probably does what you want, but is missing the glue that PicoDisplay has to stick it to PicoGraphics (for all the drawing functions). And, of course, the Python bindings 😬 The ST7789 driver could definitely stand to be a little more resolution agnostic, though, it's got a lot of special cases for the different displays we support to avoid having multiple arguments for display region and offsets. I suspect it would be a lot nicer to initialise an "ST7789" class instance in MicroPython and supply a width, height and rotation instead of the current ugliness of supplying a properly sized I guess TODO is:
Phase 1 tests:
This would change: import picodisplay as display
width = display.get_width()
height = display.get_height()
display_buffer = bytearray(width * height * 2)
display.init(display_buffer) Into something a little more like: import st7789
width = 320
height = 240
display = st7789.ST7789(width, height, BG_SPI_FRONT) |
That's close to what its like now in Python. Which was why I was headed that way. I could (I think?) use the Pi Mini Display code on the Pico Display Pack, with some editing. And not have to buy new displays.
Or the ST7789 breakout driver.
|
Welp all my Pico Display boards seem to be completely unresponsive for reasons I can't fathom. Very bizarre! I have created a very, very rough merged ST7789 driver. Builds should be available here shortly: https://github.com/pimoroni/pimoroni-pico/actions/runs/2017564653 It's missing a lot of features, but it may... work... and current looks something like this: import st7789
import time
display = st7789.ST7789(width=240, height=320, slot=0)
print(display)
p = display.create_pen(255, 255, 0)
display.set_backlight(1.0)
display.set_pen(p)
while True:
display.clear()
display.update()
time.sleep(0.5) This should be able to drive the 240x240 round and square colour LCDs, Pico Display and Pico Display 2, though support for round/square differentiation doesn't exist yet. I'd kinda like to fold ST7735 support into this somehow, for a combined, driver-agnostic "display" library, but that's a future source of pain. |
The following gets me a yellow background on my display pack V2
import st7789 display2 = st7789.ST7789(width=240, height=240, slot=1) print(display2) p2 = display2.create_pen(0, 0, 255) display2.set_backlight(1.0) while True:
|
This is my current working file using the latest official UF2 file.
|
My displays - all of them - are still going nothing! But I'm glad this is working for you. Suggests my code is doing what I think it should. Step two will be to try and flesh out support for various displays in some sensible and easy to use fashion. That may involve breaking the C++ API 😬 (Yay found a display that works) |
Opened #309 to track this |
Nice work Phil, very appreciated. One wrinkle is you can't run two displays, not enough memory for two display buffers. I almost hate mentioning it after all the work you've done, and are doing. I wouldn't think its an issue for most people. It would only crop up if you tried to run two displays in the Pico Breakout Garden. Or what I'm trying to do. |
Is there a way to make them both use the same frame_buffer?
MemoryError: memory allocation failed, allocating 81920 bytes This works with the old driver, letting me use two displays at once
|
Try:
I appreciate it doesn't constitute documentation, but all the args accepted by the constructor are here: pimoroni-pico/micropython/modules/st7789/st7789.cpp Lines 54 to 66 in 249f54f
|
That worked on my test setup, can't thank you enough Phil. I had looked at that file and figured out it was frame_buffer, just couldn't figure out it was "buffer=frame_buffer". What's in that file is Klingon to me, lol This is my test file, with your edits added. Pico Breakout Garden with two of the 1.3' 240x240 LCD Breakouts
|
What worked on the 240x135 Pico display pack doesn't want to work so well on the V2 240x320? Landscape worked but portrait is all garbled? Going to plug it into my quad pack and make sure its not my jumpers / wiring? |
Ok, it looks like an issue with the new unifying driver. portrait mode is cropped to 240 wide and text is all garbled? import utime #display = st7789.ST7789(width=240, height=135, slot=0) # Display Pack landscape works #display = st7789.ST7789(width=320, height=240, slot=0) # Display Pack V2 landscape works |
Currently running two Display Pack V2's side by side in portrait mode without issue. And have access to the full 320 height and 240 width. woot =) A big big thankyou Phil. A big thumbs up. import time import st7789 print(display1) while True:
|
I have a need to run two Pico Display Packs side by side, portrait mode if possible. I get that this is a very unusual request, and that its not designed to be used this way. They will be mounted to proto boards so each one can use a different chip select and backlight pin. I'll just mirror what pins are used on the Pico Breakout Garden SPI slots. And ignore the button and LED connections.
The stock Pimoroni Micro Python Display Pack driver / module doesn't support alternate pin select so I can't use it. The BreakoutColourLCD240x240 Micro python module does, and does work with the Display Pack, with one exception. It limits me too 240 x 240 pixels. It's already in portraited mode because of the different screen orientation of the display pack but I can't draw to the lower 1/4 of the screen. Even if I specify a height=320 and adjust the display buffer to match.
I currently have a 1.5' 240x240 LCD Breakout and Display Pack v2 running side by side, so running two displays is possible.
What I need is **BreakoutColorLCD240x320 module. I don't have the skills to write my own of know where to even begin to modify the current 240x240 module. I may be asking too much, but I figure it can't hurt to at least ask.
@Gadgetoid
The text was updated successfully, but these errors were encountered: