Set speed offset
Added toggle to apply an offset to the set speed. Co-Authored-By: Tim Wilson <7284371+twilsonco@users.noreply.github.com>
This commit is contained in:
@@ -1108,6 +1108,7 @@ class Controls:
|
||||
quality_of_life = self.params.get_bool("QOLControls")
|
||||
self.pause_lateral_on_signal = self.params.get_int("PauseLateralOnSignal") * (CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS) if quality_of_life else 0
|
||||
self.frogpilot_variables.reverse_cruise_increase = quality_of_life and self.params.get_bool("ReverseCruise")
|
||||
self.frogpilot_variables.set_speed_offset = self.params.get_int("SetSpeedOffset") * (1 if self.is_metric else CV.MPH_TO_KPH) if quality_of_life else 0
|
||||
|
||||
def main():
|
||||
controls = Controls()
|
||||
|
||||
@@ -114,6 +114,12 @@ class VCruiseHelper:
|
||||
else:
|
||||
self.v_cruise_kph += v_cruise_delta * CRUISE_INTERVAL_SIGN[button_type]
|
||||
|
||||
# Apply offset
|
||||
v_cruise_offset = (frogpilot_variables.set_speed_offset * CRUISE_INTERVAL_SIGN[button_type]) if long_press else 0
|
||||
if v_cruise_offset < 0:
|
||||
v_cruise_offset = frogpilot_variables.set_speed_offset - v_cruise_delta
|
||||
self.v_cruise_kph += v_cruise_offset
|
||||
|
||||
# If set is pressed while overriding, clip cruise speed to minimum of vEgo
|
||||
if CS.gasPressed and button_type in (ButtonType.decelCruise, ButtonType.setCruise):
|
||||
self.v_cruise_kph = max(self.v_cruise_kph, CS.vEgo * CV.MS_TO_KPH)
|
||||
|
||||
Reference in New Issue
Block a user