File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
pytest-embedded-serial/pytest_embedded_serial Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ def _event_loop(self):
179179 defined in _forward_io. The pyserial.Serial methods are mocked to send an event to the queue, and the real
180180 method is running here.
181181 """
182+ last_data_time = time .time ()
182183 while True :
183184 try :
184185 _e = self ._event_q .get_nowait ()
@@ -188,11 +189,18 @@ def _event_loop(self):
188189 return
189190
190191 if _e == 'read' :
192+ if time .time () - last_data_time > 5.0 :
193+ logging .warning ('No data received from serial port for over 5 seconds.' )
194+ last_data_time = time .time ()
195+
191196 if self ._block_reading :
192197 continue
193198
194199 try :
195200 s = self ._s .read_all ()
201+ if s :
202+ last_data_time = time .time ()
203+
196204 self ._q .put (s )
197205 except OSError :
198206 return
You can’t perform that action at this time.
0 commit comments