From efc2e38e763efc3db1374f5901d2ccd5f704f9f2 Mon Sep 17 00:00:00 2001 From: Hayden Roche Date: Wed, 15 Nov 2023 17:37:01 -0800 Subject: [PATCH] fix: Delay for 50 ms between I2C data queries. This is something I neglected to add when aligning the I2C code with what's in note-c. The result is that we'd hammer the Notecard, asking if there was data available. This actually worked with some hosts, but on others, the querying overwhelmed the Notecard, and the card would actually get into an error state (solid red LED). --- notecard/notecard.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notecard/notecard.py b/notecard/notecard.py index 357a3e0..8e15d42 100644 --- a/notecard/notecard.py +++ b/notecard/notecard.py @@ -702,6 +702,8 @@ def _transact(self, req_bytes, rsp_expected, # Notecard with requests. time.sleep(0.005) + # Query the Notecard every 50 ms to see if there's data available to + # read. start = start_timeout() available = 0 while available == 0: @@ -711,6 +713,8 @@ def _transact(self, req_bytes, rsp_expected, raise Exception('Timed out while querying Notecard for ' + \ 'available data.') + time.sleep(0.05) + return self.receive() def Reset(self):