mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-04 15:56:08 +08:00
@@ -181,7 +181,6 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"Offroad_UpdateFailed", CLEAR_ON_MANAGER_START},
|
||||
{"OpenpilotEnabledToggle", PERSISTENT},
|
||||
{"PandaHeartbeatLost", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"PandaLogState", PERSISTENT},
|
||||
{"PandaSignatures", CLEAR_ON_MANAGER_START},
|
||||
{"Passive", PERSISTENT},
|
||||
{"PrimeType", PERSISTENT},
|
||||
|
||||
+1
-1
Submodule panda updated: 62db60595b...6bf6ba773e
@@ -3,7 +3,6 @@
|
||||
import os
|
||||
import usb1
|
||||
import time
|
||||
import json
|
||||
import subprocess
|
||||
from typing import List, NoReturn
|
||||
from functools import cmp_to_key
|
||||
@@ -24,51 +23,6 @@ def get_expected_signature(panda: Panda) -> bytes:
|
||||
cloudlog.exception("Error computing expected signature")
|
||||
return b""
|
||||
|
||||
def read_panda_logs(panda: Panda) -> None:
|
||||
"""
|
||||
Forward panda logs to the cloud
|
||||
"""
|
||||
|
||||
params = Params()
|
||||
serial = panda.get_usb_serial()
|
||||
|
||||
log_state = {}
|
||||
try:
|
||||
ls = params.get("PandaLogState")
|
||||
if ls is not None:
|
||||
l = json.loads(ls)
|
||||
for k, v in l.items():
|
||||
if isinstance(k, str) and isinstance(v, int):
|
||||
log_state[k] = v
|
||||
except (TypeError, json.JSONDecodeError):
|
||||
cloudlog.exception("failed to parse PandaLogState")
|
||||
|
||||
try:
|
||||
if serial in log_state:
|
||||
logs = panda.get_logs(last_id=log_state[serial])
|
||||
else:
|
||||
logs = panda.get_logs(get_all=True)
|
||||
|
||||
# truncate logs to 100 entries if needed
|
||||
MAX_LOGS = 100
|
||||
if len(logs) > MAX_LOGS:
|
||||
cloudlog.warning(f"Panda {serial} has {len(logs)} logs, truncating to {MAX_LOGS}")
|
||||
logs = logs[-MAX_LOGS:]
|
||||
|
||||
# update log state
|
||||
if len(logs) > 0:
|
||||
log_state[serial] = logs[-1]["id"]
|
||||
|
||||
for log in logs:
|
||||
if log['timestamp'] is not None:
|
||||
log['timestamp'] = log['timestamp'].isoformat()
|
||||
cloudlog.event("panda_log", **log, serial=serial)
|
||||
|
||||
params.put("PandaLogState", json.dumps(log_state))
|
||||
except Exception:
|
||||
cloudlog.exception(f"Error getting logs for panda {serial}")
|
||||
|
||||
|
||||
def flash_panda(panda_serial: str) -> Panda:
|
||||
try:
|
||||
panda = Panda(panda_serial)
|
||||
@@ -191,8 +145,6 @@ def main() -> NoReturn:
|
||||
params.put_bool("PandaHeartbeatLost", True)
|
||||
cloudlog.event("heartbeat lost", deviceState=health, serial=panda.get_usb_serial())
|
||||
|
||||
read_panda_logs(panda)
|
||||
|
||||
if first_run:
|
||||
if panda.is_internal():
|
||||
# update time from RTC
|
||||
|
||||
@@ -6,7 +6,6 @@ import unittest
|
||||
import cereal.messaging as messaging
|
||||
from cereal import log
|
||||
from openpilot.common.gpio import gpio_set, gpio_init
|
||||
from openpilot.common.params import Params
|
||||
from panda import Panda, PandaDFU, PandaProtocolMismatch
|
||||
from openpilot.selfdrive.test.helpers import phone_only
|
||||
from openpilot.selfdrive.manager.process_config import managed_processes
|
||||
@@ -18,10 +17,6 @@ HERE = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
class TestPandad(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.params = Params()
|
||||
self.start_log_state = self.params.get("PandaLogState")
|
||||
|
||||
def tearDown(self):
|
||||
managed_processes['pandad'].stop()
|
||||
|
||||
@@ -39,10 +34,6 @@ class TestPandad(unittest.TestCase):
|
||||
if sm['peripheralState'].pandaType == log.PandaState.PandaType.unknown:
|
||||
raise Exception("boardd failed to start")
|
||||
|
||||
# simple check that we did something with the panda logs
|
||||
cur_log_state = self.params.get("PandaLogState")
|
||||
assert cur_log_state != self.start_log_state
|
||||
|
||||
def _go_to_dfu(self):
|
||||
HARDWARE.recover_internal_panda()
|
||||
assert Panda.wait_for_dfu(None, 10)
|
||||
|
||||
Reference in New Issue
Block a user