mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-31 05:03:42 +08:00
9ms
This commit is contained in:
@@ -173,7 +173,7 @@ class CarController(CarControllerBase):
|
||||
# Midpoint spoof: one per interval
|
||||
if not self.spoof_mid_sent and interval_ns > 0:
|
||||
midpoint_ns = self.prev_steer_ts_ns + interval_ns // 2
|
||||
if now_nanos >= midpoint_ns and now_nanos - self.last_steer_ts_ns >= 8_000_000:
|
||||
if now_nanos >= midpoint_ns and now_nanos - self.last_steer_ts_ns >= 9_000_000:
|
||||
paddle_sends.append(gmcan.create_prndl2_command(self.packer_pt, CanBus.POWERTRAIN, True))
|
||||
paddle_sends.append(gmcan.create_regen_paddle_command(self.packer_pt, CanBus.POWERTRAIN, True))
|
||||
self.last_spoof_ts_ns = now_nanos
|
||||
@@ -182,7 +182,7 @@ class CarController(CarControllerBase):
|
||||
# Overflow spoof: insert extra when accumulator allows
|
||||
if self.spoof_accum >= 0.8 and not self.spoof_over_sent and interval_ns > 0:
|
||||
slot2_ns = self.prev_steer_ts_ns + (interval_ns * 2) // 3
|
||||
if now_nanos >= slot2_ns and now_nanos - self.last_steer_ts_ns >= 8_000_000:
|
||||
if now_nanos >= slot2_ns and now_nanos - self.last_steer_ts_ns >= 9_000_000:
|
||||
paddle_sends.append(gmcan.create_prndl2_command(self.packer_pt, CanBus.POWERTRAIN, True))
|
||||
paddle_sends.append(gmcan.create_regen_paddle_command(self.packer_pt, CanBus.POWERTRAIN, True))
|
||||
self.last_spoof_ts_ns = now_nanos
|
||||
@@ -203,7 +203,7 @@ class CarController(CarControllerBase):
|
||||
|
||||
if hasattr(self, "off_schedule_ns"):
|
||||
for i, t_ns in enumerate(self.off_schedule_ns):
|
||||
if not self.off_sent[i] and now_nanos >= t_ns and now_nanos - self.last_steer_ts_ns >= 8_000_000:
|
||||
if not self.off_sent[i] and now_nanos >= t_ns and now_nanos - self.last_steer_ts_ns >= 9_000_000:
|
||||
paddle_sends.append(gmcan.create_prndl2_command(self.packer_pt, CanBus.POWERTRAIN, False))
|
||||
paddle_sends.append(gmcan.create_regen_paddle_command(self.packer_pt, CanBus.POWERTRAIN, False))
|
||||
self.off_sent[i] = True
|
||||
@@ -255,8 +255,8 @@ class CarController(CarControllerBase):
|
||||
|
||||
# Merge paddle spoof CAN frames, time-guarded only
|
||||
if paddle_sends:
|
||||
# wait at least 8 ms after the last bus0 steer send
|
||||
if now_nanos - self.last_steer_ts_ns >= 8_000_000:
|
||||
# wait at least 9 ms after the last bus0 steer send
|
||||
if now_nanos - self.last_steer_ts_ns >= 9_000_000:
|
||||
can_sends.extend(paddle_sends)
|
||||
|
||||
if self.CP.openpilotLongitudinalControl:
|
||||
|
||||
Reference in New Issue
Block a user