From 0fa1ff07f5a06cafd1707adfde96a6ba1c43b97b Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 12 Nov 2024 19:58:15 -0500 Subject: [PATCH] try this out --- opendbc_repo | 2 +- sunnypilot/selfdrive/car/interfaces.py | 47 ++------------------------ 2 files changed, 4 insertions(+), 45 deletions(-) diff --git a/opendbc_repo b/opendbc_repo index ed8fe80fd9..a9981d5a2c 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit ed8fe80fd967f748281fb891453ed099c97ba3f7 +Subproject commit a9981d5a2ceccf0cd73ed989a4c5a6999c2137fa diff --git a/sunnypilot/selfdrive/car/interfaces.py b/sunnypilot/selfdrive/car/interfaces.py index 852a7b561c..c224513da2 100644 --- a/sunnypilot/selfdrive/car/interfaces.py +++ b/sunnypilot/selfdrive/car/interfaces.py @@ -7,58 +7,17 @@ ButtonType = structs.CarState.ButtonEvent.Type class CarInterfaceBaseSP(ABC): def __init__(self, CP: structs.CarParams, CarController, CarState): - self.CP = CP - - self.CS: CarStateBaseSP = CarState(CP) - self.cp = self.CS.get_can_parser(CP) - self.cp_cam = self.CS.get_cam_can_parser(CP) - self.cp_adas = self.CS.get_adas_can_parser(CP) - self.cp_body = self.CS.get_body_can_parser(CP) - self.cp_loopback = self.CS.get_loopback_can_parser(CP) - self.can_parsers = (self.cp, self.cp_cam, self.cp_adas, self.cp_body, self.cp_loopback) - - dbc_name = "" if self.cp is None else self.cp.dbc_name - self.CC: CarControllerBaseSP = CarController(dbc_name, CP) - self.mads_enabled_toggle = False self.mads_enabled = False - def update_prevs(self): - self.CS.mads_enabled_toggle = self.mads_enabled_toggle - self.CS.mads_enabled = self.mads_enabled + def update_prevs(self, CS): + CS.mads_enabled_toggle = self.mads_enabled_toggle + CS.mads_enabled = self.mads_enabled class CarStateBaseSP(ABC): def __init__(self, CP: structs.CarParams): - self.CP = CP - self.alt_button = 0 self.mads_enabled_toggle = False self.mads_enabled = False self.button_events: list[structs.CarState.ButtonEvent] = [] - - @staticmethod - def get_can_parser(CP): - return None - - @staticmethod - def get_cam_can_parser(CP): - return None - - @staticmethod - def get_adas_can_parser(CP): - return None - - @staticmethod - def get_body_can_parser(CP): - return None - - @staticmethod - def get_loopback_can_parser(CP): - return None - - -class CarControllerBaseSP(ABC): - def __init__(self, dbc_name: str, CP: structs.CarParams): - self.CP = CP - self.frame = 0