|
|
@ -113,8 +113,8 @@ class Controls: |
|
|
|
car_recognized = self.CP.carName != 'mock' |
|
|
|
car_recognized = self.CP.carName != 'mock' |
|
|
|
|
|
|
|
|
|
|
|
controller_available = self.CI.CC is not None and not passive and not self.CP.dashcamOnly |
|
|
|
controller_available = self.CI.CC is not None and not passive and not self.CP.dashcamOnly |
|
|
|
self.read_only = not car_recognized or not controller_available or self.CP.dashcamOnly |
|
|
|
self.CP.passive = not car_recognized or not controller_available or self.CP.dashcamOnly |
|
|
|
if self.read_only: |
|
|
|
if self.CP.passive: |
|
|
|
safety_config = car.CarParams.SafetyConfig.new_message() |
|
|
|
safety_config = car.CarParams.SafetyConfig.new_message() |
|
|
|
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput |
|
|
|
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput |
|
|
|
self.CP.safetyConfigs = [safety_config] |
|
|
|
self.CP.safetyConfigs = [safety_config] |
|
|
@ -189,7 +189,7 @@ class Controls: |
|
|
|
set_offroad_alert("Offroad_CarUnrecognized", True) |
|
|
|
set_offroad_alert("Offroad_CarUnrecognized", True) |
|
|
|
else: |
|
|
|
else: |
|
|
|
set_offroad_alert("Offroad_NoFirmware", True) |
|
|
|
set_offroad_alert("Offroad_NoFirmware", True) |
|
|
|
elif self.read_only: |
|
|
|
elif self.CP.passive: |
|
|
|
self.events.add(EventName.dashcamMode, static=True) |
|
|
|
self.events.add(EventName.dashcamMode, static=True) |
|
|
|
elif self.joystick_mode: |
|
|
|
elif self.joystick_mode: |
|
|
|
self.events.add(EventName.joystickDebug, static=True) |
|
|
|
self.events.add(EventName.joystickDebug, static=True) |
|
|
@ -225,7 +225,7 @@ class Controls: |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
# no more events while in dashcam mode |
|
|
|
# no more events while in dashcam mode |
|
|
|
if self.read_only: |
|
|
|
if self.CP.passive: |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
# Block resume if cruise never previously enabled |
|
|
|
# Block resume if cruise never previously enabled |
|
|
@ -440,7 +440,7 @@ class Controls: |
|
|
|
if VisionStreamType.VISION_STREAM_WIDE_ROAD not in available_streams: |
|
|
|
if VisionStreamType.VISION_STREAM_WIDE_ROAD not in available_streams: |
|
|
|
self.sm.ignore_alive.append('wideRoadCameraState') |
|
|
|
self.sm.ignore_alive.append('wideRoadCameraState') |
|
|
|
|
|
|
|
|
|
|
|
if not self.read_only: |
|
|
|
if not self.CP.passive: |
|
|
|
self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan']) |
|
|
|
self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan']) |
|
|
|
|
|
|
|
|
|
|
|
self.initialized = True |
|
|
|
self.initialized = True |
|
|
@ -745,7 +745,7 @@ class Controls: |
|
|
|
if current_alert: |
|
|
|
if current_alert: |
|
|
|
hudControl.visualAlert = current_alert.visual_alert |
|
|
|
hudControl.visualAlert = current_alert.visual_alert |
|
|
|
|
|
|
|
|
|
|
|
if not self.read_only and self.initialized: |
|
|
|
if not self.CP.passive and self.initialized: |
|
|
|
# send car controls over can |
|
|
|
# send car controls over can |
|
|
|
now_nanos = self.can_log_mono_time if REPLAY else int(time.monotonic() * 1e9) |
|
|
|
now_nanos = self.can_log_mono_time if REPLAY else int(time.monotonic() * 1e9) |
|
|
|
self.last_actuators, can_sends = self.CI.apply(CC, now_nanos) |
|
|
|
self.last_actuators, can_sends = self.CI.apply(CC, now_nanos) |
|
|
@ -860,7 +860,7 @@ class Controls: |
|
|
|
self.update_events(CS) |
|
|
|
self.update_events(CS) |
|
|
|
cloudlog.timestamp("Events updated") |
|
|
|
cloudlog.timestamp("Events updated") |
|
|
|
|
|
|
|
|
|
|
|
if not self.read_only and self.initialized: |
|
|
|
if not self.CP.passive and self.initialized: |
|
|
|
# Update control state |
|
|
|
# Update control state |
|
|
|
self.state_transition(CS) |
|
|
|
self.state_transition(CS) |
|
|
|
self.prof.checkpoint("State transition") |
|
|
|
self.prof.checkpoint("State transition") |
|
|
|