Skip to content

Commit fd55f39

Browse files
committed
Using os.uname to check for board instead
1 parent 809a084 commit fd55f39

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

adafruit_circuitplayground/circuit_playground_base.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import audiocore
4545
except ImportError:
4646
import audioio as audiocore
47+
import os
4748
import analogio
4849
import board
4950
import busio
@@ -162,23 +163,25 @@ def detect_taps(self):
162163
@detect_taps.setter
163164
def detect_taps(self, value):
164165
self._detect_taps = value
165-
if hasattr(board, "A0"): # If we're on a CPX or CPC, use a higher tap threshold
166+
if (
167+
"nRF52840" in os.uname().machine
168+
): # If we're on a CPB, use a higher tap threshold
166169
if value == 1:
167170
self._lis3dh.set_tap(
168-
value, 90, time_limit=4, time_latency=50, time_window=255
171+
value, 100, time_limit=4, time_latency=50, time_window=255
169172
)
170173
if value == 2:
171174
self._lis3dh.set_tap(
172-
value, 60, time_limit=10, time_latency=50, time_window=255
175+
value, 70, time_limit=10, time_latency=50, time_window=255
173176
)
174-
else: # If we're on a CPB
177+
else: # If we're on a CPX or CPC
175178
if value == 1:
176179
self._lis3dh.set_tap(
177-
value, 100, time_limit=4, time_latency=50, time_window=255
180+
value, 90, time_limit=4, time_latency=50, time_window=255
178181
)
179182
if value == 2:
180183
self._lis3dh.set_tap(
181-
value, 70, time_limit=10, time_latency=50, time_window=255
184+
value, 60, time_limit=10, time_latency=50, time_window=255
182185
)
183186

184187
@property

0 commit comments

Comments
 (0)