feat: add VCU status feedback and map DEBUG safety inputs

This commit is contained in:
shenlefengnai-rgb
2026-10-03 21:52:14 +08:00
parent dbbda5624a
commit 1e7b2e7f96
305 changed files with 32906 additions and 68 deletions
@@ -0,0 +1,31 @@
import hashlib
import json
import shutil
from pathlib import Path
root=Path(__file__).resolve().parent
project=root.parents[1]
data=json.loads((root/'gpio-can-results.json').read_text(encoding='utf-8'))
assert len(data['checks'])==36
assert data['physical_port']=='CAN1' and data['bitrate']==500000
for row in data['checks']:
assert row['pcan_status']=='0x0'
assert row['snapshot']['debug_state']==[0]*16
assert row['snapshot']['can_errors']==row['snapshot']['uart_errors']==0
for bit in range(15):
high=next(r for r in data['checks'] if r['name']==f'PD{bit}_high')
low=next(r for r in data['checks'] if r['name']==f'PD{bit}_low')
assert high['snapshot']['state']==1<<bit and low['snapshot']['state']==0
assert high['snapshot']['timestamp']==2000+bit*2
assert low['snapshot']['timestamp']==2001+bit*2
assert (root/'flash-readback.bin').read_bytes()==(project/'output/firmware/AMI_Controller.bin').read_bytes()
data['result']='Raw GPIO reception passed; DEBUG page state changes FAILED'
data['firmware_sha256']=hashlib.sha256((root/'flash-readback.bin').read_bytes()).hexdigest().upper()
(root/'gpio-can-results.json').write_text(json.dumps(data,indent=2),encoding='utf-8')
out=project/'docs/evidence/2026-10-03/debug-can-retest'
out.mkdir(parents=True,exist_ok=True)
for pattern in ('*.json','*_ram.log','test_gpio_can.py','probe_link.py','publish_results.py'):
for src in root.glob(pattern): shutil.copy2(src,out/src.name)
for name in ('mcu_all_high.png','mcu_PD0_high.png','mcu_PD14_high.png','mcu_final_zero.png','current_hmi.png'):
shutil.copy2(root/name,out/name)
print(json.dumps({'raw_checks':36,'high_checks':15,'low_checks':15,'debug_page_passed':False,'evidence':str(out)}))