10 Commits

Author SHA1 Message Date
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
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
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
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