sdev 0.3.2__tar.gz → 0.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sdev-0.3.2/sdev.egg-info → sdev-0.3.3}/PKG-INFO +1 -1
- {sdev-0.3.2 → sdev-0.3.3}/pyproject.toml +1 -1
- {sdev-0.3.2 → sdev-0.3.3}/sdev/__init__.py +1 -1
- {sdev-0.3.2 → sdev-0.3.3}/sdev/core.py +11 -10
- {sdev-0.3.2 → sdev-0.3.3/sdev.egg-info}/PKG-INFO +1 -1
- {sdev-0.3.2 → sdev-0.3.3}/setup.py +1 -1
- {sdev-0.3.2 → sdev-0.3.3}/LICENSE +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/MANIFEST.in +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/README.md +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/sdev/cli_wrapper.py +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/sdev.egg-info/SOURCES.txt +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/sdev.egg-info/dependency_links.txt +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/sdev.egg-info/entry_points.txt +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/sdev.egg-info/requires.txt +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/sdev.egg-info/top_level.txt +0 -0
- {sdev-0.3.2 → sdev-0.3.3}/setup.cfg +0 -0
|
@@ -213,26 +213,27 @@ class SerialDevice:
|
|
|
213
213
|
gen = self.scan_and_display(flag, "end_flag", timeout=timeout)
|
|
214
214
|
_ = list(gen)
|
|
215
215
|
|
|
216
|
+
def is_breathing(self) -> bool:
|
|
217
|
+
"""检查板子是否呼吸。"""
|
|
218
|
+
time.sleep(self._check_alive_timeout)
|
|
219
|
+
return self._has_output_in_buffer()
|
|
220
|
+
|
|
216
221
|
def check_alive(self, stable_flag: str):
|
|
217
222
|
"""
|
|
218
223
|
确认板子存活:有输出则 wait_for_flag(stable_flag) 后 return;否则 send_interrupt,成功则 return。
|
|
219
224
|
若 send_interrupt 超时则打 warning 并轮询 _has_output_in_buffer(),有数据再 wait_for_flag 后 return;未接串口会一直循环。
|
|
220
225
|
"""
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
self.wait_for_flag(stable_flag, self._reboot_timeout)
|
|
224
|
-
return
|
|
226
|
+
while self.is_breathing():
|
|
227
|
+
pass
|
|
225
228
|
|
|
226
|
-
# 测试是否能够接收ctrlc
|
|
229
|
+
# 测试是否能够接收ctrlc信号,若无反应,等待转生
|
|
227
230
|
try:
|
|
228
231
|
self.send_interrupt(self._check_alive_timeout, stable_flag)
|
|
229
232
|
except TimeoutError:
|
|
230
233
|
logger.warning(f"请接入串口")
|
|
231
|
-
while
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
self.wait_for_flag(stable_flag, self._reboot_timeout)
|
|
235
|
-
return
|
|
234
|
+
while not self.is_breathing():
|
|
235
|
+
pass
|
|
236
|
+
self.check_alive(stable_flag)
|
|
236
237
|
|
|
237
238
|
def __enter__(self):
|
|
238
239
|
self.connect()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|