From 432585893162d6bda5e95cbe4aa024dfb01afdf7 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 28 Mar 2021 21:22:31 -0700 Subject: [PATCH] log cpr voltages (#20519) old-commit-hash: f89818b2d9ffa1c906b635a01f8a31a43058e4de --- selfdrive/thermald/thermald.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 6240d14e47..ef7e529f4a 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -2,6 +2,7 @@ import datetime import os import time +from pathlib import Path from typing import Dict, Optional, Tuple import psutil @@ -191,6 +192,18 @@ def thermald_thread(): thermal_config = HARDWARE.get_thermal_config() + # CPR3 logging + base_path = "/sys/kernel/debug/cpr3-regulator/" + cpr_files = [p for p in Path(base_path).glob("**/*") if p.is_file()] + cpr_data = {} + for cf in cpr_files: + with open(cf, "r") as f: + try: + cpr_data[str(cf)] = f.read().strip() + except Exception: + pass + cloudlog.event("CPR", data=cpr_data) + while 1: pandaState = messaging.recv_sock(pandaState_sock, wait=True) msg = read_thermal(thermal_config)