diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 0b0631bc2b..3ed835a1f5 100755 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -72,6 +72,7 @@ class Car: self.can_rcv_cum_timeout_counter = 0 self.CC_prev = car.CarControl.new_message() + self.CS_prev = car.CarState.new_message() self.initialized_prev = False self.last_actuators_output = structs.CarControl.Actuators() @@ -182,7 +183,8 @@ class Car: self.v_cruise_helper.update_v_cruise(CS, self.sm['carControl'].enabled, self.is_metric) if self.sm['carControl'].enabled and not self.CC_prev.enabled: - self.v_cruise_helper.initialize_v_cruise(CS, self.experimental_mode) + # Use CarState w/ buttons from the step selfdrived enables on + self.v_cruise_helper.initialize_v_cruise(self.CS_prev, self.experimental_mode) # TODO: mirror the carState.cruiseState struct? CS.vCruise = float(self.v_cruise_helper.v_cruise_kph) @@ -249,6 +251,7 @@ class Car: self.controls_update(CS, self.sm['carControl']) self.initialized_prev = initialized + self.CS_prev = CS def params_thread(self, evt): while not evt.is_set():