From a0a5f49015516aa04d62792ddfa1c3f5273de22f Mon Sep 17 00:00:00 2001 From: BogGyver Date: Wed, 8 Apr 2020 00:37:57 -0400 Subject: [PATCH] fix panda for ibooster and typo in controlsd.py --- panda/board/safety/safety_tesla.h | 10 ++++++++-- selfdrive/car/tesla/carcontroller.py | 2 +- selfdrive/controls/controlsd.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/panda/board/safety/safety_tesla.h b/panda/board/safety/safety_tesla.h index 35c4f82721cd11..0b97abbd975d67 100644 --- a/panda/board/safety/safety_tesla.h +++ b/panda/board/safety/safety_tesla.h @@ -983,8 +983,9 @@ static void do_EPB_epasControl(uint32_t RIR, uint32_t RDTR) { MLB = MLB + (cksm << 16); if (DAS_noEpasHarness == 0) { send_fake_message(RIR,RDTR,3,0x214,2,MLB,MHB); - } // send also on 0 for monitoring - send_fake_message(RIR,RDTR,3,0x214,0,MLB,MHB); + } else { + send_fake_message(RIR,RDTR,3,0x214,0,MLB,MHB); + } EPB_epasControl_idx++; EPB_epasControl_idx = EPB_epasControl_idx % 16; } @@ -2007,6 +2008,11 @@ static int tesla_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) return ret_val; } + if (addr == 0x214) { + //inhibit ibooster epas kill signal + return -1; + } + //forward everything else to CAN 2 unless claiming no harness return ret_val; } diff --git a/selfdrive/car/tesla/carcontroller.py b/selfdrive/car/tesla/carcontroller.py index f513068fb5ba9e..ed57aca4cc5128 100644 --- a/selfdrive/car/tesla/carcontroller.py +++ b/selfdrive/car/tesla/carcontroller.py @@ -578,7 +578,7 @@ def update(self, enabled, CS, frame, actuators, \ if send_fake_msg: if enable_steer_control and op_status == 3: op_status = 0x5 - park_brake_request = int(CS.ahbEnabled) + park_brake_request = 0 #experimental; disabled for now if park_brake_request == 1: print("Park Brake Request received") adaptive_cruise = 1 if (not self.PCC.pcc_available and self.ACC.adaptive) or self.PCC.pcc_available else 0 diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index aeb19a46e7e667..08581c157136ec 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -553,7 +553,7 @@ def controlsd_thread(sm=None, pm=None, can_sock=None): logAllAliveAndValidInfoToTinklad(sm=sm, tinklaClient=tinklaClient) if not sm['pathPlan'].mpcSolutionValid: events.append(create_event('plannerError', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) - if not sm['pathPlan'].sensorValid and os.getenf("NOSENSOR") is None: + if not sm['pathPlan'].sensorValid and os.getenv("NOSENSOR") is None: events.append(create_event('sensorDataInvalid', [ET.NO_ENTRY, ET.PERMANENT])) if not sm['pathPlan'].paramsValid: events.append(create_event('vehicleModelInvalid', [ET.WARNING]))