From 8dc543533109af6aa0220170b69acc1a44521bb7 Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Wed, 18 Dec 2024 15:17:18 -0700 Subject: [PATCH 1/3] Subaru: combine platform panda flags (#2115) Subaru: combine panda flags --- board/safety/safety_subaru_preglobal.h | 2 +- python/__init__.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/board/safety/safety_subaru_preglobal.h b/board/safety/safety_subaru_preglobal.h index 760840f333..a1efdfe655 100644 --- a/board/safety/safety_subaru_preglobal.h +++ b/board/safety/safety_subaru_preglobal.h @@ -115,7 +115,7 @@ static safety_config subaru_preglobal_init(uint16_t param) { {.msg = {{MSG_SUBARU_PG_CruiseControl, SUBARU_PG_MAIN_BUS, 8, .frequency = 20U}, { 0 }, { 0 }}}, }; - const int SUBARU_PG_PARAM_REVERSED_DRIVER_TORQUE = 1; + const int SUBARU_PG_PARAM_REVERSED_DRIVER_TORQUE = 4; subaru_pg_reversed_driver_torque = GET_FLAG(param, SUBARU_PG_PARAM_REVERSED_DRIVER_TORQUE); return BUILD_SAFETY_CFG(subaru_preglobal_rx_checks, SUBARU_PG_TX_MSGS); diff --git a/python/__init__.py b/python/__init__.py index 4e729d30a5..36227269b7 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -215,8 +215,7 @@ class Panda: FLAG_SUBARU_GEN2 = 1 FLAG_SUBARU_LONG = 2 - - FLAG_SUBARU_PREGLOBAL_REVERSED_DRIVER_TORQUE = 1 + FLAG_SUBARU_PREGLOBAL_REVERSED_DRIVER_TORQUE = 4 FLAG_NISSAN_ALT_EPS_BUS = 1 From 4ca9905011ba875efa4278b2dcb507a759b0e13e Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 22 Dec 2024 09:56:44 -0800 Subject: [PATCH 2/3] cuatro: enable SOM reset --- board/boards/cuatro.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/boards/cuatro.h b/board/boards/cuatro.h index 5d4bdad43f..a8f6516f61 100644 --- a/board/boards/cuatro.h +++ b/board/boards/cuatro.h @@ -67,8 +67,8 @@ static void cuatro_set_fan_enabled(bool enabled) { static void cuatro_set_bootkick(BootState state) { set_gpio_output(GPIOA, 0, state != BOOT_BOOTKICK); - // only use if we have to - //set_gpio_output(GPIOC, 12, state != BOOT_RESET); + // TODO: confirm we need this + set_gpio_output(GPIOC, 12, state != BOOT_RESET); } static void cuatro_set_amp_enabled(bool enabled){ From 6ee9c8d85a0e27ef72df685195d59d951a8b9c45 Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Sun, 22 Dec 2024 13:30:08 -0700 Subject: [PATCH 3/3] Auto-fix ruff errors in uds.py (#2118) --- python/uds.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/uds.py b/python/uds.py index 612eb206b0..1fa5e730a4 100644 --- a/python/uds.py +++ b/python/uds.py @@ -1,7 +1,7 @@ import time import struct from collections import deque -from typing import NamedTuple, Deque, cast +from typing import NamedTuple, cast from collections.abc import Callable, Generator from enum import IntEnum from functools import partial @@ -300,14 +300,14 @@ def get_dtc_status_names(status): result.append(m.name) return result -class CanClient(): +class CanClient: def __init__(self, can_send: Callable[[int, bytes, int], None], can_recv: Callable[[], list[tuple[int, bytes, int]]], tx_addr: int, rx_addr: int, bus: int, sub_addr: int | None = None, debug: bool = False): self.tx = can_send self.rx = can_recv self.tx_addr = tx_addr self.rx_addr = rx_addr - self.rx_buff: Deque[bytes] = deque() + self.rx_buff: deque[bytes] = deque() self.sub_addr = sub_addr self.bus = bus self.debug = debug @@ -386,7 +386,7 @@ def send(self, msgs: list[bytes], delay: float = 0) -> None: if i % 10 == 9: self._recv_buffer() -class IsoTpMessage(): +class IsoTpMessage: def __init__(self, can_client: CanClient, timeout: float = 1, single_frame_mode: bool = False, separation_time: float = 0, debug: bool = False, max_len: int = 8): self._can_client = can_client @@ -575,7 +575,7 @@ def get_rx_addr_for_tx_addr(tx_addr, rx_offset=0x8): raise ValueError(f"invalid tx_addr: {tx_addr}") -class UdsClient(): +class UdsClient: def __init__(self, panda, tx_addr: int, rx_addr: int | None = None, bus: int = 0, sub_addr: int | None = None, timeout: float = 1, debug: bool = False, tx_timeout: float = 1, response_pending_timeout: float = 10): self.bus = bus