Commit Graph

1011 Commits

Author SHA1 Message Date
Robbe Derks
d24971ef8a Communication refactor (#997)
* cleanup is_enumerated, rename comms and init spi

* big comms refactor, building now

* misra fixes

* more fixes

* misra try 3

* cleanup

* this belongs in a separate PR

* remove unneccesary file

* revert llspi changes

* this needs packing

* fix pedal usb

Co-authored-by: Comma Device <device@comma.ai>
2022-08-03 13:11:52 +02:00
Jason Wen
89989abca5 Hyundai: support camera-based SCC cars (#965)
* Hyundai: Car Port for 2022 Kona Electric Camera SCC

* add missing flag

* set camera_scc in other safety modes

* Add safety test

* this will be a stock longitudinal port for now

* common cruise check

make this check common

* Fix comment typo

* Camera SCC HKG send CLU11 on bus 2

* Update CLU11 comment

* fix button test when txing

* just add bus 2 to existing addr checks

* actually no, this will never be on bus 2

* CLU11 is always on bus 0

line

* consistent param ordering

* fix test

fix test

* this is fine

* Mistook SCC for CLU, fix

* try to make this a little more clear

* add comment

* fix that

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-08-03 00:54:41 -07:00
Adeeb Shihadeh
8b26ce940f rename deepsleep_requested -> deepsleep_allowed 2022-08-01 17:25:48 -07:00
Adeeb Shihadeh
4b86b83991 Subaru: support Outback and Global Gen 2 (#991)
* Subaru: support Outback and Global Gen 2

* send 0x321

* check bus

* fwd that

* gen2 limits

* lower max steer

* update safety replay route
2022-07-29 20:44:41 -07:00
Igor Biletskyy
e9ba54b09b body: allow flasher with no controls_allowed (#1002)
* add flasher check, revert len

* MISRA 10.4

* Update safety_body.h
2022-07-26 22:34:34 -07:00
Igor Biletskyy
74408d64f1 body safety: add addresses to enter can flasher (#1000)
* was bad idea to check length

* msg len?

* comment
2022-07-25 20:24:44 -07:00
Cameron Clough
3a17c2e07f Ford: add safety code for LCA vehicles (#966)
* Ford: add CAN messages and signal definitions

* Ford: implement safety hooks

* Ford: add safety unit tests

* Use standstill signal

* Rename bus

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

* Simplify brake pressed

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

* Ford LKAS msg helper

* Simplify button violation check

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

* Simplify LKAS action check

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

* Tidy up tests

* Use standstill signal for tests

* Misra fix

* Unused definition

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

* Simplify signal bit shifting

* Remove type hints

* Add panda safety type hints

* Fix vehicle moving signal

* Fix button checks

* Fix steer allowed tests

* Fix standstill threshold in tests

* Maybe this works?

* More button tests

* Revert "Simplify button violation check"

This reverts commit c6496269844328a007ea52b5766501d7c1ea40c2.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-07-23 16:54:58 -07:00
Igor Biletskyy
4b1d7d0215 body: add tx checks for knee (#996)
* add more tx checks

* remove junk

* ...

* wrong flasher address
2022-07-22 22:57:20 -07:00
Adeeb Shihadeh
f02b43191f Subaru: split legacy safety into its own file (#990) 2022-07-19 15:53:08 -07:00
Adeeb Shihadeh
e51aa5ebce safety: fix race condition in engagement heartbeat (#988)
* safety: fix race condition in engagement heartbeat

* move that

* fix  that
2022-07-13 14:20:00 -07:00
Adeeb Shihadeh
2abeab913f EV6: reject fake cruise engagements (#987)
* EV6: reject fake cruise engagements

* bump opendbc

* update comment

* raise to 8

* add addr check
2022-07-12 17:42:13 -07:00
Adeeb Shihadeh
baecd2ecc6 Chrysler: increase Ram rate limits (#981) 2022-07-11 15:01:35 -07:00
Adeeb Shihadeh
ca927fe931 EV6: allow TX of 0x2a4 (#983)
* EV6: allow TX of 0x2a4

* don't fwd
2022-07-08 22:08:54 -07:00
Adeeb Shihadeh
53466f0934 Chrysler: allow resume button (#980) 2022-07-06 23:43:56 -07:00
Adeeb Shihadeh
fae3ee2e81 Chrysler: Ram 1500 support (#969)
* RamInit

* Some fixes

* ram param

* cleanup steering

* invert

* couple fixups

* tests pass

* check that

* misra fixes

* same limits

* revert that

* remove those

Co-authored-by: Jonathan <jraycec@gmail.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-07-06 22:50:29 -07:00
Adeeb Shihadeh
2652453892 EV6: adjust steering thresholds (#972)
* EV6: match max torque of rest of Hyundais

* update tests

* adjust that

* Apply suggestions from code review

* Update test_hyundai_hda2.py
2022-06-23 13:41:22 -07:00
Shane Smiskol
4bc85ad40a Chrysler: use correct engaged bit (#973)
* use new engaged bit

* fix msg name

* update signal

* update opendbc ref
2022-06-22 14:46:25 -07:00
Jason Wen
e6c2b0ff01 Remove duplicate word in comment (#974)
Remove duplicate word
2022-06-21 21:53:49 -07:00
Shane Smiskol
515df2bb72 Chrysler: use universal gas and brake signals (#970)
* RamInit

* just gas and brake changes

* unsigned

* fix tests

* bump openpilot version (TEMP)

* misra

* system

Co-authored-by: Jonathan <jraycec@gmail.com>
2022-06-16 21:49:22 -07:00
Shane Smiskol
3dbd30864e Honda Civic 2022 (radarless): car safety (#942)
* civic 2022

* remove

* maybe not the right way

* Honda Radarless: add tests

* update

* different bus

* other bus

* Revert "other bus"

This reverts commit 691e045f8724e57f135ad8d1683e83acbc16b91f.

* add new HUD message

* add

* different bus

* correct freq

* small updates

* comma

* remove

* remove for now

* missing

* not needed

* make into a safety param and clean up

* this can be reverted

* clean up tests (something's broken)

* fix some errors

* this message doesn't exist on any bus

* this car doesn't have BRAKE_MODULE

* make safety more explicit and fix button safety

* fix some tests

* fix tests

formatting

clean up

* radarless uses SCM_FEEDBACK too

* fix tx msgs, clean up, make test common between bosch tests

* misra

* Fix python linting errors

add comment

* not sure where that came from

* add comments

add comments

* we can guarantee honda_bosch_long is true only if not radarless

* these are the same! 🎉

* use updated route with correct tx msgs

* helper pt bus function

* this is explained above

* use function

* no more blocked messages!

* bump openpilot

* comment

* line too long

* needs system

* send on bus 0

* Camera needs bus 2 for buttons

This reverts commit f90db5d359c1c952de87ea4a2127ae599306e729.

* fix button tests

* bump openpilot

* move this down

* make this explicit

* comments

Co-authored-by: vanillagorillaa <ntmccoy@yahoo.com>
Co-authored-by: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com>
2022-06-16 19:02:44 -07:00
Shane Smiskol
42772b49e3 Honda Bosch: consider correct bus for buttons (#963)
* fix bosch controls mismatch when using op longitudinal

* misra
2022-06-08 21:11:55 -07:00
Shane Smiskol
583d3a0c7b Mazda: fix steering safety and add tests (#952)
* fix steering safety and add tests for mazda

* fix steering safety and add tests for mazda
2022-05-25 22:19:18 -07:00
Shane Smiskol
dff5e6ed31 Hyundai: check CF_Lkas_ActToi bit (#947)
* Hyundai: check steer request bit

* add tests (should make common with Toyota in the future)

* fix comment
2022-05-25 11:36:59 -07:00
Shane Smiskol
6d19b46ef5 GM: revert back to brake threshold (#949)
Revert "GM: change from brake threshold to Brake_Pressed bit (#846)"

This reverts commit 3bd3ae885a.
2022-05-20 19:41:26 -07:00
Adeeb Shihadeh
62f709afd4 fix missing CAN-FD safety modes 2022-05-19 16:55:53 -07:00
Willem Melching
36c62afa0c Kia EV6 (#905)
* block lkas

* taco time

* local changes

* start

* tx checks

* counter + vehicle moving

* support big can fd

* check crc

* add torque to rx checks

* tests

* little more

* little more

* get some misra coverage

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-05-19 15:59:58 -07:00
Adeeb Shihadeh
4a5fc24b75 safety: move controls_allowed and relay malfunction reset (#944)
* safety: reset controls allowed and relay malfunction before safety mode init

* add back for all output
2022-05-19 14:03:43 -07:00
Shane Smiskol
36ccbd56fa Toyota: check STEER_REQUEST bit (#940)
* check steer_req

* think this is clearer on first glance

* add test

* also test recovery

* Update tests/safety/test_toyota.py

* Update tests/safety/test_toyota.py

* move
2022-05-16 12:20:31 -07:00
Robbe Derks
893a81aa82 Tesla: allow forwarding of stock AEB (#937)
* allow forwarding of stock AEB

* misra fix
2022-05-16 13:12:14 +02:00
Adeeb Shihadeh
69215887dc safety: prep for CAN FD (#943) 2022-05-15 23:46:04 -07:00
eFini
297cdb27ef Toyota: forward ACC messages if stock longitudinal (#934)
* do not block 0x343 if toyota_stock_longitudinal set to true

* Update board/safety/safety_toyota.h

* Update board/safety/safety_toyota.h

* Update tests/safety/test_toyota.py

* Update tests/safety/test_toyota.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-05-14 01:08:32 -07:00
Shane Smiskol
1d2127876d Hyundai: use GET_BIT and fix safety on incorrect bit (#933)
* use GET_BIT where possible

* fix test to catch this
2022-05-11 22:36:53 -07:00
Shane Smiskol
eb662e4e50 Make safety param uint16_t (#931)
* change safety param to uint16_t

* accidental paste
2022-05-02 13:36:19 -07:00
Shane Smiskol
326cc2a8db Toyota: stock longitudinal safety (#927)
* safety for non-longitudinal

* flip around param for easily replaying old logs on new panda

* fix misra: a function parameter should not be modified

* safety

* the toyota tests all share common messages

* fixup tests

* update comment

* same as tesla test

* check if subset

* update comments

update comments
2022-04-28 22:29:29 -07:00
Shane Smiskol
cf8fb0b883 safety param: assume uint16_t (#929) 2022-04-28 17:40:50 -07:00
Adeeb Shihadeh
d031d6e283 Toyota: add safety param flag for alt brake message (#925)
* Toyota: add safety param flag for alt brake message

* fix misra

* Update board/safety/safety_toyota.h
2022-04-27 11:31:24 -07:00
Shane Smiskol
bb2aea1ac6 Hyundai: enforce recent button press to allow controls with PCM (#923)
* add safety for hyundai stock long button-only enable

* add full logic, use 4 frames of button samples

* comment above and in openpilot is enough explanation

* make misra happy

* add tests

* add comments and better variable names

* only check button values on rising edge of PCM ACC enable

* common function

* Revert "common function"

This reverts commit 81e642ca987b76d8353003f7f622a1bec5003713.

* simplify: keep track of last interaction instead

* revert changes to sample_t

* make unsigned

* clip to max and use uint8

* start at 4

* consistent

* apply suggestions

* Update board/safety/safety_hyundai.h

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

* unify function

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-04-26 11:45:09 -07:00
Shane Smiskol
ee9ef693a1 Revert "Hyundai: enforce recent button press to allow controls with PCM (#917)"
This reverts commit 9a91323c04.
2022-04-26 02:07:53 -07:00
Shane Smiskol
9a91323c04 Hyundai: enforce recent button press to allow controls with PCM (#917)
* add safety for hyundai stock long button-only enable

* add full logic, use 4 frames of button samples

* comment above and in openpilot is enough explanation

* make misra happy

* add tests

* add comments and better variable names

* only check button values on rising edge of PCM ACC enable

* common function

* Revert "common function"

This reverts commit 81e642ca987b76d8353003f7f622a1bec5003713.

* simplify: keep track of last interaction instead

* revert changes to sample_t

* make unsigned

* clip to max and use uint8

* start at 4

* consistent

* apply suggestions

* Update board/safety/safety_hyundai.h

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

* unify function

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-04-25 18:57:02 -07:00
Shane Smiskol
ee2a4b6b58 sample_t: fixup comments (#921) 2022-04-21 20:11:13 -07:00
Shane Smiskol
7dd9493eb1 safety_param: change to unsigned (#910)
* make safety_param unsigned

* final one

* uint32_t

* change flags as well

* Revert "change flags as well"

This reverts commit ed8897dd86b0dbfc80e6b8633f36d80c9bc91052.

* unsigned

* update health packet version

update health packet version

* update struct H->I

* bump health version

* actually used
2022-04-20 23:25:03 -07:00
Shane Smiskol
a1d97f9a0b Toyota: fix interceptor pressed mismatch (#919)
* change to openpilot threshold

* add interceptor comments

* fix test threshold
2022-04-20 22:20:24 -07:00
Shane Smiskol
c925407461 Honda: fix interceptor pressed mismatch (#915)
* update panda interceptor gains

* update test threshold

* update threshold

* don't divide second track by 2 (?)

* fix test

* we don't divide by 2 anymore

* better wording

* remove value

* bump PR

* no 1e-5
2022-04-12 10:59:05 -07:00
Robbe Derks
cc0fdffee6 Calculate interrupt load and add to health packet (#913)
* calculate interrupt load

* forgot to change this

* being cautious about overflows

* utils

* fix bootstub

* cleanup

* also exclude pedal

* fix misra

Co-authored-by: Comma Device <device@comma.ai>
2022-04-11 11:59:47 +02:00
Shane Smiskol
f088af5664 GM: allow active regen bit when gas is pressed (#914)
* allow apply bit when gas is pressed

* remove unused apply

* allow apply bit in pre-enabled state

* use GET_BIT

* surely misra won't be mad

* compare to a value

* forgot to make this unsigned too
2022-04-07 20:29:00 -07:00
Robbe Derks
ad4f69cd18 Dos: PWM based camera signals (#912)
* switch over to PWM based camera signals

* update comment

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Willem Melching <willem.melching@gmail.com>
2022-04-06 17:19:42 -07:00
Adeeb Shihadeh
ba5cbd5ee1 body: set controls allowed (#906) 2022-04-04 18:55:19 -07:00
Shane Smiskol
6a4daee044 safety: disallow longitudinal actuation while gas is pressed (#884)
* test implemented for Toyota

* fix Toyota interceptor

* use hasattr

* do Honda (still need Nidec ACC_HUD safety)

* add longitudinal_allowed to ACC_HUD (Nidec w/ no pedal

* rx not needed

* add base test for longitudinal

* update name

* stash

* do GM

* use gas_pressed_prev

* do tesla safety

* add full tests

* add get_longitudinal_allowed for simpler tests

* remove unnecessary tests and revert honda/hyundai

* fix honda after revert

* make sure releasing gas allows longitudinal again

* clean up

* clean up

* Just check longitudinal allowed

* don't need to reset detection

* use prev and add brake detection

* only on gas

* make sure we don't change current_controls_allowed braking behavior

* clean up tests

* use current_controls_allowed for honda & GM

* this is pretty much tested in common

* fix up tests and move common tests

* revert

* better place

* add for body
2022-04-01 19:54:40 -07:00
Shane Smiskol
f20682b640 use all cores (#898) 2022-04-01 19:15:04 -07:00
Adeeb Shihadeh
560bcc4063 body: add RX checks (#903)
* body: add RX checks

* add that
2022-03-31 15:58:54 -07:00