Skip harness relay check if camera is missing
Co-Authored-By: Eric Brown <13560103+nworb-cire@users.noreply.github.com>
This commit is contained in:
parent
6321ac77f4
commit
fc168c38d9
|
@ -275,7 +275,7 @@ void generic_rx_checks(bool stock_ecu_detected) {
|
||||||
regen_braking_prev = regen_braking;
|
regen_braking_prev = regen_braking;
|
||||||
|
|
||||||
// check if stock ECU is on bus broken by car harness
|
// check if stock ECU is on bus broken by car harness
|
||||||
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && stock_ecu_detected) {
|
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && stock_ecu_detected && !gm_skip_relay_check) {
|
||||||
relay_malfunction_set();
|
relay_malfunction_set();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ const uint16_t GM_PARAM_HW_CAM_LONG = 2;
|
||||||
const uint16_t GM_PARAM_HW_SDGM = 4;
|
const uint16_t GM_PARAM_HW_SDGM = 4;
|
||||||
const uint16_t GM_PARAM_CC_LONG = 8;
|
const uint16_t GM_PARAM_CC_LONG = 8;
|
||||||
const uint16_t GM_PARAM_HW_ASCM_LONG = 16;
|
const uint16_t GM_PARAM_HW_ASCM_LONG = 16;
|
||||||
|
const uint16_t GM_PARAM_NO_CAMERA = 32;
|
||||||
const uint16_t GM_PARAM_NO_ACC = 64;
|
const uint16_t GM_PARAM_NO_ACC = 64;
|
||||||
const uint16_t GM_PARAM_PEDAL_LONG = 128; // TODO: this can be inferred
|
const uint16_t GM_PARAM_PEDAL_LONG = 128; // TODO: this can be inferred
|
||||||
const uint16_t GM_PARAM_PEDAL_INTERCEPTOR = 256;
|
const uint16_t GM_PARAM_PEDAL_INTERCEPTOR = 256;
|
||||||
|
@ -83,6 +84,7 @@ bool gm_pcm_cruise = false;
|
||||||
bool gm_has_acc = true;
|
bool gm_has_acc = true;
|
||||||
bool gm_pedal_long = false;
|
bool gm_pedal_long = false;
|
||||||
bool gm_cc_long = false;
|
bool gm_cc_long = false;
|
||||||
|
bool gm_skip_relay_check = false;
|
||||||
bool gm_force_ascm = false;
|
bool gm_force_ascm = false;
|
||||||
|
|
||||||
static void handle_gm_wheel_buttons(const CANPacket_t *to_push) {
|
static void handle_gm_wheel_buttons(const CANPacket_t *to_push) {
|
||||||
|
|
|
@ -237,6 +237,7 @@ class Panda:
|
||||||
FLAG_GM_HW_SDGM = 4
|
FLAG_GM_HW_SDGM = 4
|
||||||
FLAG_GM_CC_LONG = 8
|
FLAG_GM_CC_LONG = 8
|
||||||
FLAG_GM_HW_ASCM_LONG = 16
|
FLAG_GM_HW_ASCM_LONG = 16
|
||||||
|
FLAG_GM_NO_CAMERA = 32
|
||||||
FLAG_GM_NO_ACC = 64
|
FLAG_GM_NO_ACC = 64
|
||||||
FLAG_GM_PEDAL_LONG = 128
|
FLAG_GM_PEDAL_LONG = 128
|
||||||
FLAG_GM_GAS_INTERCEPTOR = 256
|
FLAG_GM_GAS_INTERCEPTOR = 256
|
||||||
|
|
|
@ -49,7 +49,7 @@ class CarState(CarStateBase):
|
||||||
self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0
|
self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0
|
||||||
if self.loopback_lka_steering_cmd_updated:
|
if self.loopback_lka_steering_cmd_updated:
|
||||||
self.loopback_lka_steering_cmd_ts_nanos = loopback_cp.ts_nanos["ASCMLKASteeringCmd"]["RollingCounter"]
|
self.loopback_lka_steering_cmd_ts_nanos = loopback_cp.ts_nanos["ASCMLKASteeringCmd"]["RollingCounter"]
|
||||||
if self.CP.networkLocation == NetworkLocation.fwdCamera:
|
if self.CP.networkLocation == NetworkLocation.fwdCamera and not self.CP.flags & GMFlags.NO_CAMERA.value:
|
||||||
self.pt_lka_steering_cmd_counter = pt_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
|
self.pt_lka_steering_cmd_counter = pt_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
|
||||||
self.cam_lka_steering_cmd_counter = cam_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
|
self.cam_lka_steering_cmd_counter = cam_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
|
||||||
|
|
||||||
|
@ -69,7 +69,10 @@ class CarState(CarStateBase):
|
||||||
else:
|
else:
|
||||||
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(pt_cp.vl["ECMPRDNL2"]["PRNDL2"], None))
|
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(pt_cp.vl["ECMPRDNL2"]["PRNDL2"], None))
|
||||||
|
|
||||||
ret.brake = pt_cp.vl["ECMAcceleratorPos"]["BrakePedalPos"]
|
if self.CP.flags & GMFlags.NO_ACCELERATOR_POS_MSG.value:
|
||||||
|
ret.brake = pt_cp.vl["EBCMBrakePedalPosition"]["BrakePedalPosition"] / 0xd0
|
||||||
|
else:
|
||||||
|
ret.brake = pt_cp.vl["ECMAcceleratorPos"]["BrakePedalPos"]
|
||||||
if self.CP.networkLocation == NetworkLocation.fwdCamera:
|
if self.CP.networkLocation == NetworkLocation.fwdCamera:
|
||||||
ret.brakePressed = pt_cp.vl["ECMEngineStatus"]["BrakePressed"] != 0
|
ret.brakePressed = pt_cp.vl["ECMEngineStatus"]["BrakePressed"] != 0
|
||||||
else:
|
else:
|
||||||
|
@ -136,7 +139,7 @@ class CarState(CarStateBase):
|
||||||
|
|
||||||
ret.cruiseState.enabled = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] != AccState.OFF
|
ret.cruiseState.enabled = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] != AccState.OFF
|
||||||
ret.cruiseState.standstill = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.STANDSTILL
|
ret.cruiseState.standstill = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.STANDSTILL
|
||||||
if self.CP.networkLocation == NetworkLocation.fwdCamera:
|
if self.CP.networkLocation == NetworkLocation.fwdCamera and not self.CP.flags & GMFlags.NO_CAMERA.value:
|
||||||
if self.CP.carFingerprint not in CC_ONLY_CAR:
|
if self.CP.carFingerprint not in CC_ONLY_CAR:
|
||||||
ret.cruiseState.speed = cam_cp.vl["ASCMActiveCruiseControlStatus"]["ACCSpeedSetpoint"] * CV.KPH_TO_MS
|
ret.cruiseState.speed = cam_cp.vl["ASCMActiveCruiseControlStatus"]["ACCSpeedSetpoint"] * CV.KPH_TO_MS
|
||||||
if self.CP.carFingerprint not in SDGM_CAR:
|
if self.CP.carFingerprint not in SDGM_CAR:
|
||||||
|
@ -175,7 +178,7 @@ class CarState(CarStateBase):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_cam_can_parser(CP):
|
def get_cam_can_parser(CP):
|
||||||
messages = []
|
messages = []
|
||||||
if CP.networkLocation == NetworkLocation.fwdCamera:
|
if CP.networkLocation == NetworkLocation.fwdCamera and not CP.flags & GMFlags.NO_CAMERA.value:
|
||||||
messages += [
|
messages += [
|
||||||
("ASCMLKASteeringCmd", 10),
|
("ASCMLKASteeringCmd", 10),
|
||||||
]
|
]
|
||||||
|
@ -235,6 +238,9 @@ class CarState(CarStateBase):
|
||||||
messages += [
|
messages += [
|
||||||
("ASCMLKASteeringCmd", 0),
|
("ASCMLKASteeringCmd", 0),
|
||||||
]
|
]
|
||||||
|
if CP.flags & GMFlags.NO_ACCELERATOR_POS_MSG.value:
|
||||||
|
messages.remove(("ECMAcceleratorPos", 80))
|
||||||
|
messages.append(("EBCMBrakePedalPosition", 100))
|
||||||
|
|
||||||
if CP.transmissionType == TransmissionType.direct:
|
if CP.transmissionType == TransmissionType.direct:
|
||||||
messages += [
|
messages += [
|
||||||
|
|
|
@ -23,6 +23,8 @@ BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.D
|
||||||
FrogPilotEventName = custom.FrogPilotEvents
|
FrogPilotEventName = custom.FrogPilotEvents
|
||||||
|
|
||||||
ACCELERATOR_POS_MSG = 0xbe
|
ACCELERATOR_POS_MSG = 0xbe
|
||||||
|
CAM_MSG = 0x320 # AEBCmd
|
||||||
|
# TODO: Is this always linked to camera presence?
|
||||||
PEDAL_MSG = 0x201
|
PEDAL_MSG = 0x201
|
||||||
|
|
||||||
NON_LINEAR_TORQUE_PARAMS = {
|
NON_LINEAR_TORQUE_PARAMS = {
|
||||||
|
@ -376,6 +378,11 @@ class CarInterface(CarInterfaceBase):
|
||||||
if candidate in CC_ONLY_CAR:
|
if candidate in CC_ONLY_CAR:
|
||||||
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_ACC
|
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_ACC
|
||||||
|
|
||||||
|
# Exception for flashed cars, or cars whose camera was removed
|
||||||
|
if (ret.networkLocation == NetworkLocation.fwdCamera or candidate in CC_ONLY_CAR) and CAM_MSG not in fingerprint[CanBus.CAMERA] and not candidate in SDGM_CAR:
|
||||||
|
ret.flags |= GMFlags.NO_CAMERA.value
|
||||||
|
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_CAMERA
|
||||||
|
|
||||||
if ACCELERATOR_POS_MSG not in fingerprint[CanBus.POWERTRAIN]:
|
if ACCELERATOR_POS_MSG not in fingerprint[CanBus.POWERTRAIN]:
|
||||||
ret.flags |= GMFlags.NO_ACCELERATOR_POS_MSG.value
|
ret.flags |= GMFlags.NO_ACCELERATOR_POS_MSG.value
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import Enum, StrEnum
|
from enum import Enum, IntFlag, StrEnum
|
||||||
from typing import Dict, List, Union
|
from typing import Dict, List, Union
|
||||||
|
|
||||||
from cereal import car
|
from cereal import car
|
||||||
|
@ -181,6 +181,7 @@ class CanBus:
|
||||||
class GMFlags(IntFlag):
|
class GMFlags(IntFlag):
|
||||||
PEDAL_LONG = 1
|
PEDAL_LONG = 1
|
||||||
CC_LONG = 2
|
CC_LONG = 2
|
||||||
|
NO_CAMERA = 4
|
||||||
NO_ACCELERATOR_POS_MSG = 8
|
NO_ACCELERATOR_POS_MSG = 8
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue