🐛 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:
+13
-5
@@ -1144,15 +1144,23 @@ class MainWindow(ctk.CTk):
|
|||||||
|
|
||||||
# Wait for board to boot — UART if available, else config delay
|
# Wait for board to boot — UART if available, else config delay
|
||||||
boot_delay = self._config.boot_wait_delay
|
boot_delay = self._config.boot_wait_delay
|
||||||
uart_alive = (self._uart_monitor is not None
|
# Check both main monitor and UART window monitor
|
||||||
and self._uart_monitor.is_running())
|
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 = ""
|
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)...")
|
self._log_message(f" ⏳ Waiting for UART boot signal (max {boot_delay}s)...")
|
||||||
elapsed = 0.0
|
elapsed = 0.0
|
||||||
while elapsed < boot_delay:
|
while elapsed < boot_delay:
|
||||||
info = self._uart_monitor.latest_info
|
info = _uart_src.latest_info if hasattr(_uart_src, 'latest_info') else _uart_src.get_latest_info()
|
||||||
if info.ip_address or info.version:
|
if info and (info.ip_address or info.version):
|
||||||
self._log_message(
|
self._log_message(
|
||||||
f" ✓ Boot detected after {elapsed:.1f}s"
|
f" ✓ Boot detected after {elapsed:.1f}s"
|
||||||
f" (IP={info.ip_address}, Ver={info.version})"
|
f" (IP={info.ip_address}, Ver={info.version})"
|
||||||
|
|||||||
@@ -1190,6 +1190,12 @@ class UartMonitorWindow(ctk.CTkToplevel):
|
|||||||
"""True if the UART monitor thread is currently running."""
|
"""True if the UART monitor thread is currently running."""
|
||||||
return self._monitor is not None and self._monitor.is_running()
|
return self._monitor is not None and self._monitor.is_running()
|
||||||
|
|
||||||
|
def get_latest_info(self):
|
||||||
|
"""Return latest parsed BootInfo from the UART monitor, or None."""
|
||||||
|
if self._monitor:
|
||||||
|
return self._monitor.latest_info
|
||||||
|
return None
|
||||||
|
|
||||||
def _on_close(self) -> None:
|
def _on_close(self) -> None:
|
||||||
"""Cleanup UartMonitor and destroy window."""
|
"""Cleanup UartMonitor and destroy window."""
|
||||||
if self._monitor:
|
if self._monitor:
|
||||||
|
|||||||
Reference in New Issue
Block a user