Skip to content

fix(logging): ASC 扩展帧 ID 补上末尾 x - #430

Merged
frankie-zeng merged 2 commits into
masterfrom
cursor/fix-asc-extended-id-db16
Aug 25, 2026
Merged

fix(logging): ASC 扩展帧 ID 补上末尾 x#430
frankie-zeng merged 2 commits into
masterfrom
cursor/fix-asc-extended-id-db16

Conversation

@frankie-zeng

@frankie-zeng frankie-zeng commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Fixes #427

问题

录制 Vector ASC 日志时,扩展帧(29-bit)仲裁 ID 末尾缺少 x,CANoe / CANalyzer 无法回放。

Vector CAN, Log & Trigger ASC Logging Format(CAN_LOG_TRIGGER_ASC_Format)规定扩展帧为:

4.876870 1 54C5638x Tx d 8 00 00 00 00 00 00 00 00

标准 11-bit ID 不加 x;扩展 ID 必须带尾缀 x。python-can ASCWriter 与 linux-can log2asc 同样如此。

修复

  • idType === EXTENDED 追加 x
  • 11-bit 无法表示的 ID(> 0x7FF)或带 CAN_EFF_FLAG 的 ID 也视为扩展帧,避免 idType 丢失时仍写出错误格式
  • Classic CAN 的 ID 字段按规范左对齐到 15 个字符
  • 增加格式化单测,以及生成 ASC 再由 AscReader 回读的测试

验证

本地已通过:

npm run test -- --run test/transport/asc.test.ts
npm run test -- --run test/replay/replay.spec.ts

test/transport/asc.test.ts:6 passed
test/replay/replay.spec.ts:9 passed

Open in Web Open in Cursor 

cursoragent and others added 2 commits August 25, 2026 03:51
Vector ASC (CAN_LOG_TRIGGER_ASC_Format) requires 29-bit identifiers to
end with x so CANoe/CANalyzer can replay the file. Treat IDs above 0x7FF
as extended even when idType is missing, and cover classic/CAN FD write
plus AscReader round-trip.

Co-authored-by: frankie <frankie-zeng@users.noreply.github.com>
Keep formatter assertions and parse the generated ASC through AscReader
so the trailing-x requirement is verified without depending on log.ts
worker assets or File transport flush timing.
@frankie-zeng
frankie-zeng marked this pull request as ready for review August 25, 2026 04:37
@frankie-zeng
frankie-zeng merged commit df6f42c into master Aug 25, 2026
2 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.

[BUG]记录asc log时扩展帧id格式有误

2 participants