feat(DLPilot): M305 实测负载功率对接(功率检测三步序列)

This commit is contained in:
2026-09-18 15:10:14 +08:00
parent 6d1e2c6f8d
commit 511e7dfa44
6 changed files with 52 additions and 20 deletions
+10
View File
@@ -87,5 +87,15 @@ check('M304 应答帧', len(frames), 1)
check('M304 电流(0x0034=+52mA)', d.format_power('M304', frames[0]), '+52 mA')
check('M304 负值(FF06=-250mA 补码)', d.payload_s16_be(bytes.fromhex('FF 06')), -250)
# 9) M305(SQ52205 实测功率)回归向量: u32 大端 mW(LEN=4, 算法推演帧)
check('build_frame(M305)', d.build_frame('M305').hex(' ').upper(),
'D5 01 04 4D 33 30 35 EA')
frames = d.FrameParser().feed(bytes.fromhex('B5 F0 04 00 00 8C A0 20'))
check('M305 应答帧', len(frames), 1)
check('M305 功率(0x8CA0=36000mW)', d.format_power('M305', frames[0]),
'36000 mW (36.00 W)')
check('M305 拒绝双字节载荷', d.format_power(
'M305', d.FrameParser().feed(bytes.fromhex('B5 F0 02 8C A0 1E'))[0]), None)
print('RESULT:', 'FAIL:' + ','.join(fails) if fails else 'ALL PASS')
sys.exit(1 if fails else 0)