peterhinch / micropython-touch Goto Github PK
View Code? Open in Web Editor NEWA GUI for touch panel displays.
License: MIT License
A GUI for touch panel displays.
License: MIT License
Hi Peter, I wanted to turn off the 'Free Ram' message as a default so I changed the global variable in tgui.py to _vb = False.
As I'm developing my touch screen with mqtt_as I have to freeze the touch and the mqtt or I run into memory issues even with just a picoW running the ili9341 screen, thus I wanted to freeze in the default ram reporting message to not report the ram.
But I then tried to see if I could turn it on temporarily in my hardware_setup.py by doing the following:
from gui.core.tgui import Display, _vb
_vb = True
Well that does not work :-). Is there a way to get this reporting to be set via some sort of verbose=True setting somewhere? ( I see you recently removed the verbose setting in XPT2046.py so perhaps you intend to remove this Free Ram reporting as your development proceeds in any case)
PS - the touch is working very well and I've used your font to py utility, (probably assisting in my lack of ram as I used it quite enthusiastically :) ), and the resulting large display numbers with large up and down buttons to change the displayed number is looking very nice - I do like the button litcolor which shows the button presses really well. My next task is to see if I can get some large up and down arrows to be displayed on the buttons.
Hello,
i am currently experimenting with the Pico-Res-Touch-LCD 3.5 from Waveshare.
It uses:
LCD | Pico | Description |
---|---|---|
VCC | VSYS | Power input |
GND | GND | GND |
LCD_DC | GP8 | Data/Command pin (High: data; Low: command) |
LCD_CS | GP9 | Chip select pin of LCD (Low active) |
LCD_CLK | GP10 | CLK pin of LCD communication, clock input for slave device |
MOSI | GP11 | SPI MOSI pin |
MISO | GP12 | SPI MISO pin |
LCD_BL | GP13 | LCD backlight control |
LCD_RST | GP15 | LCD reset pin (Low active) |
TP_CS | GP16 | Touch controller chip select (Low active) |
TP_IRQ | GP17 | Touch controller interrupt pin (Low active) |
If i understand it correctly, it uses a shared SPI for both display and touch and has an interrupt pin. I am unsure if and how it is possible to configure the hardware_setup.py to work with the hardware.
Only using the display (e.g. with the nano_gui) was successful.
the example hardware_setup for the XPT2046 has tpad = XPT2046(spi, cspin=Pin(0), ssd) which gives the error 'positional arg after keyword arg' Of course tpad = XPT2046(spi, Pin(0), ssd) works OK.
Also, for the ssd parameters I have usd=False and the screen demo's work ok.
However the touch demo - simple.py - whilst it displays the yes and no labels and the quit label in the expected place, the touch coordinates are still operating in the usd=True place. (i.e as if the sreen is upside down)
I expect one of the 'True' parameters in the tpad.init(240, 320, 270, 330, 3890, 3980, True, True, True) should be set to False but not sure, so I thought I would ask the man who knows :-)
Its looking quite good for one of my ili9341 screens and I think I should be able work with it.
Hello Peter, Big thanks for providing the code to get a touch screen working. It looks very interesting.
I've perused the doc's in preparation to having a go at the touch with my Chinese ili9341 which appears to have the xpt2046 chip. I will see if this low cost screen can be made to work, but I note your info on the fact it may not be as good as the Adafruit screens so I may have to get an Adafrut one.
I see the xpt2046.py that appears to want an spi variable and a chip select pin. (which of course is good my my screen :) . What I'm not clear on is if the spi used for the touch should be the same as the spi pins that drives the screen output (but with a different chip select pin), a completely different set of spi pins just for the 5 touch screen pin connections, or perhaps also a different spi bus should be assigned. Also is the touch irq pin to be connected?
Do you have an example hardware_setup.py for the xpt2046 as the example one is just for the tsc2007 which uses i2c for the touch interface. That would help me in working my way through the code as I'm a bit befuddled at the moment. Apologies if I've missed something in the docs where this is all explained.
Thanks.
This is not an issue as such, but seeking a knowledgeable comment on the best way to proceed with utilising the mp-touch lib together with the mqtt-as lib.
Delving too deep into the code is rather hard for my level of expertise, but I think the mp-touch starts an async loop when a user created sub class of the Screen class is instantiated.
I suppose that in this Screen subclass, apart from creating all the screen widgets, I could also include all the necessary task creations to get the mqtt-as up and running in the async loop as well.
Before going too far into having a go at this I thought I would check with you to see if I'm spouting nonsense or if you have any tips how (or if) one should go about using a touch screen that receives and publishes data via mqtt messages.
My scenario is the touch screen is linked to a temperature sensor (directly or via an mqtt message) that displays this temperature reading and also displays a current thermostat setting.
This Thermostat setting can be changed via up/down buttons. The new thermostat reading is published via mqtt to the boiler control / boiler status program (on another computer), and receives mqtt messages back from the same to display the boiler status on the screen.
This is all currently working on a raspberry pi with a large screen and I'm looking to package this up with a smaller display unit. Currently I also have a small display unit (ili9341) which runs nano-gui and mqtt-as as a display only screen.
I could quite easily use this ili9341 screen with manual buttons and its the way I will go if my thoughts on getting the touch screen ability of the ili9341 working with mqtt-as prove to be too complicated (for me :-) ). So before I embark on checking this out I thought I would get your quick thoughts on the feasibility of getting the mp-touch and mqtt-as working together on a rpi-pico board.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.