✨ feat(serial): add version test via 'ver()' command
- Add test_serial_version() to serial_monitor.py - Sends 'ver()' command and parses version response - Add 'Test Version' button in serial panel - Displays version in status and log
This commit is contained in:
@@ -441,6 +441,15 @@ class MainWindow(ctk.CTk):
|
||||
)
|
||||
read_btn.grid(row=2, column=0, padx=PADDING, pady=PADDING_SMALL)
|
||||
|
||||
# Test version button
|
||||
self._test_version_btn = ctk.CTkButton(
|
||||
panel,
|
||||
text="Test Version",
|
||||
font=FONT_BODY,
|
||||
command=self._test_serial_version,
|
||||
)
|
||||
self._test_version_btn.grid(row=3, column=0, padx=PADDING, pady=PADDING_SMALL)
|
||||
|
||||
def _build_status_panel(self, parent: ctk.CTkFrame) -> None:
|
||||
"""Build the status display panel."""
|
||||
panel = ctk.CTkFrame(parent, corner_radius=CORNER_RADIUS)
|
||||
@@ -972,6 +981,46 @@ class MainWindow(ctk.CTk):
|
||||
except Exception as e:
|
||||
self._log_message(f" Error: {e}")
|
||||
|
||||
def _test_serial_version(self) -> None:
|
||||
"""Test serial port by sending 'ver()' command and parsing response."""
|
||||
port = self._port_var.get()
|
||||
if not port:
|
||||
self._log_message("No serial port selected")
|
||||
return
|
||||
|
||||
self._log_message(f"Testing version on {port}...")
|
||||
self._test_version_btn.configure(state="disabled", text="Testing...")
|
||||
|
||||
# Run in background thread
|
||||
def test_version_thread():
|
||||
try:
|
||||
from serial_monitor import test_serial_version
|
||||
|
||||
success, message, version = test_serial_version(
|
||||
port,
|
||||
self._config.serial_baudrate if self._config else 115200,
|
||||
)
|
||||
|
||||
if success:
|
||||
if version:
|
||||
self._log_message(f" ✓ {message}")
|
||||
self._log_message(f" ✓ Version detected: {version}")
|
||||
self._status.set_status(f"Version: {version}", "success")
|
||||
else:
|
||||
self._log_message(f" ✓ {message}")
|
||||
self._status.set_status("Port responded", "info")
|
||||
else:
|
||||
self._log_message(f" ✗ {message}")
|
||||
self._status.set_status(message, "error")
|
||||
except Exception as e:
|
||||
self._log_message(f" ✗ Error: {e}")
|
||||
self._status.set_status(f"Error: {e}", "error")
|
||||
finally:
|
||||
# Re-enable button
|
||||
self.after(0, lambda: self._test_version_btn.configure(state="normal", text="Test Version"))
|
||||
|
||||
threading.Thread(target=test_version_thread, daemon=True).start()
|
||||
|
||||
# ── Vitis Check ────────────────────────────────────────────
|
||||
|
||||
def _check_vitis(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user