🐛 fix: Step 4 boot wait uses UART window monitor data, not just main monitor

Root cause: When UART window is open, self._uart_monitor is None
(the window creates its own UartMonitor). Step 4 boot wait loop
only checked self._uart_monitor.latest_info → always saw empty data
→ fell through to IP scanning even though UART had detected the IP.

Fix:
- UartMonitorWindow.get_latest_info() exposes parsed BootInfo
- Step 4 checks both: self._uart_monitor first, then UART window
- Null guard on info before accessing .ip_address
This commit is contained in:
2026-06-11 15:21:36 +08:00
parent da94cc6cdc
commit 6d686964e2
2 changed files with 19 additions and 5 deletions
+13 -5
View File
@@ -1144,15 +1144,23 @@ class MainWindow(ctk.CTk):
# Wait for board to boot — UART if available, else config delay
boot_delay = self._config.boot_wait_delay
uart_alive = (self._uart_monitor is not None
and self._uart_monitor.is_running())
# Check both main monitor and UART window monitor
uart_alive = False
_uart_src = None # source of latest_info
if self._uart_monitor and self._uart_monitor.is_running():
uart_alive = True
_uart_src = self._uart_monitor
elif (self._uart_window and self._uart_window.winfo_exists()
and self._uart_window.is_monitoring):
uart_alive = True
_uart_src = self._uart_window
discovered_ip: str = ""
if uart_alive:
if uart_alive and _uart_src:
self._log_message(f" ⏳ Waiting for UART boot signal (max {boot_delay}s)...")
elapsed = 0.0
while elapsed < boot_delay:
info = self._uart_monitor.latest_info
if info.ip_address or info.version:
info = _uart_src.latest_info if hasattr(_uart_src, 'latest_info') else _uart_src.get_latest_info()
if info and (info.ip_address or info.version):
self._log_message(
f" ✓ Boot detected after {elapsed:.1f}s"
f" (IP={info.ip_address}, Ver={info.version})"