wip
This commit is contained in:
@@ -59,6 +59,7 @@ class CarController:
|
|||||||
self.apply_steer_last = 0
|
self.apply_steer_last = 0
|
||||||
self.car_fingerprint = CP.carFingerprint
|
self.car_fingerprint = CP.carFingerprint
|
||||||
self.last_button_frame = 0
|
self.last_button_frame = 0
|
||||||
|
self.last_resume_frame = 0
|
||||||
|
|
||||||
def update(self, CC, CS, now_nanos, sport_plus):
|
def update(self, CC, CS, now_nanos, sport_plus):
|
||||||
actuators = CC.actuators
|
actuators = CC.actuators
|
||||||
@@ -241,9 +242,9 @@ class CarController:
|
|||||||
# Test this...
|
# Test this...
|
||||||
# Also try create_acc_commands
|
# Also try create_acc_commands
|
||||||
# This attempts to set the speed to
|
# This attempts to set the speed to
|
||||||
stopping = CC.actuators.longControlState == LongCtrlState.stopping
|
# stopping = CC.actuators.longControlState == LongCtrlState.stopping
|
||||||
can_sends.append(hyundaicanfd.create_acc_control(self.packer, self.CAN, CC.enabled, self.accel_last, CC.actuators.accel, stopping, CC.cruiseControl.override,
|
# can_sends.append(hyundaicanfd.create_acc_control(self.packer, self.CAN, CC.enabled, self.accel_last, CC.actuators.accel, stopping, CC.cruiseControl.override,
|
||||||
40, CS.personality_profile))
|
# 40, CS.personality_profile))
|
||||||
|
|
||||||
# cruise cancel
|
# cruise cancel
|
||||||
if CC.cruiseControl.cancel:
|
if CC.cruiseControl.cancel:
|
||||||
@@ -257,18 +258,21 @@ class CarController:
|
|||||||
|
|
||||||
# cruise standstill resume
|
# cruise standstill resume
|
||||||
elif CC.cruiseControl.resume:
|
elif CC.cruiseControl.resume:
|
||||||
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
|
if (self.frame - self.last_button_frame) * DT_CTRL > 4:
|
||||||
# oscar - test me
|
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
|
||||||
for _ in range(20):
|
# for _ in range(20):
|
||||||
# can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL))
|
nothing = 0
|
||||||
can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.RES_ACCEL))
|
# Nothing for now --?
|
||||||
self.last_button_frame = self.frame
|
# oscar - test me
|
||||||
else:
|
# can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL))
|
||||||
for _ in range(20):
|
# can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.RES_ACCEL))
|
||||||
can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.RES_ACCEL))
|
else:
|
||||||
|
for _ in range(20):
|
||||||
|
can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.RES_ACCEL))
|
||||||
self.last_button_frame = self.frame
|
self.last_button_frame = self.frame
|
||||||
|
self.last_resume_frame = self.frame
|
||||||
|
|
||||||
elif set_speed_in_units is not None and not self.CP.openpilotLongitudinalControl and CS.cruiseState.available and not CS.out.gasPressed and CS.cruise_buttons == Buttons.NONE:
|
elif set_speed_in_units is not None and not self.CP.openpilotLongitudinalControl and CS.cruiseState.enabled and not CS.out.gasPressed and CS.cruise_buttons == Buttons.NONE:
|
||||||
# if False and not self.CP.openpilotLongitudinalControl and CC.enabled and CC.experimental_mode and CS.cruiseState.available and not CS.out.gasPressed and CS.cruise_buttons == Buttons.NONE:
|
# if False and not self.CP.openpilotLongitudinalControl and CC.enabled and CC.experimental_mode and CS.cruiseState.available and not CS.out.gasPressed and CS.cruise_buttons == Buttons.NONE:
|
||||||
# # cslcSetSpeed = get_set_speed(self, hud_v_cruise)
|
# # cslcSetSpeed = get_set_speed(self, hud_v_cruise)
|
||||||
cslcSetSpeed = set_speed_in_units
|
cslcSetSpeed = set_speed_in_units
|
||||||
|
|||||||
Reference in New Issue
Block a user