Skip to content

Commit 0110979

Browse files
committed
Try two times to clear the reset alert bit
.. this is needed at least on CircuitPython 8.0.0-beta.6 and esp32-s3 (prototype esp32-s3 reverse tft feather) With this change >1000 successive initializations succeeded. Before this change, it did not seem that initialization ever succeeded.
1 parent 54e0836 commit 0110979

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

adafruit_max1704x.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,16 @@ def reset(self) -> None:
124124
pass
125125
else:
126126
raise RuntimeError("Reset did not succeed")
127-
self.reset_alert = False # clean up RI alert
127+
for _ in range(2):
128+
try:
129+
self.reset_alert = False # clean up RI alert
130+
return
131+
except OSError as e:
132+
# With CircuitPython 8.0.0-beta.6 and ESP32-S3, the first
133+
# attempt to reset the alert fails.
134+
continue
135+
else:
136+
raise RuntimeError("Clearing reset alert did not succeed")
128137

129138
@property
130139
def cell_voltage(self) -> float:

0 commit comments

Comments
 (0)