Skip to content

Multi touch crash #9

Closed
Closed
@jimmythesaint82

Description

@jimmythesaint82

I'm using a
Adafruit 2.8" and 3.2" Color TFT Touchscreen Breakout v2
connected to a Metro M4 Airlift light

When a 2nd finger touches the screen the code crashes

see Serial Log:

[{'id': 0, 'y': 114, 'x': 140}]
[{'id': 0, 'y': 114, 'x': 140}]
[{'id': 0, 'y': 114, 'x': 140}]
[{'id': 0, 'y': 114, 'x': 140}]
[{'id': 0, 'y': 114, 'x': 140}]
Traceback (most recent call last):
File "code.py", line 57, in
File "adafruit_focaltouch.py", line 110, in touched
File "adafruit_focaltouch.py", line 146, in _read
File "adafruit_focaltouch.py", line 141, in _read
File "adafruit_bus_device/i2c_device.py", line 112, in write
OSError: [Errno 5] Input/output error

I can catch the error and send a fake return as below ->

def _read(self, register, length):
"""Returns an array of 'length' bytes from the 'register'"""
with self._i2c as i2c:
try:
i2c.write(bytes([register & 0xFF]))
result = bytearray(length)
i2c.readinto(result)
if self._debug:
print("\t$%02X => %s" % (register, [hex(i) for i in result]))
return result
except:
buffer = bytearray()
buffer.extend(b"\x00")
return buffer

This is of course a quick fix so I can keep working...

Does anyone have any idea why or an idea where to look?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions