feat(ota): 优化 GD32 OTA 流程和 CAN 反馈机制
- 实现 GD32 主动推送 CAN 反馈架构,替代 ESP32 1Hz 轮询方式, 减少 SPI 总线占用提升带宽效率 - 添加 GD32 Bootloader 就绪检测机制,通过 PB6 硬件信号等待 保证 OTA 过程稳定可靠 - 集成 CREDIT 感知功能,当 GD32 写 Flash 缓冲时自动等待, 避免数据包丢失提高传输成功率 - 重构 canFdPollFeedback 为 canFdParseFeedbackPage 函数, 支持被动解析 GD32 主动推送的数据页 - 更新版本号从 0.37 到 0.3.38 并添加 Kconfig 配置选项支持
This commit is contained in:
+21
-23
@@ -1,24 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
serial_monitor.py - ESP32 串口日志采集工具
|
||||
import serial, time, sys
|
||||
|
||||
用法: 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()
|
||||
port = 'COM15'
|
||||
baud = 115200
|
||||
outfile = r'G:\Robot_v2\DCU\ESP32_COMM\build\monitor_log.txt'
|
||||
|
||||
print('Monitoring %s at %d baud...' % (port, baud), flush=True)
|
||||
|
||||
try:
|
||||
s = serial.Serial(port, baud, timeout=1)
|
||||
with open(outfile, 'w') as f:
|
||||
while True:
|
||||
data = s.readline()
|
||||
if data:
|
||||
line = data.decode('utf-8', errors='replace').rstrip()
|
||||
ts = time.strftime('%H:%M:%S')
|
||||
msg = '[%s] %s' % (ts, line)
|
||||
print(msg, flush=True)
|
||||
f.write(msg + '\n')
|
||||
f.flush()
|
||||
except Exception as e:
|
||||
print('Error: %s' % e, flush=True)
|
||||
Reference in New Issue
Block a user