diff --git a/panda/board/main.c b/panda/board/main.c index 0b0ae586749c00..d94fbf5247b020 100644 --- a/panda/board/main.c +++ b/panda/board/main.c @@ -108,24 +108,24 @@ void debug_ring_callback(uart_ring *ring) { // ****************************** safety mode ****************************** // this is the only way to leave silent mode -void set_safety_mode(uint16_t mode, int16_t param) { +void set_safety_mode2(uint16_t mode, int16_t param) { //BB to prevent any changes to safety UNUSED(mode); UNUSED(param); } // this is the only way to leave silent mode -void set_safety_mode2(uint16_t mode, int16_t param) { +void set_safety_mode(uint16_t mode, int16_t param) { if (prev_safety_mode == mode) { return; } //BB we had this now they changed it to below: int err = safety_set_mode2(mode, param); uint16_t mode_copy = mode; - int err = set_safety_hooks(mode_copy, param); + int err = set_safety_hooks2(mode_copy, param); if (err == -1) { puts("Error: safety set mode failed. Falling back to SILENT\n"); mode_copy = SAFETY_SILENT; - err = set_safety_hooks(mode_copy, 0); + err = set_safety_hooks2(mode_copy, 0); if (err == -1) { puts("Error: Failed setting SILENT mode. Hanging\n"); while (true) { @@ -826,6 +826,7 @@ int main(void) { // init to SILENT and can silent set_safety_mode(SAFETY_SILENT, 0); + //set_safety_mode(SAFETY_TESLA,0 ); // enable CAN TXs current_board->enable_can_transcievers(true); diff --git a/panda/board/safety.h b/panda/board/safety.h index c7e438e2d9378f..4dd3bd134288ca 100644 --- a/panda/board/safety.h +++ b/panda/board/safety.h @@ -215,14 +215,14 @@ const safety_hook_config safety_hook_registry[] = { }; int current_safety = -1; -int set_safety_hooks(uint16_t mode, int16_t param) { +int set_safety_hooks2(uint16_t mode, int16_t param) { //BB prevent resetting if already in the correct mode UNUSED(mode); UNUSED(param); return 1; } -int set_safety_hooks2(uint16_t mode, int16_t param) { +int set_safety_hooks(uint16_t mode, int16_t param) { safety_mode_cnt = 0U; // reset safety mode timer int set_status = -1; // not set int hook_config_count = sizeof(safety_hook_registry) / sizeof(safety_hook_config); diff --git a/selfdrive/car/tesla/interface.py b/selfdrive/car/tesla/interface.py index 887913151692e1..c8ab1d79833daa 100644 --- a/selfdrive/car/tesla/interface.py +++ b/selfdrive/car/tesla/interface.py @@ -8,7 +8,7 @@ from selfdrive.car.tesla.carstate import CarState, get_can_parser, get_epas_parser, get_pedal_parser from selfdrive.car.tesla.values import CruiseButtons, CM, BP, AH, CAR,DBC from common.params import read_db -from selfdrive.car import STD_CARGO_KG +from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, is_ecu_disconnected, gen_empty_fingerprint from selfdrive.car.tesla.readconfig import CarSettings import selfdrive.messaging as messaging from cereal.services import service_list @@ -21,8 +21,6 @@ K_MULT = 0.8 K_MULTi = 280000. -def tesla_compute_gb(accel, speed): - return float(accel) / 3. class CarInterface(): @@ -57,8 +55,11 @@ def __init__(self, CP, CarController): if CarController is not None: self.CC = CarController(self.cp.dbc_name) - self.compute_gb = tesla_compute_gb - + + @staticmethod + def compute_gb(accel, speed): + return float(accel) / 3. + @staticmethod @@ -93,12 +94,12 @@ def calc_accel_override(a_ego, a_target, v_ego, v_target): return float(max(max_accel, a_target / A_ACC_MAX)) * min(speedLimiter, accelLimiter) @staticmethod - def get_params(candidate, fingerprint, vin="", is_panda_black=False): + def get_params(candidate, fingerprint=gen_empty_fingerprint(), has_relay=False, car_fw=[]): # Scaled tire stiffness ts_factor = 8 - ret = car.CarParams.new_message() + ret = CarInterfaceBase.get_std_params(candidate, fingerprint, has_relay) ret.carName = "tesla" ret.carFingerprint = candidate