fix race condition

This commit is contained in:
Jason Wen
2026-02-16 02:06:26 -05:00
parent 8b1093adf0
commit 6ad719796c

View File

@@ -49,8 +49,6 @@ class VCruiseHelper(VCruiseHelperSP):
self.get_minimum_set_speed(is_metric)
_enabled = self.update_enabled_state(CS, enabled)
if not self.CP.pcmCruise or not self.CP_SP.pcmCruiseSpeed:
self.update_button_timers(CS, enabled)
if CS.cruiseState.available:
if not self.CP.pcmCruise or (not self.CP_SP.pcmCruiseSpeed and _enabled):
@@ -71,6 +69,9 @@ class VCruiseHelper(VCruiseHelperSP):
self.v_cruise_kph = V_CRUISE_UNSET
self.v_cruise_cluster_kph = V_CRUISE_UNSET
if not self.CP.pcmCruise or not self.CP_SP.pcmCruiseSpeed:
self.update_button_timers(CS, enabled)
def _update_v_cruise_non_pcm(self, CS, enabled, is_metric):
# handle button presses. TODO: this should be in state_control, but a decelCruise press
# would have the effect of both enabling and changing speed is checked after the state transition