Skip to content

Commit fa30145

Browse files
authored
Merge pull request #14 from makermelissa/main
Improve Capacitive Touchpads with threshold
2 parents 160be44 + 9ccd820 commit fa30145

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_funhouse/peripherals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def __init__(self):
7474
board.CAP9,
7575
):
7676
cap = touchio.TouchIn(pin)
77+
cap.threshold = 20000
7778
self._ctp.append(cap)
7879

7980
self.i2c = board.I2C()
@@ -180,8 +181,7 @@ def slider(self):
180181
val = 0
181182
cap_map = b"\x01\x03\x02\x05\x04\x0c\x08\x18\x10"
182183
for cap in range(5):
183-
raw = self._ctp[cap + 3].raw_value
184-
if raw > 15000:
184+
if self._ctp[cap + 3].value:
185185
val += 1 << (cap)
186186
for i, pos in enumerate(tuple(cap_map)):
187187
if val == pos:

0 commit comments

Comments
 (0)