Skip to content

Commit 63cd7f6

Browse files
committed
Add time delay for init
1 parent e3747a7 commit 63cd7f6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adafruit_neotrellis/neotrellis.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
_NEO_TRELLIS_NUM_COLS = const(8)
6363
_NEO_TRELLIS_NUM_KEYS = const(64)
6464

65+
SYNC_DELAY = const(0.0005)
66+
INIT_DELAY = const(0.0005)
6567

6668
CallbackType: TypeAlias = Callable[[KeyEvent], None]
6769

@@ -93,6 +95,7 @@ def __init__(self, i2c_bus, interrupt: bool = False,
9395
self.interrupt_enabled = interrupt
9496
self.callbacks = [None] * _NEO_TRELLIS_NUM_KEYS
9597
self.pixels = NeoPixel(self, _NEO_TRELLIS_NEOPIX_PIN, self.width * self.height)
98+
sleep(INIT_DELAY)
9699

97100
def activate_key(self, key: int, edge: int, enable: bool = True) -> None:
98101
"""Activate or deactivate a key on the trellis. Key is the key number from
@@ -112,7 +115,7 @@ def sync(self) -> None:
112115
"""read any events from the Trellis hardware and call associated
113116
callbacks"""
114117
available = self.count
115-
sleep(0.0005) # FIXME: resolve
118+
sleep(SYNC_DELAY) # FIXME: resolve
116119
if available > 0:
117120
buf = self.read_keypad(available)
118121
for r in buf:

0 commit comments

Comments
 (0)