Files
ESP32_COMM/serial_monitor.py
T
小龙虾 00ce8dbbb5 feat(ota): 实现 GD32 Flash 存储抽象层和 OTA 协调器接口解耦
- 新增 storage/gd32_flash_store.cpp 组件,提供 GD32 Flash 存储抽象层
- 修改 ota_coordinator.cpp/h 使其继承 IRelayListener 接口,实现与
  OtaRelay 的解耦设计
- 将 GD32 相关存储操作统一通过协调器访问,解决 H3 绕过协调器的问题
- 添加完整的 Doxygen 注释到所有公共接口和关键函数
- 更新 CMakeLists.txt 构建配置,添加 storage 组件依赖
- 重构元数据加载/清除操作使用 Gd32FlashStore 实例而非 OtaRelay 直接访问
- 添加中继事件回调接口实现,使 OtaRelay 可通知协调器状态变化
2026-06-21 23:48:31 +08:00

25 lines
807 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""
serial_monitor.py - ESP32 串口日志采集工具
用法: python serial_monitor.py
依赖: pip install pyserial
功能: 监听 COM15 串口 (115200 波特率),将输出记录到 serial_log.txt,
最多运行 5 分钟。
"""
import serial, sys, time
ser = serial.Serial('COM15', 115200, timeout=1) # COM 口和波特率根据实际修改
outfile = open('G:\\Robot_v2\\DCU\\ESP32_COMM\\serial_log.txt', 'w', encoding='utf-8') # 输出文件路径
start = time.time()
while time.time() - start < 300: # 最多 5 分钟
line = ser.readline()
if line:
try:
text = line.decode('utf-8', errors='replace').rstrip()
outfile.write(text + '\n')
outfile.flush()
except:
pass
outfile.close()
ser.close()