add CLEAR_ON_IGNITION param type (#20810)

old-commit-hash: b4447993c10b36628cb72b58dba8104c9060bb7f
This commit is contained in:
Adeeb Shihadeh
2021-05-04 11:32:40 -07:00
committed by GitHub
parent 175bdf8773
commit 88434dc9e4
9 changed files with 15 additions and 24 deletions
+1
View File
@@ -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:
+1 -6
View File
@@ -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)
+3 -3
View File
@@ -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