card: fix cruise speed initialization w/ buttons (#34386)

* fix initialize w/ buttons

* what

* comment
This commit is contained in:
Shane Smiskol
2025-01-14 19:58:22 -08:00
committed by GitHub
parent b3fc407538
commit 38fad751cb
+4 -1
View File
@@ -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():