Skip to content

Commit

Permalink
Hyundai CAN-FD: common brake pressed signal (commaai#1113)
Browse files Browse the repository at this point in the history
* Hyundai CAN-FD: common brake pressed signal

* change bit

Co-authored-by: Shane Smiskol <shane@smiskol.com>
  • Loading branch information
adeebshihadeh and sshane authored Oct 21, 2022
1 parent 54f9390 commit fcb1a5a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.panda
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"

ENV PANDA_PATH=/tmp/openpilot/panda
ENV OPENPILOT_REF="96e8d5c9fe1a8084dfa5d97c78d4ea2037272420"
ENV OPENDBC_REF="04cc54d5e662aaf708f72cabb65507c7dbb5136d"
ENV OPENDBC_REF="7bd94e3ff4a2890eb69118f0dfadb64f9d32d618"

COPY requirements.txt /tmp/
RUN pyenv install 3.8.10 && \
Expand Down
8 changes: 4 additions & 4 deletions board/safety/safety_hyundai_canfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ AddrCheckStruct hyundai_canfd_addr_checks[] = {
{.msg = {{0x35, 1, 32, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 10000U},
{0x35, 0, 32, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 10000U},
{0x105, 0, 32, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 10000U}}},
{.msg = {{0x65, 1, 32, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 10000U},
{0x65, 0, 32, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 10000U}, { 0 }}},
{.msg = {{0x175, 1, 24, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 20000U},
{0x175, 0, 24, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 20000U}, { 0 }}},
{.msg = {{0xa0, 1, 24, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 10000U},
{0xa0, 0, 24, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 10000U}, { 0 }}},
{.msg = {{0xea, 1, 24, .check_checksum = true, .max_counter = 0xffU, .expected_timestep = 10000U},
Expand Down Expand Up @@ -180,8 +180,8 @@ static int hyundai_canfd_rx_hook(CANPacket_t *to_push) {
}

// brake press
if (addr == 0x65) {
brake_pressed = GET_BIT(to_push, 57U) != 0U;
if (addr == 0x175) {
brake_pressed = GET_BIT(to_push, 81U) != 0U;
}

// vehicle moving
Expand Down
4 changes: 2 additions & 2 deletions tests/safety/test_hyundai_canfd.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def _speed_msg(self, speed):
return self.packer.make_can_msg_panda("WHEEL_SPEEDS", self.PT_BUS, values)

def _user_brake_msg(self, brake):
values = {"BRAKE_PRESSED": brake}
return self.packer.make_can_msg_panda("BRAKE", self.PT_BUS, values)
values = {"DriverBraking": brake}
return self.packer.make_can_msg_panda("TCS", self.PT_BUS, values)

def _user_gas_msg(self, gas):
values = {"ACCELERATOR_PEDAL": gas}
Expand Down

0 comments on commit fcb1a5a

Please sign in to comment.