From eedcfe3c56983325f4079e25eb729818bf7e0791 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Fri, 1 May 2026 00:12:31 -0500 Subject: [PATCH] bumpity --- .../opendbc/car/honda/fingerprints.py | 5 ++ opendbc_repo/opendbc/car/honda/interface.py | 34 +++++++++++--- .../opendbc/car/honda/tests/test_honda.py | 47 +++++++++++++++++++ 3 files changed, 79 insertions(+), 7 deletions(-) diff --git a/opendbc_repo/opendbc/car/honda/fingerprints.py b/opendbc_repo/opendbc/car/honda/fingerprints.py index 0133dca02..a7c21d001 100644 --- a/opendbc_repo/opendbc/car/honda/fingerprints.py +++ b/opendbc_repo/opendbc/car/honda/fingerprints.py @@ -84,6 +84,7 @@ FW_VERSIONS = { ], (Ecu.eps, 0x18da30f1, None): [ b'39990-TBX-H120\x00\x00', + b'39990-TVA,A150\x00\x00', b'39990-TVA-A140\x00\x00', b'39990-TVA-A150\x00\x00', b'39990-TVA-A160\x00\x00', @@ -163,6 +164,7 @@ FW_VERSIONS = { b'57114-TEA-Q220\x00\x00', ], (Ecu.eps, 0x18da30f1, None): [ + b'39990-TBA,A030\x00\x00', b'39990-TBA-A030\x00\x00', b'39990-TBG-A030\x00\x00', b'39990-TEA-T020\x00\x00', @@ -235,6 +237,8 @@ FW_VERSIONS = { b'39990-TEA-T330\x00\x00', b'39990-TEA-T820\x00\x00', b'39990-TEZ-T020\x00\x00', + b'39990-TGG,A020\x00\x00', + b'39990-TGG,A120\x00\x00', b'39990-TGG-A020\x00\x00', b'39990-TGG-A120\x00\x00', b'39990-TGG-J510\x00\x00', @@ -368,6 +372,7 @@ FW_VERSIONS = { b'57114-TMC-Z050\x00\x00', ], (Ecu.eps, 0x18da30f1, None): [ + b'39990-TLA,A040\x00\x00', b'39990-TLA-A040\x00\x00', b'39990-TLA-A110\x00\x00', b'39990-TLA-A220\x00\x00', diff --git a/opendbc_repo/opendbc/car/honda/interface.py b/opendbc_repo/opendbc/car/honda/interface.py index 897c1fcd3..913b7adb0 100644 --- a/opendbc_repo/opendbc/car/honda/interface.py +++ b/opendbc_repo/opendbc/car/honda/interface.py @@ -90,14 +90,24 @@ class CarInterface(CarInterfaceBase): ret.longitudinalTuning.kiBP = [0., 5., 35.] ret.longitudinalTuning.kiV = [1.2, 0.8, 0.5] - # Disable control if EPS mod detected + eps_modified = False for fw in car_fw: if fw.ecu == "eps" and b"," in fw.fwVersion: - ret.dashcamOnly = True + eps_modified = True if candidate == CAR.HONDA_CIVIC: - ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]] - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]] + if eps_modified: + # stock request input values: 0x0000, 0x00DE, 0x014D, 0x01EF, 0x0290, 0x0377, 0x0454, 0x0610, 0x06EE + # stock request output values: 0x0000, 0x0917, 0x0DC5, 0x1017, 0x119F, 0x140B, 0x1680, 0x1680, 0x1680 + # modified request output values: 0x0000, 0x0917, 0x0DC5, 0x1017, 0x119F, 0x140B, 0x1680, 0x2880, 0x3180 + # stock filter output values: 0x009F, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108 + # modified filter output values: 0x009F, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0108, 0x0400, 0x0480 + # note: max request allowed is 4096, but request is capped at 3840 in firmware, so modifications result in 2x max + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560, 8000], [0, 2560, 3840]] + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.1]] + else: + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]] + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]] elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end @@ -112,7 +122,10 @@ class CarInterface(CarInterfaceBase): elif candidate == CAR.HONDA_ACCORD: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] + if eps_modified: + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.09]] + else: + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] elif candidate == CAR.ACURA_ILX: ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] # TODO: determine if there is a dead zone at the top end @@ -124,8 +137,15 @@ class CarInterface(CarInterfaceBase): ret.wheelSpeedFactor = 1.025 elif candidate == CAR.HONDA_CRV_5G: - ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] - ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.64], [0.192]] + if eps_modified: + # stock request input values: 0x0000, 0x00DB, 0x01BB, 0x0296, 0x0377, 0x0454, 0x0532, 0x0610, 0x067F + # stock request output values: 0x0000, 0x0500, 0x0A15, 0x0E6D, 0x1100, 0x1200, 0x129A, 0x134D, 0x1400 + # modified request output values: 0x0000, 0x0500, 0x0A15, 0x0E6D, 0x1100, 0x1200, 0x1ACD, 0x239A, 0x2800 + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560, 10000], [0, 2560, 3840]] + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.21], [0.07]] + else: + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 3840], [0, 3840]] + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.64], [0.192]] ret.wheelSpeedFactor = 1.025 elif candidate == CAR.HONDA_CRV_HYBRID: diff --git a/opendbc_repo/opendbc/car/honda/tests/test_honda.py b/opendbc_repo/opendbc/car/honda/tests/test_honda.py index ec91081bd..8716453ec 100644 --- a/opendbc_repo/opendbc/car/honda/tests/test_honda.py +++ b/opendbc_repo/opendbc/car/honda/tests/test_honda.py @@ -1,6 +1,10 @@ import re +from types import SimpleNamespace +import pytest from opendbc.car.structs import CarParams +from opendbc.car import gen_empty_fingerprint +from opendbc.car.honda.interface import CarInterface from opendbc.car.honda.carcontroller import ( CIVIC_BOSCH_MODIFIED_STEER_CAN_MAX, get_civic_bosch_modified_steer_can_max, @@ -53,3 +57,46 @@ class TestHondaFingerprint: def test_modified_civic_steering_pressed_filter_allows_opposing_driver_torque_quickly(self): filter_s, pressed = get_civic_bosch_modified_steering_pressed(True, -1500.0, 0.8, 0.11, False) assert pressed + + def test_official_modified_eps_firmwares_restored(self): + assert b'39990-TVA,A150\x00\x00' in FW_VERSIONS[CAR.HONDA_ACCORD][(CarParams.Ecu.eps, 0x18da30f1, None)] + assert b'39990-TBA,A030\x00\x00' in FW_VERSIONS[CAR.HONDA_CIVIC][(CarParams.Ecu.eps, 0x18da30f1, None)] + assert b'39990-TGG,A020\x00\x00' in FW_VERSIONS[CAR.HONDA_CIVIC_BOSCH][(CarParams.Ecu.eps, 0x18da30f1, None)] + assert b'39990-TLA,A040\x00\x00' in FW_VERSIONS[CAR.HONDA_CRV_5G][(CarParams.Ecu.eps, 0x18da30f1, None)] + + def test_modified_eps_candidates_keep_support_and_restore_upstream_tunes(self): + toggles = SimpleNamespace(force_torque_controller=False, nnff=False, nnff_lite=False) + + civic_fw = [CarParams.CarFw(ecu=CarParams.Ecu.eps, fwVersion=b'39990-TBA,A030\x00\x00', address=0x18da30f1, subAddress=0)] + civic_cp = CarInterface.get_params(CAR.HONDA_CIVIC, gen_empty_fingerprint(), civic_fw, False, False, False, toggles) + assert not civic_cp.dashcamOnly + assert list(civic_cp.lateralParams.torqueBP) == [0, 2560, 8000] + assert list(civic_cp.lateralParams.torqueV) == [0, 2560, 3840] + assert list(civic_cp.lateralTuning.pid.kpV) == pytest.approx([0.3]) + assert list(civic_cp.lateralTuning.pid.kiV) == pytest.approx([0.1]) + + accord_fw = [CarParams.CarFw(ecu=CarParams.Ecu.eps, fwVersion=b'39990-TVA,A150\x00\x00', address=0x18da30f1, subAddress=0)] + accord_cp = CarInterface.get_params(CAR.HONDA_ACCORD, gen_empty_fingerprint(), accord_fw, False, False, False, toggles) + assert not accord_cp.dashcamOnly + assert list(accord_cp.lateralTuning.pid.kpV) == pytest.approx([0.3]) + assert list(accord_cp.lateralTuning.pid.kiV) == pytest.approx([0.09]) + + crv_fw = [CarParams.CarFw(ecu=CarParams.Ecu.eps, fwVersion=b'39990-TLA,A040\x00\x00', address=0x18da30f1, subAddress=0)] + crv_cp = CarInterface.get_params(CAR.HONDA_CRV_5G, gen_empty_fingerprint(), crv_fw, False, False, False, toggles) + assert not crv_cp.dashcamOnly + assert list(crv_cp.lateralParams.torqueBP) == [0, 2560, 10000] + assert list(crv_cp.lateralParams.torqueV) == [0, 2560, 3840] + assert list(crv_cp.lateralTuning.pid.kpV) == pytest.approx([0.21]) + assert list(crv_cp.lateralTuning.pid.kiV) == pytest.approx([0.07]) + + def test_modified_civic_bosch_keeps_official_support(self): + toggles = SimpleNamespace(force_torque_controller=False, nnff=False, nnff_lite=False) + car_fw = [CarParams.CarFw(ecu=CarParams.Ecu.eps, fwVersion=b'39990-TGG,A020\x00\x00', address=0x18da30f1, subAddress=0)] + + CP = CarInterface.get_params(CAR.HONDA_CIVIC_BOSCH, gen_empty_fingerprint(), car_fw, False, False, False, toggles) + + assert not CP.dashcamOnly + assert list(CP.lateralParams.torqueBP) == [0, 4096] + assert list(CP.lateralParams.torqueV) == [0, 4096] + assert list(CP.lateralTuning.pid.kpV) == pytest.approx([0.8]) + assert list(CP.lateralTuning.pid.kiV) == pytest.approx([0.24])