feat: forward UART parsed boot info to main log window
UartMonitorWindow now accepts on_log callback. When boot info (IP, version) is parsed from serial output, it: - Appears in the UART window's own log (prefix [UART]) - Forwards to main window's log panel via on_log callback - Unified [UART] prefix across both windows (was [BOOT] in UART window, [UART] Boot detected: in main log)
This commit is contained in:
@@ -1164,7 +1164,7 @@ class MainWindow(ctk.CTk):
|
||||
self._uart_monitor = UartMonitor(port, self._config.serial_baudrate)
|
||||
self._uart_monitor.on_line = lambda line: self._log_message(f" [UART] {line}")
|
||||
self._uart_monitor.on_boot_info = lambda info: (
|
||||
self._log_message(f" [UART] Boot detected: IP={info.ip_address}, Ver={info.version}")
|
||||
self._log_message(f" [UART] IP={info.ip_address}, Ver={info.version}")
|
||||
if info.ip_address or info.version else None
|
||||
)
|
||||
self._uart_monitor.on_error = lambda e: self._log_message(f" [UART] Error: {e}")
|
||||
@@ -1216,7 +1216,10 @@ class MainWindow(ctk.CTk):
|
||||
"""Open the UART Monitor window."""
|
||||
port = self._port_var.get()
|
||||
baudrate = self._config.serial_baudrate if self._config else 115200
|
||||
self._uart_window = UartMonitorWindow(self, port=port, baudrate=baudrate)
|
||||
self._uart_window = UartMonitorWindow(
|
||||
self, port=port, baudrate=baudrate,
|
||||
on_log=self._log_message,
|
||||
)
|
||||
|
||||
def _test_serial_version(self) -> None:
|
||||
"""Test serial port by sending 'ver()' command and parsing response."""
|
||||
|
||||
Reference in New Issue
Block a user