mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-06 04:35:47 +08:00
shorter
This commit is contained in:
@@ -34,7 +34,7 @@ class ControlsExt:
|
||||
self.blinker_pause_lateral.get_params()
|
||||
|
||||
def get_lat_active(self, sm: messaging.SubMaster) -> bool:
|
||||
if self.blinker_pause_lateral.should_blinker_pause_lateral(sm['carState']):
|
||||
if self.blinker_pause_lateral.update(sm['carState']):
|
||||
return False
|
||||
|
||||
ss_sp = sm['selfdriveStateSP']
|
||||
|
||||
@@ -23,7 +23,7 @@ class BlinkerPauseLateral:
|
||||
self.is_metric = self.params.get_bool("IsMetric")
|
||||
self.min_speed = int(self.params.get("BlinkerMinLateralControlSpeed", encoding='utf8'))
|
||||
|
||||
def should_blinker_pause_lateral(self, CS: car.CarState) -> bool:
|
||||
def update(self, CS: car.CarState) -> bool:
|
||||
if not self.enabled:
|
||||
return False
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class TestBlinkerPauseLateral:
|
||||
self.CS.leftBlinker = left
|
||||
self.CS.rightBlinker = right
|
||||
|
||||
result = self.blinker_pause_lateral.should_blinker_pause_lateral(self.CS)
|
||||
result = self.blinker_pause_lateral.update(self.CS)
|
||||
assert result == expected_results[(left, right)]
|
||||
|
||||
def test_below_min_speed_blinker(self):
|
||||
|
||||
Reference in New Issue
Block a user