81 Commits

Author SHA1 Message Date
infiniteCable2
b8c700137a Merge branch 'master' of https://github.com/sunnypilot/opendbc into sync 2026-01-25 11:48:11 +01:00
Adeeb Shihadeh
edf19be8ef ty: less ignores (#2994)
* less ignore

* one more

* one more

* lil more
2025-12-28 00:44:48 -08:00
Adeeb Shihadeh
fe7dbcfd59 Add ty type checker (#2993) 2025-12-28 00:26:14 -08:00
infiniteCable2
24845a2b4b Merge branch 'master' of https://github.com/sunnypilot/opendbc into sync 2025-12-18 18:06:16 +01:00
Logesh R
18c1f081c0 can: cache DBC parsing to speed up car interface tests (#2888)
* can: cache DBC parsing to speed up car interface tests

- Keep a class-level cache of parsed DBC files so each path is parsed once per process
- Return early in CANParser.update when no frames arrive to avoid needless work
- Cuts test_car_interfaces runtime significantly

* can: refactor DBC caching to use explicit factory function

* revert

* simple cache dbc

it's not at all used like a dataclass

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2025-11-30 03:20:25 -08:00
infiniteCable2
a5a9438844 Merge branch 'master' of https://github.com/sunnypilot/opendbc into sync 2025-11-16 12:18:09 +01:00
Jason Young
dd629a7e9c VW MLB: Porsche Macan (dashcam mode) (#2846)
* add DBC

* add platform definition data

* carstate checkpoint

* checkpoint carcontroller/mlbcan/interface

* checkpoint safety and safety test

* PEBCAK

* checkpoint various fixes

* fixes

* more fixes

* Blinkmodi_01 is genuinely on-demand only, add a fixme

* get turn signal state from a less annoying source

* add @Bentley's route for dev/test only

* gearshift position

* cleanup

* auto_fingerprint e8dac44d3a3458a5/00000000--9b83a227ce

* smooth move, ex-lax

* Kombi_01 COUNTER isn't real, at least not universal

* use lat accel torque controller

* checkpoint refactor

* Revert "always CANFD"

This reverts commit ac6122e272.

* auto_fingerprint 3a4f7c559c2f1215/00000001--5dc72af277

* add the VIN just to be sure

* auto_fingerprint a3bd1cb95d7c2f97/00000082--dbb4d37c0d

* she's a quick one

* more torque

* use different turn state signal

* slight reduction in ramp-up rate for jerk limit safety

* fix HCA status handling

* FINE

* add seatbelt signal

* enable door states

* Revert "use different turn state signal"

This reverts commit fb334567544d1adbeb71289310356e3ddcba17c6.

* use turn stalk helper to handle one-touch lane changes

* derp

* more friction

* a little more SR

* cleanup test routes

* reduce whitespace diff

* unnecessary for now

* dashcam

* cleanup

* Reapply "always CANFD"

This reverts commit 38e304f898107f16d963c976b3ef79978eb49e1d.

* VW: Safety code cleanup

* not yet

* consolidate ESP_05 for MQB

* retry CI after pinning pycapnp

* DRY not worth it here

* a little more DRY

* convert another single-bit read to GET_BIT

* separate MLB checksum handling, add XOR support

* XOR checksum support for LS_01

* shared message handling for LH_EPS_03 and LWI_01

* selective signal pass-through for LS_01

* add note for later consolidation

* consolidate create_lka_hud_control, unpretty but works

* XOR checksum support for TSK_05

* add TODO

* try it out

* good enough for who it's for
2025-11-10 00:24:36 -05:00
infiniteCable2
69bae677ef Merge branch 'master' of https://github.com/sunnypilot/opendbc 2025-09-14 16:54:32 +02:00
Jason Young
c470912d82 CANParser: Improved error logging (#2765)
* CANParser: Improved logging

* shorten

* remove whitespace diff

* add missing type annotation

* more info in counter fail log
2025-09-09 14:00:51 -04:00
Jason Young
11cb6e2085 Honda: ADAS messaging refactor, part 2 (#2748)
* Honda: ADAS messaging refactor, part 2

* add RDM bit for Bosch
2025-09-06 15:46:13 -04:00
Jason Young
6b63bebadf Honda: DBC consolidation (#2744)
* not even using this one

* collapse redundant CRV DBCs

* and this one

* rename 2022 Civic to Bosch radarless common

* more radarless common cleanup

* BALEETED

* how do you even type with boxing gloves on?
2025-09-05 23:33:36 -04:00
Jason Young
292b9d92f1 Honda: Steer control status refactor, part 1 (#2485)
* Honda: Steer control status refactor, part 1

* update test
2025-09-04 11:35:18 -04:00
infiniteCable2
f8cdf669b1 Merge branch 'master' of https://github.com/sunnypilot/opendbc 2025-08-25 17:05:50 +02:00
infiniteCable2
e49860f949 CRC MEB Gen 2 generalization (#3)
* generalization gen 2 fingerprint, check and fallback crc logic

* does this work?

* test

* test

* safety mode refactor

* fix order

* testing

* revert testing change and renaming

* comment

* clearly assign to MEB Gen2 for now

* qfk length is not changed
2025-08-19 20:54:08 +02:00
infiniteCable2
703723d934 MEB Gen 2 and 2.2 support (#2)
* Update mqbcan.py

* Update dbc.py

* Update mqbcan.py

* dbc adaption

* Update values.py add model

* Update car_list.json add 2024 cupra born variant as placeholder for newer crc cars

* Update mqbcan.py

* Update car.capnp

* Update values.py

* Update interface.py

* Update carstate.py

* Update interface.py

* Update values.py

* Update safety_declarations.h

* Update safety.h

* Create volkswagen_meb_2024.h

* Create volkswagen_meb_base.h

* Update volkswagen_meb.h

* Update volkswagen_meb_2024.h

* Update volkswagen_meb.h

* Update volkswagen_meb_2024.h

* Update volkswagen_meb_2024.h

* Update volkswagen_meb_2024.h

* Update volkswagen_common.h add additional volkswagen safety params

* Update volkswagen_common.h

* Update volkswagen_meb.h add crc logic and param reading

* Delete opendbc/safety/modes/volkswagen_meb_2024.h

* Delete opendbc/safety/modes/volkswagen_meb_base.h

* Update safety_declarations.h

* Update safety.h

* Update car.capnp

* Update values.py

* Update interface.py

* Update values.py

* Update interface.py

* Update mqbcan.py fix and refactor

* Update carstate.py alternative cancel button

* Update values.py

* Update values.py

* Update volkswagen_common.h

* Update volkswagen_meb.h

* Update vw_meb_common.dbc

* Update vw_meb_2024.dbc

* Update vw_meb.dbc

* Update vw_meb_2024.dbc

* Update vw_meb_common.dbc

* Update vw_meb.dbc

* Update carstate.py something is different here

* Update car_list.json

* Update dbc.py

* Update volkswagen_common.h

* Update volkswagen_meb.h fix

* Update volkswagen_meb.h fix

* Update volkswagen_meb.h fix

* Update values.py fix

* Update volkswagen_meb.h fix

* Update fingerprints.py

* Update override.toml

* Update interface.py

* Update vw_meb_2024.dbc

* Update vw_meb.dbc

* Delete opendbc/dbc/vw_meb_common.dbc

* Update values.py fix

* Update carstate.py

* Update carstate.py temporary do this

* Update vw_meb.dbc cleanup

* Update vw_meb_2024.dbc cleanup

* Update mqbcan.py

* Update mqbcan.py comment

* Update carstate.py fix side assist

* Update mqbcan.py

* Update volkswagen_meb.h

* Update values.py

* Update fingerprints.py adding some known firmwares of routes of some users

* Update values.py add car wmis and chassis codes for detection, for current existing users we can differentiate enough for old and new gen

* Update fingerprints.py

* Update values.py

* Update vw_meb_2024.dbc esc_50 includes epb status

* Update carstate.py new epb signal

* Update carstate.py

* Update volkswagen_meb.h fix

* Update carstate.py no hca faults when not in drive mode

* Update carstate.py revert unnecessary

* sync to master

* Update vw_meb.dbc epb status also for old gen as far as i see for esc_50

* Update mqbcan.py add new crc variant

* Update values.py

* Update interface.py

* Update dbc.py

* Update fingerprints.py

* Update override.toml

* Update volkswagen_common.h

* Revert "Update volkswagen_common.h"

This reverts commit 668c983f2e.

* Revert "Update interface.py"

This reverts commit 487c4c96a1.

* adaption for crc new gen subvariant

* need redundant additional dbc file for changed crc calc

* add new car to sunnypilot car list

* fix

* shorter

* Update fingerprints.py

* Update values.py

* fix checksum method import
2025-08-17 16:22:45 +02:00
elkoled
2898287863 PSA AEE2010_R3: Initial Platform Support (#2379)
* spam at 100Hz

* try higher STEER_MAX

* delete torque based control

* set measured steerActuatorDelay

* add route

* fix: set static status when lat not active

* clean checksum

* clean: carcontroller

* clean: carstate, interface

* clean: psacan

* clean: values

* fix

* comments

* try 0_3s actuator

* enable lanechange

* implement standstill

* fix: blinkers

* fix: e208 car specs

* fix: set ovveride.toml to angle based

* actuatorDelay to 0.5s

* add: standstill signal

* add: translated DBC

* fix: recuperation

* test: status change

* clean up status ramp

* cleanup

* add: ESP and cruisestate signals

* actuatorDelay to 0.2

* cleanup

* test max angle

* set verified STEER_MAX

* test fingerprinting

* match nissan angle limits

* Revert "match nissan angle limits"

This reverts commit 4ef75889ac9e73127a8ae6dd98b875b52604132b.

* fix tests

* DEBUG: test fingerprint

* actuatorDelay to 0.4

* DEBUG: use non-negative ECU offsetc

* DEBUG: enable Dashcam mode

* DEBUG: try to fix values.py

* Revert "DEBUG: enable Dashcam mode"

This reverts commit 4c632bcbaf78a4185232daa96df845e073764583.

* set more ecu addresses

* DBC: name DIAG frames

* use simple fw request

* cleanup

* fix: rename carname to brand

* swap CAN0/2

* add: carstate signals

* fix: steeringRateSign

* move PSA safety to opendbc

* fix: adhere to new ANGLE_LIMITS

* add: mandatory ignores for chks and counter

* fix: fingerprint

* disable radar ECU

* translate HS2_DAT_MDD_CMD_452 msg

* add ACC cancel request message

* translate HS2_DAT_MDD_CMD_452 signals

* rename to SPEED_SETPOINT

* checksum init

* add acc status msg

* add structure for longitudinal

* update test route

* remove debug code

* fix: ecu version requests

* adjust ActuatorDelay to 0.3

* disable bus multiplexing

* disable radar

* enable longitudinal

* add: artiv (radar) signals

* rename

* implement radar fake messages

* add radar tx safety

* fix

* implement radar spoof

* fix

* disable long signals

* DEBUG: test checksums

* set checksum chk_ini

* fix checksum 2f6

* checksum helper 2f6

* checksum helper 2b6

* fix checksum 2b6

* checksum helper 3f2

* try fixed radar values

* unify checksum script

* enable radar control

* cleanup

* add acc values

* adjust long params

* fix radar msg

* enable resume from standstill

* fix braking threshold

* set standstill cruise false

* set long tuning to default

* DEBUG: test AUTO_BREAKING always on

* DEBUG: AUTO_BRAKING on after 1 s of car startup

* DEBUG: spoof radar after 10 seconds

* sync 2f6 and 2b6 radar signals

* DEBUG: set KiV long tune

* DEBUG: set mult to 1000

* fix fwd hook

* fix interface

* adjust tuning

* ARC STATUS=1

* scale torque multiplier with speed

* scale fix

* use simple acc to torque factor

* use factor 80

* simplify

* cleanup

* set mult to 70

* DEBUG: try kiV

* no kiV, linear accel/brake

* AEB enable test

* AEB always disabled test

* add 100Hz gas pedal

* op long optional

* add acc related signals

* set steerAtStandstill

* fix: dbc message name typo

* add steeringSaturated debug

* adapt to master changes

* safety: set meas_angle

* chg: set steer_driver_allowance to 1.5 Nm

* fix: steering wheel nudge on disengage

* safety: add torque_driver

* DEBUG: enable long

* fix: req_diag_artiv

* disable long

* chg: reduce DRIVER_ALLOWANCE to 1 Nm

* remove longitudinal

* cleanup

* move safety_psa

* fw request

* decrease torque

* fw query

* steerLimitTimer = 0.1

* DEBUG: fix fw query for psa

* query test 1

* query test 2

* fw query test 3

* add ecu versions

* fix fw query

* fix ECU names

* add tester preset

* reactivate brand_matches skip

* adapt to opendbc changes

* fix linter

* fix misra

* fix pytest: add psa fw query timings

* fix: rxchecks

* adapt to master changes

* clean values.py

* DEBUG: fw_versions.py debug print

* Revert "DEBUG: fw_versions.py debug print"

This reverts commit c298f4f1711c055a31600587ba25f89cfbffc0e3.

* use firmware request

* PSA ECUs:  is_tester_present_response exception

* cleanup

* rename dbc

* peugeot 208

* delete opel corsa

* clean

* fix tests

* comments

* align angle rates to values.h

* set rx counters

* refactor

* add checksum and counter hooks

* set chk ini bytes

* remove one message

* fix misra

* fix main bus

* Revert "PSA ECUs:  is_tester_present_response exception"

This reverts commit 3387200097a62b4cda14840f198657876bcdedc8.

* revert fingerprints.py entry

* remove leading empty line

* psa safety ALLOW_DEBUG

* cleanup

* fix tests

* enable fw query for route recording

* Revert "enable fw query for route recording"

This reverts commit f81915ad27f125adb6424de793b87e4b3e40142d.

* add better route

* remove FW Query

* remove DRIVER

* sort alphabetical

* cleanup

* fix test

* clean

* clean

* conservative steerLimitTimer

* fix names

formatting

* psa test setup

add helper to psa test

add more helper

* add StockSafety test

* remove ESP signal

* remove steerFaultPermanent

* fix parse_wheel_speed and gasPressed

* move frequency in rx checks

* to_push/to_send -> msg

* align formatting with values.py

* rm GET_BUS

* rm GET_ADDR

* rm GET_BYTE

* fix some tests

* Update opendbc/car/psa/values.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* use opendbc.car.lateral import

* use opendbc.car.lateral import

* remove legacy fingerprint

* fix misra

* fix CHECKSUM/COUNTER dbc names

* use can packer for psa_checksum

* fix tests

* fix coverage

* Apply suggestions from code review

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* clean psacan

* set steerLimitTimer to 0.1

* Update opendbc/car/psa/carcontroller.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* Update opendbc/car/psa/carstate.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* Update opendbc/safety/modes/psa.h

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* add newline in safety_declratations.h

* fix indentation

* remove fwd hook

* Update opendbc/car/psa/carstate.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* Update opendbc/car/psa/carstate.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* fix main/cam bus naming

* use brake_pressed instead brake_pressure

* fix ruff

* remove manual gear

* fix ChecksumState

* send steering at 20Hz

* replicate stock LKAS behavior

* fix mutations

* Update opendbc/car/psa/carcontroller.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* Update opendbc/car/psa/carstate.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* fix dbc comment

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
2025-08-16 17:36:14 -07:00
Adeeb Shihadeh
18f8c0e757 CANParser: determine can_valid on read (#2665)
props
2025-08-15 11:06:34 -07:00
Shane Smiskol
1302e1bb25 ruff: enable preview rules (#2621)
* preview

* fmt

* fix formatting!

* Revert "fix formatting!"

This reverts commit 559d291cfa27c3500e5fa3105ffdea809bdd1b27.

* some of these are good, but can enable in steps

* and

* ruff check --fix

* preview

* format
2025-08-04 15:38:04 -07:00
Dean Lee
79b9fda5de parser: optimize MessageState buffer management (#2601)
* optimize MessageState buffer management

* Update parser.py

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2025-07-31 09:55:29 -07:00
Dean Lee
37f673b6bf parser: remove redundant msgname updates and cache address dict lookups (#2602)
reduce redundant lookups
2025-07-31 09:16:00 -07:00
Dean Lee
24e56837cb parser: set timeout threshold in one place (#2603)
set timeout threshold in one place
2025-07-31 09:15:43 -07:00
Adeeb Shihadeh
8758063032 add DAMP_FACTOR to _hyundai_common.dbc 2025-07-29 19:38:59 -07:00
Adeeb Shihadeh
4442c0faf3 packer & parser logging (#2577)
* packer logging

* some parser logging
2025-07-28 17:01:41 -07:00
Adeeb Shihadeh
6df4df4967 Fix busTimeout on Chevy Bolt during startup (#2575) 2025-07-28 16:21:43 -07:00
Adeeb Shihadeh
9ab7314596 parser profiling (#2542)
* profile

* lil more
2025-07-23 21:35:52 -07:00
Adeeb Shihadeh
9dbf1a0a86 Dynamic CANParser (#2545)
* failing test

* kinda works

* start with honda

* test models works

* test_models passes

* cleanup

* fix that
2025-07-23 20:58:31 -07:00
Adeeb Shihadeh
934c4cfc5b parser: NaN for ignore_alive 2025-07-23 20:06:10 -07:00
Adeeb Shihadeh
64105c6704 opendbc.can: split out DBC (#2543)
* opendbc.can: split out DBC

* comment

* fix that

* one more
2025-07-23 19:00:41 -07:00
Adeeb Shihadeh
c966a2be7f Move checksum functions to car modules (#2541)
* Move checksum helpers into can modules

* cleanup

* one more
2025-07-23 17:05:09 -07:00
Adeeb Shihadeh
68b76701e9 update_strings -> update 2025-07-23 16:54:27 -07:00
Adeeb Shihadeh
b32f4f099a CANParser: python rewrite (#2539)
* Add pure Python CAN parser

* cleanup

* lil more

* rm cython

* cleanup
2025-07-23 16:06:54 -07:00
Adeeb Shihadeh
9004e9f5f7 CANPacker: python rewrite (#2537)
* Add pure Python CANPacker

* reindent

* can tests pass

* car passes

* remove old one

* fix vw
2025-07-23 11:33:53 -07:00
Adeeb Shihadeh
f8d6e46f93 opendbc/can/ little cleanups (#2535)
* it's all opendbc.can

* common is a stupid name

* pedal -> body

* more body

* car specific
2025-07-23 10:13:12 -07:00
Adeeb Shihadeh
7ff7798a29 CANParser: auto-detect frequency (#2527)
* noop first

* move valid

* flatten

* update cython

* counters aren't special

* counter is special... for now

* fix mac

* works pretty well

* fix 1khz radar

* handle timeout

* cleanup

* ignore alive for the bolt

* lil simpler

* revert that

* Blinkmodi_02 special sauce

* cleanup
2025-07-22 20:09:13 -07:00
Adeeb Shihadeh
47d83d46c3 lil CANParser cleanups 2025-07-22 11:44:28 -07:00
Shane Smiskol
0783099ac8 Fix external project build (#2450)
* works

* better

* fine doesnt matter
2025-07-09 16:26:09 -07:00
YassineYousfi
e12e783640 can build script: relative rpath (#2423)
* used shared lib

* try this

* fix

* this

* temp

* ../..

* fix darwin

* not str

* why?

* this works?

* rev that

* rev str

* prefix

* LD...

* smaller diff

* raw string

* use rpath

* darwin

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

* Update opendbc/can/SConscript

* Update opendbc/can/SConscript

* moar

* Update opendbc/can/SConscript

---------

Co-authored-by: Armandpl <adpl33@gmail.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
2025-07-09 01:30:28 -07:00
Yassine Yousfi
fdb4fb1935 Revert "../.."
This reverts commit 2c8f3c38ab.
2025-06-28 17:12:35 -07:00
Yassine Yousfi
2c8f3c38ab ../.. 2025-06-28 17:11:54 -07:00
Shane Smiskol
85d8cd0fea Rename CANDefine test class (#2363)
Fix test class typo
2025-06-03 21:53:33 -07:00
Adeeb Shihadeh
4fe147125a no more pylint (#2348)
no pylint
2025-06-01 13:48:34 -07:00
Adeeb Shihadeh
4b3bb78941 Reapply "enable cpplint" (#2245) (#2259)
* Reapply "enable cpplint" (#2245)

This reverts commit f960080e28.

* include from root

* revert that

* clean that up

* seriously?
2025-05-17 17:53:38 -07:00
Shane Smiskol
4c50b567ce CANPacker: speedup recent slowdown (#2251)
* draft

* 4

* fast again

* faster

* debug

* stash

* revert

* map inside map is simple for getting signal addr pairs + fast for getting Signal types inside addr ranges

* unordered_map is faster

* some clean up

* more

* more

* more

* more
2025-05-16 15:58:59 -07:00
Shane Smiskol
556ccf562e Print pack time 2025-05-16 15:24:04 -07:00
Shane Smiskol
f960080e28 Revert "enable cpplint" (#2245)
Revert "enable cpplint (#2238)"

This reverts commit c0bdcc58df.
2025-05-14 19:46:08 -07:00
Aubrey Wahl
c0bdcc58df enable cpplint (#2238)
* enable cpplint

* fix misra

* newline

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2025-05-14 14:30:49 -07:00
Adeeb Shihadeh
57be4f17cd enable pre-commit (#2236)
* fix codespell

* disable for now
2025-05-14 08:58:57 -07:00
Shane Smiskol
0c05e5cf02 CANParser: support Tesla checksums (#2223)
* fix

* fix more

* stash

* sucks we have to do this

* cons

* fix

* implement

* ???

* ugh

* works

* stash

* clean up

* can check that too
2025-05-12 16:50:58 -07:00
Shane Smiskol
97ca64c67e dbc: fix incorrect endwith check (#2222) 2025-05-12 15:32:53 -07:00
Shane Smiskol
7b2090c773 CANPacker: support signal types (#2213)
* packer: support signal types

* clean up

* better fmt

* fix that

* fix

* forgot

* fixme
2025-05-09 22:17:58 -07:00