Skip to content

fix: restore ARES USB UART callback transport#32

Merged
ttwards merged 6 commits into
masterfrom
fix/restore-ares-usb-uart-callback
Jul 7, 2026
Merged

fix: restore ARES USB UART callback transport#32
ttwards merged 6 commits into
masterfrom
fix/restore-ares-usb-uart-callback

Conversation

@ttwards

@ttwards ttwards commented Jul 7, 2026

Copy link
Copy Markdown
Owner

描述

恢复之前在 USB/UART 传输层完成但被后续分支重写覆盖掉的 ARES callback transport 改动,并补上 native_sim ztest 覆盖通讯链路。

主要内容:

  • 恢复 AresInterfaceAPI.send_with_callback()ares_interface_tx_done_cb_tcaps()mtu()
  • 将 USB bulk 从 send_with_lock() 恢复为 TX done callback 语义,同时保留后续 master 中的 composite USB class 注册和 diagnostics 修正。
  • 恢复 dual protocol 的在飞状态清理逻辑,协议层不再依赖 USB 专用锁语义。
  • 恢复 UART USART1 921600 overlay、UART TX done callback 路径和 sample 的 chosen { ares,uart = ...; } 选择。
  • 修复 dual protocol REPL 回包只写入 8-bit req_id 的问题,改为完整 16-bit。
  • 清理 dual protocol 宏初始化,避免 native_sim -Wmissing-braces 构建失败。
  • 更新 ARES API 和通信文档,移除 send_with_lock 文档残留。
  • 新增 tests/native_sim/ares_communication,覆盖 bind/init、interface callback 成功/失败、SYNC flush/in-flight、callback capability 缺失、SYNC RX、FUNC request、REPL callback、packet/byte parser 路径和 disconnect 清理。

改动类型

  • 🐛 Bug 修复
  • ✨ 新功能
  • 📝 文档更新
  • 🎨 代码格式/风格调整
  • ♻️ 代码重构
  • ⚡ 性能优化
  • ✅ 测试相关
  • 🔧 构建/工具相关

相关 Issue

无。

测试

  • 代码通过所有 pre-commit 检查
  • 在以下开发板上测试通过:
    • Robomaster Board C
    • Robomaster Board A
    • DM MC02
    • 其他:___________

本地验证:

  • /Users/ttwards/Documents/zephyr_ws/.venv/bin/pre-commit run --files $(git diff --name-only origin/master..HEAD)
  • west build -b dm_mc02 samples/communication/ares_communication --pristine,使用恢复 worktree 作为 Zephyr module
  • west build -b dm_mc02 samples/communication/ares_communication --pristine,额外启用 CONFIG_UART_INTERFACE=y 并叠加 dm_mc02_usart1_921600.overlay
  • Lima: ZEPHYR_TOOLCHAIN_VARIANT=host python3 /Users/ttwards/Documents/zephyr_ws/zephyr/scripts/twister -T tests/native_sim/ares_communication --platform native_sim/native/64 --inline-logs --outdir /tmp/twister_ares_communication_lima -x=ZEPHYR_MODULES=/Users/ttwards/Documents/zephyr_ws/mambo-restore-usb-uart,9/9 ztest cases passed

检查清单

  • 我的代码遵循项目的编码规范
  • 我已经进行了自我审查
  • 我已经添加了必要的注释,特别是在难以理解的地方
  • 我已经更新了相关文档
  • 我的改动没有产生新的警告
  • 我已经添加了测试来证明我的修复有效或新功能正常工作
  • 新增和现有的单元测试在本地都通过
  • 所有文件都包含 SPDX 许可证头

截图/日志

不适用。

其他说明

没有重新刷写硬件。

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

👋 感谢您的贡献!

请确保:

  • ✅ 代码通过所有 CI 检查
  • ✅ 遵循项目编码规范
  • ✅ 添加必要的文档说明
  • ✅ 在实际硬件上测试(如果适用)

详细的贡献指南请参考 CONTRIBUTING.md

@ttwards
ttwards marked this pull request as ready for review July 7, 2026 17:01
@ttwards
ttwards merged commit 1b5770f into master Jul 7, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant