fix(DLPilot): 二进制载荷日志行以 hex 展示 —— 修复复制被 NUL 截断

This commit is contained in:
2026-09-18 15:32:34 +08:00
parent ca898be299
commit 144730fb3a
2 changed files with 25 additions and 5 deletions
+6
View File
@@ -97,5 +97,11 @@ check('M305 功率(0x8CA0=36000mW)', d.format_power('M305', frames[0]),
check('M305 拒绝双字节载荷', d.format_power(
'M305', d.FrameParser().feed(bytes.fromhex('B5 F0 02 8C A0 1E'))[0]), None)
# 10) 二进制载荷的日志行安全: 无控制字符(NUL 会截断 Windows 剪贴板), 以 hex 展示
frames = d.FrameParser().feed(bytes.fromhex('B5 F0 02 00 34 26')) # M304 应答(含 NUL)
desc = d.describe(frames[0])
check('二进制载荷 hex 展示', desc, '[二进制载荷 00 34]')
check('日志行无控制字符', any(ord(c) < 0x20 for c in desc), False)
print('RESULT:', 'FAIL:' + ','.join(fails) if fails else 'ALL PASS')
sys.exit(1 if fails else 0)