from __future__ import annotations import os from dataclasses import dataclass from pathlib import Path from typing import Tuple APP_NAME = "Ameba Control Panel" UI_LOG_TAIL_LINES = 100_000 LOG_FLUSH_INTERVAL_MS = 30 PERF_UPDATE_INTERVAL_MS = 1_000 PORT_REFRESH_INTERVAL_MS = 2_000 DEFAULT_BAUD = 1_500_000 COMMON_BAUD_RATES = [ 115_200, 230_400, 460_800, 921_600, 1_000_000, DEFAULT_BAUD, 2_000_000, 3_000_000, ] TIMESTAMP_FMT = "%Y-%m-%d %H:%M:%S.%f" @dataclass(frozen=True) class DeviceProfile: key: str label: str rx_color: str tx_color: str info_color: str DEVICE_PROFILES: Tuple[DeviceProfile, ...] = ( DeviceProfile("amebapro3", "AmebaPro3 (RTL8735C)", "#1b5e20", "#0d47a1", "#424242"), DeviceProfile("amebapro2", "AmebaPro2 (RTL8735B)", "#1b5e20", "#0d47a1", "#424242"), DeviceProfile("amebasmart", "AmebaSmart (RTL8730E)", "#1b5e20", "#0d47a1", "#424242"), ) def app_data_dir() -> Path: base = os.environ.get("LOCALAPPDATA") if base: return Path(base) / "AmebaControlPanel" # Fallback for non-Windows dev environments. return Path.home() / ".local" / "share" / "AmebaControlPanel"