Tools: PID debug toolchain from V0.1.x bring-up

test_run.py: judged closed-loop test over COM5 (fixed sequence, J1~J4
This commit is contained in:
2026-10-15 20:55:29 +08:00
parent 8900240c65
commit 2f43efb94b
7 changed files with 618 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
"""Parse live temperature frames from test_events.log tail (test writes it live)."""
import re
import sys
n = int(sys.argv[1]) if len(sys.argv) > 1 else 60
rows = []
for ln in open("test_events.log", encoding="utf-8", errors="replace"):
m = re.match(r"^([\d.]+) . ([\d.]+) \[B5", ln)
if m:
rows.append((float(m.group(1)), float(m.group(2))))
print(f"{len(rows)} temp frames total")
if len(rows) > 10:
t1, v1 = rows[8]
t2, v2 = rows[-1]
print(f"{v1:.1f}C@{t1:.0f}s -> {v2:.1f}C@{t2:.0f}s slope={(v2-v1)/(t2-t1):.3f} C/s")
for t, v in rows[-8:]:
print(f" t={t:7.1f}s {v:6.1f}C")