Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions weatherhat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,25 @@ def _t_poll_ioexpander(self):
self._polling = True
poll = select.poll()
poll.register(self._int.fd, select.POLLIN)

while self._polling:
if not poll.poll(10):
if not poll.poll(500):
continue

for event in self._int.read_edge_events():
if event.line_offset == self._interrupt_pin:
self.handle_ioe_interrupt()
time.sleep(1.0 / 100)

# Clear the interrupt line to prevent it freezing up.
self._lock.acquire(blocking=True)
try:
self._ioe.clear_interrupt()
except Exception:
pass
finally:
self._lock.release()

time.sleep(0.01)

def update(self, interval=60.0):

Expand Down
Loading