-
Notifications
You must be signed in to change notification settings - Fork 9
Add touch_point
parameter for compatibility with Displayio Button
#22
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
Conversation
I tested all but the calibration demo with a 2.4 inch TFT Featherwing on a GrandCentral M4 -- all worked well. |
Also verified that the stmpe610_touch_point_simpletest works via I2C with an stmpe610 breakout on a qtpy esp32s2 and on the grand central m4. |
Tested axes flip -- worked nicely! |
@@ -240,8 +318,53 @@ def __init__(self, i2c, address=_STMPE_ADDR): | |||
raise RuntimeError("Failed to find STMPE610! Chip Version 0x%x" % version) | |||
super().__init__() | |||
|
|||
@property | |||
def touch_point(self): # pylint: disable=too-many-branches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is touch_point replicated for both the I2C and SPI implementations .
Couldn't this be the same for both like get_point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first submitted version placed touch_point only in the parent class, but pylint didn't like it. It didn't recognize screen_size, etc. as members of the parent class. At least the touch_point duplicated version will be easy to change if the I2C class is removed.
"If you are using the breakout, verify you are in SPI mode." | ||
% version | ||
) | ||
super().__init__() | ||
|
||
@property | ||
def touch_point(self): # pylint: disable=too-many-branches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above: Does touch_point need to be replicated for I2C and SPI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first submitted version placed touch_point only in the parent class, but pylint didn't like it. It didn't recognize screen_size, etc. as members of the parent class. At least the touch_point duplicated version will be easy to change if the I2C class is removed.
Thank you for the review! The latest version (just submitted) replaces the potentially-licensed font with terminalio.FONT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me.
Tested all of the new examples with Feather RP2040 7.2.0-alpha1
Once the version is back to 0s I think this is ready to go.
I'm also on board with the idea of removing the I2C driver if it's hardware is no longer available and it sounds like it isn't as reliable as SPI anyway. That could come in a future PR if we end up removing it.
Thanks for changing the font to the default. I ran the touch_calibrator_stmpe610.py on a GrandCentral M4 with a 2.4inch TFT -- worked well. Thanks for adding this compatibility with the touchscreen library. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_24LC32 to 1.0.1 from 1.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_24LC32#11 from tekktrik/doc/add-typing > Merge pull request adafruit/Adafruit_CircuitPython_24LC32#12 from tekktrik/hotfix/patch-cleanup-fix Updating https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15 to 2.2.11 from 2.2.10: > First part of patch > Merge pull request adafruit/Adafruit_CircuitPython_ADS1x15#77 from nlantau/patch-1 > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_BNO055 to 5.3.3 from 5.3.2: > Merge pull request adafruit/Adafruit_CircuitPython_BNO055#90 from adafruit/patch-fix > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_CCS811 to 1.3.6 from 1.3.5: > Merge pull request adafruit/Adafruit_CircuitPython_CCS811#47 from sti320a/patch-1 > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_CLUE to 3.0.2 from 3.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_CLUE#54 from kevinjwalters/sample-fix > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 4.0.0 from 3.6.0: > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#146 from tekktrik/fix/rename-pin-args > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#155 from tekktrik/hotfix/fix-recv-into > First part of patch Updating https://github.com/adafruit/Adafruit_CircuitPython_SCD4X to 1.2.2 from 1.2.1: > Merge pull request adafruit/Adafruit_CircuitPython_SCD4X#12 from KeithTheEE/get-data-ready-status-fix > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_STMPE610 to 1.3.0 from 1.2.7: > Merge pull request adafruit/Adafruit_CircuitPython_STMPE610#22 from CedarGroveStudios/main > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Thermistor to 3.4.0 from 3.3.8: > Merge pull request adafruit/Adafruit_CircuitPython_Thermistor#19 from raquo/main > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 1.5.5 from 1.5.4: > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#56 from tekktrik/feature/ignore-comments-parsing > First part of patch Updating https://github.com/adafruit/Adafruit_CircuitPython_Debouncer to 1.4.0 from 1.3.13: > Merge pull request adafruit/Adafruit_CircuitPython_Debouncer#34 from prplz/main > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Button to 1.6.2 from 1.6.1: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Button#34 from adafruit/patch-fix > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Logging to 3.7.4 from 3.7.3: > Merge pull request adafruit/Adafruit_CircuitPython_Logging#25 from JingleheimerSE/add-time-format-specifier > First part of patch Updating https://github.com/adafruit/Adafruit_CircuitPython_MacroPad to 2.0.4 from 2.0.3: > Merge pull request adafruit/Adafruit_CircuitPython_MacroPad#34 from adafruit/patch-fix > First part of patch > update rtd py version Updating https://github.com/adafruit/Adafruit_CircuitPython_Simple_Text_Display to 1.2.2 from 1.2.1: > Merge pull request adafruit/Adafruit_CircuitPython_Simple_Text_Display#10 from adafruit/patch-fix > First part of patch > update rtd py version
Added a
touch_point
parameter and some instantiation kwargs for display size, touch calibration (duplicating howadafruit_touchscreen
works) as well as kwargs for display rotation and touch axis range reversal. The existing arguments and parameters were not altered, allowing backward compatibility.The
touch_flip
kwarg was needed because the touchscreen's x-axis is reversed on the 3.5" TFT Wing compared to the 2.4" TFT Wing (a PCB wiring difference). This argument also supports potential wiring configuration issues related to the Resistive Touch Screen Controller - STMPE610 breakout board (#1571).Also added three examples that exploit the
touch_point
parameter. Two show alternative methods for the existing simple paint demo and simpletest. The third is an example of use with Displayio Button.A touchscreen calibration method was added to the examples folder. The calibrator is used to empirically measure touchscreen x and y axis minimum/maximum raw values. The resulting tuple is used in the STMPE610 instantiation statement to significantly improve touchscreen accuracy.
Tests were conducted using the 2.4" (#3315) and 3.5" (#3651) TFT display Wings with a Feather M4 Express running CircuitPython v7.1.1.