Skip to content

Commit ef77237

Browse files
author
BiffoBear
committed
Added timeout which raises an exception to avoid infinite loop in operation_mode setter
1 parent f7027e9 commit ef77237

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_rfm69.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ def operation_mode(self, val):
475475
self._write_u8(_REG_OP_MODE, op_mode)
476476
# Wait for mode to change by polling interrupt bit.
477477
while not self.mode_ready:
478-
pass
478+
if (time.monotonic() - start) >= 1:
479+
raise RuntimeError('Operation mode failed to set.')
479480

480481
@property
481482
def sync_word(self):

0 commit comments

Comments
 (0)