mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-18 05:23:57 +08:00
add CLEAR_ON_IGNITION param type (#20810)
old-commit-hash: b4447993c10b36628cb72b58dba8104c9060bb7f
This commit is contained in:
@@ -12,6 +12,7 @@ cdef extern from "selfdrive/common/params.h":
|
||||
PERSISTENT
|
||||
CLEAR_ON_MANAGER_START
|
||||
CLEAR_ON_PANDA_DISCONNECT
|
||||
CLEAR_ON_IGNITION
|
||||
ALL
|
||||
|
||||
cdef cppclass Params:
|
||||
|
||||
@@ -13,6 +13,7 @@ cdef class ParamKeyType:
|
||||
PERSISTENT = c_ParamKeyType.PERSISTENT
|
||||
CLEAR_ON_MANAGER_START = c_ParamKeyType.CLEAR_ON_MANAGER_START
|
||||
CLEAR_ON_PANDA_DISCONNECT = c_ParamKeyType.CLEAR_ON_PANDA_DISCONNECT
|
||||
CLEAR_ON_IGNITION = c_ParamKeyType.CLEAR_ON_IGNITION
|
||||
ALL = c_ParamKeyType.ALL
|
||||
|
||||
def ensure_bytes(v):
|
||||
@@ -43,12 +44,6 @@ cdef class Params:
|
||||
|
||||
self.p.clearAll(tx_type)
|
||||
|
||||
def manager_start(self):
|
||||
self.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START)
|
||||
|
||||
def panda_disconnect(self):
|
||||
self.clear_all(ParamKeyType.CLEAR_ON_PANDA_DISCONNECT)
|
||||
|
||||
def check_key(self, key):
|
||||
key = ensure_bytes(key)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import shutil
|
||||
import stat
|
||||
import unittest
|
||||
|
||||
from common.params import Params, UnknownKeyName, put_nonblocking
|
||||
from common.params import Params, ParamKeyType, UnknownKeyName, put_nonblocking
|
||||
|
||||
class TestParams(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@@ -35,7 +35,7 @@ class TestParams(unittest.TestCase):
|
||||
self.params.put("CarParams", "test")
|
||||
self.params.put("DongleId", "cb38263377b873ee")
|
||||
assert self.params.get("CarParams") == b"test"
|
||||
self.params.panda_disconnect()
|
||||
self.params.clear_all(ParamKeyType.CLEAR_ON_PANDA_DISCONNECT)
|
||||
assert self.params.get("CarParams") is None
|
||||
assert self.params.get("DongleId") is not None
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestParams(unittest.TestCase):
|
||||
self.params.put("CarParams", "test")
|
||||
self.params.put("DongleId", "cb38263377b873ee")
|
||||
assert self.params.get("CarParams") == b"test"
|
||||
self.params.manager_start()
|
||||
self.params.clear_all(ParamKeyType.CLEAR_ON_MANAGER_START)
|
||||
assert self.params.get("CarParams") is None
|
||||
assert self.params.get("DongleId") is not None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user