Skip to content

Commit 4b56b54

Browse files
author
Melissa LeBlanc-Williams
committed
Actually saved before pushing code this time
1 parent cd63372 commit 4b56b54

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

adafruit_esp32spi/adafruit_esp32spi_wifimanager.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,16 @@ def post(self, url, **kw):
132132
if not self._esp.is_connected:
133133
self.connect()
134134
self.neo_status((100, 100, 0))
135-
return_val = requests.post(url, **kw)
135+
attempt_count = 0
136+
while attempt_count < self.attempts:
137+
try:
138+
attempt_count += 1
139+
return_val = requests.post(url, **kw)
140+
except(ValueError, RuntimeError) as error:
141+
if attempt_count >= self.attempts:
142+
attempt_count = 0
143+
self._esp.reset()
144+
print("Resetting ESP32\n", error)
136145
self.neo_status(0)
137146
return return_val
138147

0 commit comments

Comments
 (0)