Skip to content

Commit

Permalink
Fixed buffer allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
gadirotenberg committed Jun 16, 2021
1 parent e424dc1 commit 8a3e2ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/nametags/nameservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

class NameService(Service):
uuid = StandardUUID(0xfeef)
_disp_rx = StreamIn(uuid=StandardUUID(0xfeee), timeout=1.0, buffer_size=8192)

def __init__(self):
super().__init__()
Expand All @@ -30,8 +29,12 @@ def __init__(self):
self._offset = 0
self._bufsize = 0
self._ledstate = False
self._disp_rx = None

def update(self):
if self._disp_rx is None:
self._disp_rx = StreamIn(uuid=StandardUUID(0xfeee), timeout=1.0, buffer_size=8192)

while self._disp_rx.in_waiting > 0:
if self._bufsize == 0:
value = int.from_bytes(self._disp_rx.read(1), 'little')
Expand Down

0 comments on commit 8a3e2ad

Please sign in to comment.