mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-30 17:03:41 +08:00
make them internal
This commit is contained in:
@@ -95,7 +95,7 @@ class Car:
|
||||
|
||||
self.param_manager: ParamManager = ParamManager()
|
||||
self.param_manager.update(self.params)
|
||||
self.params_list: SimpleNamespace = self.param_manager.get_params()
|
||||
self._params_list: SimpleNamespace = self.param_manager.get_params()
|
||||
|
||||
# card is driven by can recv, expected at 100Hz
|
||||
self.rk = Ratekeeper(100, print_delay_threshold=None)
|
||||
@@ -105,7 +105,7 @@ class Car:
|
||||
|
||||
# Update carState from CAN
|
||||
can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True)
|
||||
CS = self.CI.update(self.CC_prev, can_strs, self.params_list)
|
||||
CS = self.CI.update(self.CC_prev, can_strs, self._params_list)
|
||||
|
||||
self.sm.update(0)
|
||||
|
||||
@@ -196,7 +196,7 @@ class Car:
|
||||
def sp_params_thread(self, event: threading.Event) -> None:
|
||||
while not event.is_set():
|
||||
self.param_manager.update(self.params)
|
||||
self.params_list = self.param_manager.get_params()
|
||||
self._params_list = self.param_manager.get_params()
|
||||
time.sleep(0.1)
|
||||
|
||||
def card_thread(self):
|
||||
|
||||
@@ -5,7 +5,7 @@ from openpilot.common.params import Params
|
||||
|
||||
class ParamManager:
|
||||
def __init__(self):
|
||||
self.params_list: SimpleNamespace = self.convert_to_namespace({
|
||||
self._params_list: SimpleNamespace = self._create_namespace({
|
||||
"below_speed_pause": False,
|
||||
"experimental_mode": False,
|
||||
"is_metric": False,
|
||||
@@ -14,14 +14,14 @@ class ParamManager:
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
def convert_to_namespace(data: dict) -> SimpleNamespace:
|
||||
def _create_namespace(data: dict) -> SimpleNamespace:
|
||||
return SimpleNamespace(**data)
|
||||
|
||||
def get_params(self) -> SimpleNamespace:
|
||||
return self.params_list
|
||||
return self._params_list
|
||||
|
||||
def update(self, params: Params) -> None:
|
||||
self.params_list = self.convert_to_namespace({
|
||||
self._params_list = self._create_namespace({
|
||||
"below_speed_pause": params.get_bool("BelowSpeedPause"),
|
||||
"experimental_mode": params.get_bool("ExperimentalMode"),
|
||||
"is_metric": params.get_bool("IsMetric"),
|
||||
|
||||
Reference in New Issue
Block a user