Skip to content

Commit

Permalink
reverting some code for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Comma Device committed Mar 25, 2020
1 parent 3b78d0e commit 2619acb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
9 changes: 5 additions & 4 deletions panda/board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions panda/board/safety.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 8 additions & 7 deletions selfdrive/car/tesla/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,8 +21,6 @@
K_MULT = 0.8
K_MULTi = 280000.

def tesla_compute_gb(accel, speed):
return float(accel) / 3.


class CarInterface():
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2619acb

Please sign in to comment.