Set CAN1 to 500K and CAN2 to 250K with matching DBCs and PDF

This commit is contained in:
shenlefengnai-rgb
2026-10-03 17:44:55 +08:00
parent ff6ef4c5e7
commit 9120bd0ec1
17 changed files with 316 additions and 33 deletions
+4 -3
View File
@@ -28,7 +28,7 @@ def inline(text):
def link(match):
label, target = match.groups()
if not target.startswith(('http://', 'https://')):
target = REMOTE + ('AMI.dbc' if target == '../AMI.dbc' else 'docs/' + target)
target = REMOTE + (target[3:] if target.startswith('../') else 'docs/' + target)
return f'<link href="{target}" color="#155E75">{label}</link>'
return re.sub(r'\[([^\]]+)\]\(([^)]+)\)', link, text)
@@ -78,6 +78,7 @@ def export(font_path):
proportions = {
2: [0.15, 0.85],
3: [0.17, 0.40, 0.43],
4: [0.12, 0.15, 0.20, 0.53],
6: [0.11, 0.055, 0.04, 0.28, 0.365, 0.15],
8: [0.32, 0.055, 0.055, 0.10, 0.09, 0.08, 0.06, 0.24],
}[count]
@@ -126,7 +127,7 @@ def export(font_path):
canvas.line(40, 31, page_width-40, 31)
canvas.setFont('AMIChinese', 8)
canvas.setFillColor(colors.HexColor('#506775'))
canvas.drawString(40, 19, 'AMI-2.0 | 2026-10-03 | CAN 接口说明')
canvas.drawString(40, 19, 'AMI-2.1 | 2026-10-03 | CAN1 500K / CAN2 250K')
canvas.drawRightString(page_width-40, 19, f'{doc.page}')
canvas.restoreState()
@@ -135,7 +136,7 @@ def export(font_path):
leftMargin=40, rightMargin=40,
topMargin=36, bottomMargin=44,
title='AMI CAN 报文说明', author='AMI / YMR',
subject='AMI CAN DBC v2.0: SDC, BMS and task requests')
subject='AMI CAN DBC v2.1: CAN1 500K / CAN2 250K')
document.build(story, onFirstPage=footer, onLaterPages=footer)
print(OUTPUT)