generated from hulk/gd32f4xx_template_cmake_vscode
19 lines
645 B
Python
19 lines
645 B
Python
# -*- 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")
|