File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ def _spi_select(self):
105
105
self ._cs .value = False # the actual select
106
106
times = time .monotonic ()
107
107
while (time .monotonic () - times ) < 1 : # wait up to 1000ms
108
- if self ._ready .value :
108
+ if self ._ready .value : # ok ready to send!
109
109
return
110
110
# some failure
111
111
self ._cs .value = True
@@ -119,10 +119,16 @@ def _spi_deselect(self):
119
119
def wait_for_ready (self ):
120
120
if self ._debug :
121
121
print ("Wait for ESP32 ready" , end = '' )
122
- while self ._ready .value == True :
122
+ times = time .monotonic ()
123
+ while (time .monotonic () - times ) < 10 : # wait up to 10 seconds
124
+ if self ._ready .value == False : # we're ready!
125
+ break
123
126
if self ._debug :
124
127
print ('.' , end = '' )
125
128
time .sleep (0.01 )
129
+ else :
130
+ raise RuntimeError ("ESP32 not responding" )
131
+
126
132
if self ._debug :
127
133
print ()
128
134
You can’t perform that action at this time.
0 commit comments