Commit Graph

520 Commits

Author SHA1 Message Date
Shane Smiskol d51dd496cb
GM: more longitudinal safety (#1115)
* seems cleaner

* abort struct

* fix

* add variable in test_gm (TODO: add tests)

* fix test for new safety

* cmt

* && -> ||
2022-10-21 00:20:01 -07:00
Adeeb Shihadeh fcb1a5a8e2
Hyundai CAN-FD: common brake pressed signal (#1113)
* Hyundai CAN-FD: common brake pressed signal

* change bit

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-10-20 19:52:06 -07:00
Shane Smiskol 54f9390ff5
GM: allow TX PSCMStatus message (#1111)
* forwarding

* add to tx msgs

* don't block

* Revert "don't block"

This reverts commit b1ca52f86d.

* fix forwarding tests

* comment

* add comment
2022-10-19 23:25:22 -07:00
Adeeb Shihadeh 723e60cb43 Hyundai CAN-FD: fix SCC bus for HDA1 2022-10-19 22:58:52 -07:00
Adeeb Shihadeh 24ccc34c46
Hyundai CAN-FD: use cruise signals from SCC ECU (#1112)
* Hyundai CAN-FD: use cruise signals from SCC ECU

* cleanup
2022-10-19 22:26:22 -07:00
hoomoose dd751862c3
Hyundai: support button resume on CAN-FD HDA1 (#1102)
* Update safety_hyundai_canfd.h

* run tx checks

* fix tests

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-10-19 15:17:23 -07:00
Shane Smiskol b95a65df58
GM: match ECM standstill check (#1105)
* match ECM check

* fix

* needs to be <= 10 to avoid a fault, fix for safety tests

* fix
2022-10-18 11:22:04 -07:00
Shane Smiskol 842cf65818
Hyundai CAN-FD: support 90deg angle limit bypass (#1098)
* h90d CAN-FD

* torque

* one liner

* adjust safety

* Revert "adjust safety"

This reverts commit e3539edc31.
2022-10-17 20:27:30 -07:00
Jason Wen 62868c36a8
Hyundai: CAN-FD Hybrid gas pressed signal (#1106)
* Hyundai: Gate 0x105 behind hybrid CAN-FD only

* update tests

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-10-15 12:26:01 -07:00
Shane Smiskol 5962bcd08a
GM: different brake thresholds by platform (#1104)
* Different brake pressed thresholds

* Update board/safety/safety_gm.h
2022-10-14 16:51:53 -07:00
Shane Smiskol c39528d299
Hyundai tests: fix counter in FCA message (#1092)
* tests: fix counter in FCA message

* Update tests/safety/test_hyundai.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-10-12 21:48:04 -07:00
Adeeb Shihadeh de380961fc
Hyundai: support non-HDA2 EV gas signals (#1100)
* Hyundai: support non-HDA2 EV gas signals

* update tests
2022-10-12 21:00:24 -07:00
Adeeb Shihadeh 622ce923e9
Hyundai: share flags with CAN-FD platform (#1099)
* Hyundai: share flags with CAN-FD platform

* update flags there
2022-10-12 20:29:15 -07:00
Adeeb Shihadeh ffb3109e28
Hyundai: HDA2 longitudinal control support (#1096)
* ev6 long

* update steering
2022-10-11 20:50:23 -07:00
Shane Smiskol d68b1b0a98
Hyundai: support 90deg angle limit bypass (#1091)
* h90d safety

* quicker rate

* update comment

* support multi frames?

* stash

* stash

* might work?

* stash

* clean up

* revert that

* add test

* fixup tests

* clean up

* remove test

* try to combine tests

* Revert "try to combine tests"

This reverts commit f147955b94.

* seems simpler

* more explicit

* shouldn't be needed

* comment

* fix that test
2022-10-11 17:57:03 -07:00
Adeeb Shihadeh aa0be4d3dc
Hyundai: move shared definitions to a separate file (#1097)
* Hyundai: move shared definitions to a separate header file

* same with tests

* cleanup
2022-10-11 17:38:34 -07:00
Shane Smiskol 0a819ad465
Torque request bit: support multiple invalid frames (#1094)
* h90d safety

* quicker rate

* update comment

* support multi frames?

* stash

* stash

* might work?

* stash

* clean up

* revert that

* add test

* fixup tests

* clean up

* remove test

* try to combine tests

* Revert "try to combine tests"

This reverts commit f147955b94.

* seems simpler

* more explicit

* shouldn't be needed

* no hyundai stuff

* no line

* consecutively

* comment

* comment

* comment

* revert

* comment

* check earlier

check earlier

* ensure we don't set a negative value

* add todo comments

* for loop
2022-10-11 13:20:24 -07:00
Shane Smiskol 3644d9412b Revert "Hyundai: steering fault bit safety (#1095)"
This reverts commit 2334a413bc.
2022-10-11 11:25:41 -07:00
Shane Smiskol 2334a413bc
Hyundai: steering fault bit safety (#1095)
comment

smaller comment

simpler test

check controls allowed

more classical

more like the buttons

revert

flip
2022-10-10 21:56:22 -07:00
Shane Smiskol aaa70b10be
Toyota: remove redundant test (#1093)
already test this
2022-10-10 17:01:49 -07:00
Shane Smiskol 1303af2db2
GM: change brake pressed signal (#1089)
* Match openpilot brake check

* comment

* simple

* Update test

* doesn't take an int

* msg varies in size by platform

* 2 extra bytes of zeros on Escalade

* label platforms

* space
2022-10-07 16:10:09 -07:00
Cameron Clough c09a1cd520
Ford: allow sending buttons msg to camera (#1085)
* allow sending steering buttons msg to camera

The DBC lists both the IPMA and PCM as receiving modules for the `CcAslButtnCnclPress` and `CcAsllButtnResPress` signals used to cancel/resume ACC.

Sending resume to both buses is confirmed to work by three testers, now it's just down to tweaking openpilot to get high reliability.

* add test for both buses

* only send TJA to bus 2
2022-10-07 10:47:04 -07:00
Shane Smiskol 9bcd9b9a24
GM: update max brake (#1087)
update max brake
2022-10-04 00:20:31 -07:00
Shane Smiskol 38257a93e4
Hyundai: lower CAN FD torque rate limits (#1066) 2022-09-15 11:22:21 -07:00
Shane Smiskol f120999e19
Subaru: match openpilot standstill (#1070)
match openpilot standstill
2022-09-14 18:42:16 -07:00
Shane Smiskol 19983f13b3
Chrysler: match openpilot standstill check (#1065)
* match openpilot standstill, and fix ram standstill parsing

* misra

* cmt
2022-09-13 13:52:44 -07:00
Shane Smiskol 788e0b5ac9
GM: same regen check as openpilot (#1026)
* it was only checking a specific bit

* same check as openpilot

* reset on init

* unsigned

* should fix conflicts

* common

* comment

* Add missing function

* Tests

* the alternative is a mess

typo

typo

* draft

* finish common

* works but you need RegenSafetyTest before all other classes

* Revert "works but you need RegenSafetyTest before all other classes"

This reverts commit 256f3be9a8.

* This works too

* need parameterized, subtests nor super() calls correctly reset state

* Fix test and comment

* comment

* another fix...

* subclass

* ABC

* order

* fix static analysis

* can do this

* Revert "can do this"

This reverts commit 6bc63a345a.

* this is nicer, no pylint errors

* Update tests/safety/common.py

* underscore

* dynamically detect and add tests

* simpler

* only for safety modes with a regen message

* check attr

* Revert "check attr"

This reverts commit bc37a7eedd.

* need to check at test time not class init time
2022-09-12 21:32:06 -07:00
Cameron Clough 8f13ca3f66
Ford safety updates (#1052)
* allow resume button press while controls allowed

* add ACCDATA_3 msg

* change msg name style to match DBC

* fix

* wrong msg

* chmod +x

* always allow other acc buttons e.g. tja toggle
2022-09-08 15:35:10 -07:00
Shane Smiskol 0ca23b6778
Toyota: generic steer fault workaround safety (#939)
* toyota steer fault safety

* fix

* alternative safety

* no comment

* should be good

* same behavior, a bit simpler

* better tests

* fix comment

* update safety comment

* const is actual number of messages

* Fix bug

* misra

* Fix test

* clean up logic a bit

clean up logic a bit

fix

* fix

fix

* clean up tests

* unsigned

* forgot to rename message when merged

* Comments

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

* Update names

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

* rename rest of variables

* real time checks

* clean up safety tests

* revert

* add this

* clean up

* better name

* use common steering checks

* reverse order

* make common

* re-organize the safety

* clean up safety_toyota

* more clean up

* add comment back

* 19

* recover

* some variable name clean up

* rename and reset `valid_steering_msg_count`, another recover message

* move comment

* remove reset_toyota_timer, minor test clean up

* common test

* use init_tests

* threshold used to be: frame you can cut steer on, now it's min num of valid frames (next frame you can cut, 18+1)

* Update tests/safety/test_toyota.py

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

* fix realtime

* Update board/safety/safety_toyota.h

* Apply suggestions from code review

* Update board/safety/safety_toyota.h

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-09-06 19:12:06 -07:00
Shane Smiskol 77cfc32d37
Toyota: match openpilot standstill check (#1045)
* Match openpilot

* check against zero value

* formatting

* use intermediary variable

* comment

* hmm... this works now??

* fix misra
2022-08-30 23:24:37 -07:00
Jason Wen 9d6496ece8
Hyundai CAN-FD: Tucson Hybrid 2022 support (#999)
* Hyundai: Car Port for Tucson Hybrid 2022

* Remove test comments

* Fix fwd_hook

* Allow tx on 0x1a0

* Fix byte counts

* Send LFA and HDA icons based on engageability

* Add FLAG_HYUNDAI_CANFD_HDA2 flag

* Update __init__.py

* Allow tx with CRUISE_INACTIVE

* Panda safety cleanup

* Include bus 0 in rx checks

* Missed one

* Remove redundant check

* Add comments

* start cleanup

* little more

* more cleanup

* tests

* one more test case

* rename

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-08-19 19:43:58 -07:00
Jason Young 4412eeaf1a
VW MQB: Cleanup message counter handling (#1034) 2022-08-15 20:49:06 -07:00
Jason Young 199bc10db3
VW PQ: Longitudinal control safety, lateral torque update (#989)
* VW PQ: Updated checksum and counter handling

* first pass PQ long control safety

* refactor stock test to prep for long test

* long control tests

* falling edge enable logic and tests

* accidentally worked but this is better

* test misra/cppcheck evaluation of debug build

* Revert "test misra/cppcheck evaluation of debug build"

This reverts commit 7594fc5e2f.

* allow use of manufacturer ramp-up rate

* soften wheel-touch threshold

* fix tests

* check/test ACC main switch state

* fix CRC for Motor_5

* derp

* retry CI

* try that again

* fuuuu

* fix Motor_5 checksum validation

* use existing acc_main_on global

* re-pin opendbc

* no need for resume spam in longitudinal mode

* concise

* consistency cleanup

* comment and whitespace cleanup

* more cleanup

* more

* restore driver torque threshold

* add long control replay route

* obsolete comment

* proper flag name

* wild to mild-ish

* bump openpilot ref

* Update test_safety_replay.py

* handle non existent routes

* comment consistency/polish

* flip comparison order for falling edge clarity

* restore refs

* read the diff next time, speedy

* srsly

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-08-12 18:50:00 -07:00
Jason Shuler 5e0dde7b48
GM: Add support for cam harness & stock ACC (#962)
* Allow brake TX on PT bus

* Initial Panda GM cam harness support
 * Complete rewrite / simplification
 * Add param for cam harness (default is OBD2)
   - Forward btw 0 and 2
   - Filter LKAS and optionally ACC from cam
 * Add param for stock ACC
   - Allows ACC on PT bus when set, not otherwise
   - Allows ACC from cam when set, not otherwise
 * Add temporary WIP EPS timing workaround in ifdef

* Remove keepalive; regen == braking

* Fix MISRA violations

* EPS timing opt-in by param

* Minor clean up

* remove timing code for readability

fix and formatting

* we only need to send one message if cam harness and stock long

* Simplify params

* Removed dup brake msg

* revised params, split 3-ways

* add test

* clean up a bit, no need to send ACC yet

like this

* split out button enable and pcm enable into seperate tests

* some formatting

some formatting

* GM CAM uses PCM cruise for controls_allowed

* fix gas safety tests

* misra

* fix static analysis

comment

* fix brake pressed

* Add OP VOACC override stock cam

* Add VOACC safetyparam to init.py

* Revert "Add VOACC safetyparam to init.py"

This reverts commit 2e46f8746f.

* Revert "Add OP VOACC override stock cam"

This reverts commit a4b096cc1e.

* better comments

* better comments

better comments

fix

* move non-base msg definitions to subclass

* various comments

* TODO: add button safety

* add button safety

* use new pcm_cruise_check

* revert regen braking change

* only cancel button allowed

* Apply suggestions from code review

* Update board/safety/safety_gm.h

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

* fix suggestion

* Fix tests

* Revert "Fix tests"

This reverts commit 500577921f.

* this is a much simpler fix, do full fix in another PR

* tx button safety

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-08-12 15:56:39 -07:00
Adeeb Shihadeh 06592b5c0e
Hyundai: rename HDA2 platform to CANFD (#1027)
* Hyundai: rename HDA2 platform to CANFD

* one more
2022-08-11 22:06:54 -07:00
Adeeb Shihadeh 486af79503
Chrysler: add Ram HD support (#1010)
* ram hd safety

* bump opendbc

* dt prefix

* remove that
2022-08-11 14:41:46 -07:00
Adeeb Shihadeh 291d9e3eb9
safety: refactor steering safety checks (#1013)
* start with vw

* hyundai

* rest of driver torque cars

* remove hyundai for now

* fix cppcheck crash

* set committer

* revert gm

* remove those
2022-08-09 19:53:15 -07:00
Adeeb Shihadeh e30f7e8fc7
Chrysler: cleanup + prep for Ram HD (#1012)
* Chrysler: cleanup + prep for Ram HD

* prefix with chrysler
2022-08-08 21:16:28 -07: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 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
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 c649626984.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-07-23 16:54:58 -07:00
Adeeb Shihadeh a1686ca3ca
safety tests: use can packer for counters (#995)
* safety tests: use can packer for counters

* bump opendbc
2022-07-21 18:50:42 -07:00
Adeeb Shihadeh 1dfee5973b
Subaru: cleanup counter handling (#992) 2022-07-19 17:18:42 -07:00
Jason Young 4ce5b5a44d
VW PQ: Updated safety test checksum and counter handling (#964)
* VW PQ: Updated checksum and counter handling

* bump opendbc for Docker/CI
2022-07-15 10:49:34 -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 6c0d0b43c2
Chrysler: update tests after DBC updates (#979)
* Chrysler: update tests after DBC updates

* lil cleanup
2022-07-05 16:33:12 -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
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 691e045f87.

* 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 f90db5d359.

* 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
Jason Young 475a9a3124
fix CANPackerPanda counter state init (#956) 2022-06-02 11:18:46 -07:00
Shane Smiskol d967a6b504
safety tests: use base class for common driver steering torque tests (#950)
* rename to torque_cmd_msg

* Move most of the driver torque tests into common.DriverTorqueSteeringSafetyTest

* fix static analysis so far

* HDA2 just works

* TODO: Subaru

* Subaru

* Move Mazda steering constants into class

* rm line

* split into classes

* move test_against_torque_driver into common driver torque tests

* rename to match all other tests

* fix linter

* revert changes
2022-05-25 22:51:33 -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 6117c381f2
safety tests: create classes for common torque steering tests (#951)
* Create base class for common steering tests (motor/driver)

* fix class name
2022-05-25 19:24:55 -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
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
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
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 81e642ca98.

* 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 81e642ca98.

* 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 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 ed8897dd86.

* 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 81246fdac1
move alternative experience class to python module (#909)
* move alternative experience class to common python module

* same formatting
2022-04-04 18:49:56 -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 94bfed6d28
safety tests: rename interceptor message functions (#900) 2022-04-01 19:14:41 -07:00
Adeeb Shihadeh 560bcc4063
body: add RX checks (#903)
* body: add RX checks

* add that
2022-03-31 15:58:54 -07:00
Shane Smiskol 79145f9e5f
safety tests: rename gas/brake message functions (#893)
* _brake_msg and _gas_msg were confusing

* use class inheritance to define test specific safety variables

* Revert "use class inheritance to define test specific safety variables"

This reverts commit 734efd96f3.

* common function to set up each test

fix honda

* Revert "common function to set up each test"

This reverts commit fe4e71b3c6.

* rename related function

* formatting

* consistent name

* revert this change
2022-03-28 13:13:27 -07:00
Shane Smiskol 31d70299ae
Tesla: add longitudinal controls allowed safety (#890)
* no long actuation if controls not allowed

* comment (bump)

* don't compare floats

* tesla longitudinal test

* clean up

* forgot all

* update constant

* fix
2022-03-28 13:03:07 -07:00
Shane Smiskol 8c7cb8c5b5
Honda Nidec: ACC_HUD safety (#889)
* Honda Nidec ACC_HUD safety

* probably what misra wants

* fix safety and add test
2022-03-25 14:29:18 -07:00
Shane Smiskol 7104818e14
rename unsafeMode to alternativeExperience (#878)
* alternative experiences

* not unsafe

* more renames

more renames

* not yet true

* I think we import from panda now

* update comments and test

* not needed

* bump health pkt version

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-03-24 14:31:31 -07:00
Adeeb Shihadeh e01c64574c
Toyota: increase torque rate limit (#887)
* Closer to HYUNDAI

* Change tests too

* Change MAX_RT_DELTA too

* Change test too

* Lower buffer to 20%

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
2022-03-23 13:48:49 -07:00
Shane Smiskol 0591f68008
Honda: fix missing interceptor tests (#886)
* setUpClass never did anything

* oh, comments work as pass?

* pass

* Update tests/safety/test_honda.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-03-22 14:34:05 -07:00
Adeeb Shihadeh 991638a3df
Tesla: only allow cancel button (#880) 2022-03-20 22:00:19 -07:00
Adeeb Shihadeh 499906f324
Nissan + Tesla: don't exit controls allowed on blocked message (#877)
* Nissan + Tesla: don't exit controls allowed on blocked message

* update tests
2022-03-18 14:52:52 -07:00
Adeeb Shihadeh ba10911dbc
GM: enters controls on falling edge of button presses (#876)
* GM: enters controls on falling edge of button presses

* update test
2022-03-16 11:46:57 -07:00
Adeeb Shihadeh 868fd5386c
Hyundai: enter controls on falling edge of buttons (#875) 2022-03-16 10:37:48 -07:00
Adeeb Shihadeh 4acaebb62b
Honda: enter controls on falling edge of button presses (#874)
* Honda: enter controls on falling edge of button presses

* update tests

* little nicer with enum

* remove duplicate

* fix that

* reset on init

* add honda prefix
2022-03-15 21:42:41 -07:00
Adeeb Shihadeh e6722c7f99
Honda Nidec: match openpilot engagement behavior (#872)
* Honda Nidec: match openpilot engagement behavior

* update tests
2022-03-15 15:19:54 -07:00
Adeeb Shihadeh 5a7af82f06
Hyundai: only allow cancel while cruise is enabled (#870) 2022-03-13 19:42:40 -07:00
Igor Biletskyy 891653fe31
Docker: bump openpilot and fix Toyota EPS scale factor for test (#869)
* new commit

* fix EPS scale for Toyota
2022-03-08 18:19:59 -08:00
Adeeb Shihadeh cb88a1756b
Honda: revert back to button enable for Nidec (#858) 2022-02-22 21:29:50 -08:00
Shane Smiskol 3bd3ae885a
GM: change from brake threshold to Brake_Pressed bit (#846)
* GM: Use ECMEngineStatus.Brake_Pressed

* use get bit

Co-authored-by: Jason Shuler <jshuler@gmail.com>
2022-02-04 23:23:29 -08:00
Adeeb Shihadeh c89c8db650 libpandasafety: cleanup addr checks 2022-01-30 12:32:58 -08:00
Adeeb Shihadeh bdb591f5e6
Honda: fix controls mismatch for stock PCM configs (#840)
* Honda: fix controls mismatch for stock PCM configs

* start tests

* all tests

* fix pylint

* misra

* Update board/safety/safety_honda.h
2022-01-29 16:56:39 -08:00
Adeeb Shihadeh 293d3ee43d fix typo in libpandasafety_py.py 2022-01-28 15:41:54 -08:00
Jason Young 2c419de8b0
safety tests: better CAN address range scanning (#827)
* better CAN address range scanning

* minor cleanup
2022-01-26 11:46:25 -08:00
Adeeb Shihadeh 730155cbcd
GM: use new DBC (#836)
* bump openpilot commit

* Rename GM PT dbc to generated

Co-authored-by: Jason Shuler <jshuler@gmail.com>
2022-01-24 21:13:54 -08:00
Jason Young 1735bec7d5
Fix safety test coverage and permissions (#828) 2022-01-17 22:13:32 -08:00
Jason Young a96615d253
Chrysler: remove standstill exception for gas disengage (#826)
* Chrysler: Normalize gas pedal handling

* revert CI test change
2022-01-13 16:04:40 -08:00
Adeeb Shihadeh f5857bc8fd
Toyota: add AEB message TX checks (#820)
* Toyota: add AEB message TX checks

* misra
2022-01-05 16:50:22 -08:00
Jason Shuler 83cf88557c
GM Switch to AcceleratorPedal2 (#813) 2022-01-03 15:54:37 -08:00
Igor Biletskyy 8d0d148681
Move shared definitions into separate file (#808)
* refactor definitions includes

* fix include

* revert dlc_to_len

* ...

* change name
2021-12-16 14:38:22 -08:00
Adeeb Shihadeh 652367d2e8
Honda: add support for new Bosch LKAS_HUD msgs (#793) 2021-12-05 13:10:47 -08:00
Adeeb Shihadeh eaa8f0e526 libpandasafety: add function to check all addr checks are valid 2021-12-01 14:45:10 -08:00
Adeeb Shihadeh 6bea710359 libpandasafety: add safety_tick 2021-12-01 13:21:46 -08:00
Adeeb Shihadeh c9992a80c0 bosch_harness -> bosch 2021-11-21 14:51:47 -08:00
Adeeb Shihadeh 801fd4997d
Honda: cleanup remnants of Bosch giraffe safety (#792) 2021-11-21 14:49:44 -08:00
Adeeb Shihadeh 7e5f568358 libpandasafety: make HW_TYPE optional 2021-11-19 14:21:04 -08:00
Adeeb Shihadeh 5d2d4ce1e7
Honda: remove bosch giraffe support (#791) 2021-11-18 23:35:14 -08:00
Adeeb Shihadeh e9365d44d3 libpandasafety: expose acc_main_on 2021-11-18 22:24:40 -08:00
Robbe Derks ddb3698f9b
Tesla longitudinal safety (#737)
* tesla safety cleanup + long WIP

* more long safety

* longitudinal safety tests

* fix misra

* add safety for main bus DAS_control

* acc_state is not enabled

* fix tests

* we don't want this

* fix Tesla common test
2021-11-18 13:50:10 +01:00
Adeeb Shihadeh fec966d6fd
Honda: handle ACC state consistent with ISO 15622:2018 (#789) 2021-11-17 17:27:24 -08:00
Jason Young b73fc69509
VW MQB: Prep for longitudinal safety (#788) 2021-11-17 12:00:39 -08:00
Igor Biletskyy ae26b75d7b
CAN_FIFOMailBox to CANPacket struct + USB dynamic packet size (#739)
* Squashed commits, no cleanup

* Few fixes

* No init = garbage

* Only receive with new canpacket

* Add send with canpacket

* Revert "Add send with canpacket"

This reverts commit 7d06686ddd6d447c714b5289d31af24403d36931.

* Packet must be aligned to word, or bad performance

* Cleaner

* Fix tests

* Tests...

* MISRA 10.4

* More MISRA

* libpandasafety_py

* cffi

* even more tests...

* typo

* ...

* ...

* ...

* Slight cleanup

* MISRA 6.1

* MISRA 17.7

* Bug in bxcan + even style

* MISRA 10.1

* Revert "MISRA 10.1"

This reverts commit 404ae7fcc39556f80f528de9015702e69f4ea0a5.

* ...

* MISRA 10.1 and 10.4 suppress until next PR

* MISRA 20.1

* ...

* test_honda

* ...

* ...

* test_toyota

* test_volkswagen_mqb

* test_volkswagen_pq

* Sketchy thing...

* Revert "Sketchy thing..."

This reverts commit 3b2e5715bdc1954f7b7b3b7469ba3d0eaa06bdf9.

* remove comment

* bxcan extended address bug

* Concept, experimental dynamic usb packet size

* increase each buffer to 10240 bytes

* raise python bulk read/write limits

* ...

* Move packet size to start

* Experimental send, stream-like

* New receive test, stream-like

* cleanup

* cleanup + rebase fixes

* MISRA

* Extra receive method, stream-like, commented out

* type change

* Revert back to buffer for send, stream commented

* forgot ZLP

* lower buffer, add rx failsafe

* ... remove ZLP

* return ZLP back

* Add tx checks to panda fw

* TX stream with counter

* fix counter overflow

* 13 free slots should be enough

* limit tx usb packet

* ...

* Revert max_bulk_msg doubling

* python lib improve speed

* Stream with counter for RX, dirty, needs cleanup

* Increase chunk length to 4096 bytes

* cleanup fdcan.h

* cleanup __init__.py

* MISRA 12.1

* MISRA 10.8

* remove non-streaming usb functions

* more main.c cleanup

* MISRA 15.6

* MISRA 15.5

* MISRA 18.4 and suppress objectIndex

* handling usb pakcets > 63bytes, naming and cleanup

* Cleanup old from tests and update CANPacket_t struct

* Switch to 4 bit DLC instead of 6 bit length

* ops)

* ...

* pylint

* receive python buffer increase

* USB increase receive packet len

* tweak buffers

* No need for so high limits

* MISRA 20.1 workaround

* performance tweaks

* cleanup, dlc to data_len_code naming

* main.c naming

* comments and cleanup for main.c usb

* clean py lib

* pylint

* do not discard good rx messages on stream fail

* cleanups

* naming

* remove bitstruct lib and lower tx limit

* bitstruct lefovers

* fix bug in VW test

* remove adjusting data size and assert on wrong len

* ...

* test new memcpy before merging

* Revert "test new memcpy before merging"

This reverts commit 399465a264835061adabdd785718c4b6fc18c267.

* macros for to/fromuint8_t array

* MISRA hates me!

* tests.c include macros instead

* move CANPacket to can_definitions.h

* vw_pq python test fix

* new memcpy test, REMOVE

* check without alignment

* revert macros for uint8 arrays

* Revert "revert macros for uint8 arrays"

This reverts commit 581a9db735a42d0d68200bd270d87a8fd34e43fe.

* check assert

* Revert "check assert"

This reverts commit 9e970d029a50597a1718b2bb0260196c050fd77f.

* one more variation

* Revert "one more variation"

This reverts commit f6c0528b7ac7e125750dc0d9445c7ce97f6954b5.

* what about read performance

* Revert "what about read performance"

This reverts commit d2610f90958a816fe7f1822157a84f85e97d9249.

* check struct alignment to word

* check for aligned memcpy again

* cleanup

* add CANPacket structure diagram

* update CANPacket and add USB packet struct

* bugfix + refactoring of EP1

* move dlc_to_len to header

* missed include

* typo...

* MISRA

* fk

* lower MAX_CAN_MSGS_PER_BULK_TRANSFER

* bump CAN_PACKET_VERSION to 2

* bump python lib CAN_PACKET_VERSION to 2

* rename parse_can_buffer to unpack_can_buffer

* CANPacket_t const fields

* Revert "CANPacket_t const fields"

This reverts commit cf91c035b7706a14e317550c5f0501ae3fce7c70.

* test.c relative path

* cleanup

* move macros to safety_declarations

* Refactor pack/unpack funcs and add unittest

* usb_protocol.h

* oops

* Update .github/workflows/test.yaml

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

* remove print from unittest

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-11-12 16:36:34 -08:00
Adeeb Shihadeh 73bbf58567
Nissan Leaf: tests + new brake signal (#777)
* Update safety_nissan.h

Updated brake CAN address to 0x25e and brake pressed to byte logic

* Update safety_nissan.h

missed a change

* Update safety_nissan.h

* Update safety_nissan.h

* Update safety_nissan.h

Corrected Line 79 to pull from the "CRUISE THROTTLE" message at address 0x239, byte 4, bit 6, which gets us to the "USER_BRAKE_PRESSED" bit for comparison if the brake pedal is being pressed.

* Update safety_nissan.h

Removed duplicate 0x239 message in "AddrCheckStruct"

* Update safety_nissan.h

Just adding back 0x1cc to see if that fixes things?

* leaf safety tests

* clenaup

* bump openpilot

* Update tests/safety/test_nissan.py

Co-authored-by: Kirk Miller <kirk.miller92@gmail.com>
2021-11-12 11:59:49 -08:00
Jason Young e9a4a2b688
VW PQ: Refactor tests to use CAN packer (#764)
* Lenkhilfe_3, Motor_2

* more Motor_2

* HCA_1

* GRA_Neu

* propitiate linter

* actually propitiate linter

* bump Docker openpilot ref
2021-11-02 23:04:19 -07:00
Adeeb Shihadeh bf77a0b20c
Mazda: only allow cancel while controls not allowed (#757) 2021-10-30 12:38:26 -07:00
Adeeb Shihadeh da4efd21c4
Mazda: allow sending HUD alerts (#754) 2021-10-29 23:39:38 -07:00
Adeeb Shihadeh 0d4e98f605
Mazda: only check ACC state for controls allowed (#753) 2021-10-29 12:12:53 -07:00
Adeeb Shihadeh a01ef1f7c9
safety: check relay malfunction in common TX hook (#752)
* don't check relay malfunction in car safety tx hooks

* check in safety

* fix tests
2021-10-29 11:16:27 -07:00
Adeeb Shihadeh def8558e3d fix safety replay 2021-10-25 16:08:49 -07:00
Adeeb Shihadeh ba749ddf25 libpandasfaety: don't build at import time 2021-10-25 16:05:20 -07:00
Igor Biletskyy 7e5a4e928a
Fix bug in safety tests (#740)
* Fix bug in safety tests

* Temporary skip error

* glitch

* Robbe's suggestion

Co-authored-by: Robbe Derks <robbe.derks@gmail.com>

Co-authored-by: Robbe Derks <robbe.derks@gmail.com>
2021-10-19 11:23:01 -07:00
martinl 5ab46ab70a
Subaru Global: use better brake pressed signal (#651)
* Change Subaru Global brake_pressed signal to Brake_Status Brake

* Change safety test to use Brake_Status Brake

* Use GET_BYTE for brake_pressed

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

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-09-28 21:26:04 -07:00
Alfonso Hernandez 9062d93f50
VW PQ: use Bremse_3 for ego speed (#730)
* Change VW PQ speed RX from Bremse_3 to Bremse_1

* Removed MSG_BREMSE_3 definitions since message is not used anymore
2021-09-27 09:39:59 -07:00
Willem Melching dd22fafc3c
Hyundai longitudinal (#711)
* Hyundai longitudinal

* return right addr checks

* add flag to pythong

* fix define

* check for stock ecu

* add rx check for buttons

* Block FCA11 actuation

* misra

* review 1

* comment about scaling

* clean up buttons

* use define for flag

* more extensive button checking

* check for AEB in scc12

* unsigned

* add knockout tests

* more unsigned

* cleaner
2021-09-13 20:41:10 -07:00
Willem Melching d1b104950a
Toyota: always allow -3.5 to 2.0 m/s^2 according to ISO 15622:2018 (#714) 2021-09-06 16:36:30 -07:00
Jason Young 033170750f
VW MQB and PQ: Fix controls entry conditions and tests (#707)
* use common tests for cruise and ACC state

* enter controls on rising edge of ACC

* oops

* remove old comment

* another

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-09-01 16:46:10 -07:00
Adeeb Shihadeh 8c687ecfb4
Revert "Honda Bosch: Support extended LKAS_HUD IDs (#615)" (#708)
This reverts commit 46593af619.
2021-08-28 21:11:37 -07:00
Chris Souers 46593af619
Honda Bosch: Support extended LKAS_HUD IDs (#615)
* Add support for new Honda Bosch vehicles

- Support extended LKAS_HUD IDs on Honda Bosch

- Support extended ID checksum on incoming frames in safety hook (currently unused).

condense

Cleaner. Don't need to store the value in checksum at the return.

Co-Authored-By: Adeeb Shihadeh <adeebshihadeh@users.noreply.github.com>

* revert checksum change

* use full space

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@users.noreply.github.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-08-21 23:34:51 -07:00
Igor 9f781e9e7e
Abstract MICROSECOND_TIMER (#690) 2021-07-14 10:59:28 -07:00
Igor 7d93e5a202
Refactor HAL (#656)
* Let refactoring begin!

* Fix pedal build

* Fix pedal safety tests

* Forgot few TIM2 instances

* Try this way with misra

* More misras...

* More misras...

* Still fighting with misra blindfolded

* Almost got it!

* Last misra error..

* Last misra error..

* Misra works locally..

* Maybe this?

* Looks like it was cppcheck bug, revert changes

* Suggested changes and reverts

* File structure change

* revert includes

* remove spaces

* remove timer delay

* endings

* more typing

* rename early to early_initialization

* Remove delay_us

* Revert RTC default values

* Revert initialization sequence

* Fix quotes

* Revert

* Return TIM6EN

* Alias slow timer to TICK_TIMER

* Refactor files structure

* Remove definition of PANDA

* Abstract timers

* Fix include

* tick_timer_init

* Split usb driver

* Move LL stuff: adc

* Move LL stuff: usb

* Fix include again...

* Will check pedal builds also locally..

* Move LL stuff: CAN

* Move LL stuff: clock

* Rename common to peripherals and move

* Move board HAL

* Change include, not needed for pedal

* llgpio to gpio and new lines fix

* remove board_has_relay, not used

* Remove board_functions.h and add to board struct

* Move include

* Fk MISRA...

* has_onboard_gmlan to has_hw_gmlan

* Typos

* Move board_declarations include

* Shuffle

* More abstraction

* fix paths, fix cppcheck test

* Fix for pedal build with USB
2021-07-02 18:25:35 -07:00
robbederks d8385413c3
New tesla safety (#629)
* WIP: new tesla safety

* fix misra

* add unit test

* use | instead of +

* other angle sensor

* change brake message

* fix cancel safety violation

* fix bus for cancel message

* add support for autopilot passthrough and fix cancel message

* fix tests

* this check fails

* fix build

* fix build on c2

* cleanup

* add back AP status to the check

* bus 2

* this check is dumb

* try this?

* add route to do replay on

* cleanup

Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2021-06-23 12:41:43 +02:00
Willem Melching d7b3ae0282
Extra checks for Honda Bosch Longitudinal (#662)
* only allow tester present

* ensure radar is not sending messages

* cleanup

* add honda flags

* Constrain tester present message exactly

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

* little endian

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-06-22 15:29:47 +02:00
ShaneSmiskol ad12330d50
Hyundai: add gas pressed signal for hybrids (#655)
* detect safety param and get gas pressed for PHEVs

* misra guidelines

* else no action

* use explicit safety param

* update for full test coverage

* full hyundai gas press test coverage

* panda's out of date

* update commit?

* need to check out all

* need rednose too

* works without

* override _gas_msg method for each class

* update safety

* is define okay?

* misra

* like this convention better

* convention and fixes

* bump to openpilot master

* simplify

* add to non legacy rx checks

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-06-10 00:21:54 -07:00
Adeeb Shihadeh 7d9fdd1108
Toyota: whitelist LTA message (#638)
* Toyota: whitelist LTA message

* LTA safety

* simple test

* little more test

* misra
2021-04-06 16:56:03 -07:00
Greg Hogan c416419c16
hyundai: TCS13 checksum (#623) 2021-04-05 08:44:16 -07:00
Greg Hogan a3b95dc26d
hyundai: WHL_SPD11 checksum (#622)
* WHL_SPD11 checksum

* update comments
2021-03-31 18:39:13 -07:00
Adeeb Shihadeh 596344e48b
build libpandasafety with scons (#639)
* build libpandasafety with scons

* remove makefile

* fix that
2021-03-31 18:35:47 -07:00
Jason Young 9108b82fb0
VW MQB: Updated message and signal data, round 1 (#632)
* EPS_01 -> LH_EPS_03

* Bump openpilot commit ref

* made echo test more stable

* update python to 3.8.5

* Revert "Bump openpilot commit ref"

This reverts commit 75ec1a0c

* Bump openpilot commit ref

* Bump openpilot commit ref

* Update Dockerfile.panda

* fixed torque signal name

* Signal naming fix, round 2

* fix CI

Co-authored-by: Robbe Derks <robbe.derks@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2021-03-14 16:24:53 -07:00
Adeeb Shihadeh 9fb584b20c
Hyundai: increase max torque (#602)
* increase max hyundai torque

* update test threshold
2020-10-01 12:03:23 -07:00
Adeeb Shihadeh ecef0a19d0 add dos to safety tests 2020-08-12 13:32:33 -07:00
Andre Volmensky 3a8430b9d5
Updating X-Trail/Rogue gas_pressed threshold (#585) 2020-08-08 11:10:32 -07:00
martinl c55e84bf56
Change Subaru safety test to use generated dbc (#575)
* Change Subaru test to use generated dbc

* update openpilot pinned commit
2020-07-23 13:06:11 -07:00
Adeeb Shihadeh 0d97b6d4eb
Safety Test: ensure TX msgs for other cars are blocked (#521) 2020-06-21 23:25:54 -07:00
Adeeb Shihadeh 5b14945140
Abstract RX checks for gas, brakes, and relay malfunction (#556)
* abstract gas, brake, and relay RX checks

* toyota

* mazda

* vw and subaru

* gm, honda, nissan

* chrysler

* rename

* revert that
2020-06-16 02:01:00 -07:00
Adeeb d0442fd1e4
add hyundai legacy safety mode (#554) 2020-06-12 18:03:31 -07:00
martinl b2c86eb66b
Subaru safety refactoring (#532)
* Update subaru safety tx messages

* Add Subaru preglobal driver torque limits

* fix preglobal desired_torque

* fix subaru preglobal torque rate limit and tx messages

* readability update for desired_torque

* fix preglobal tests

* Subaru safety refactoring, added missing legacy checks and updated test

* Remove subaru_global check from tests

* Reorder legacy constants, remove subaru_init

* Update Subaru legacy safety and tests to match dbc scaling factors

* remove scaling factor from torque_driver

* Change preglobal driver torque scaling factor

* Change driver torque factor to 10

* Fix preglobal dbc name

* Fix Subaru legacy safety test

* update openpilot commit

* init valid with one line
2020-06-11 15:51:05 -07:00
Adeeb Shihadeh 9eee6ca556 update safety tests after DBC changes 2020-06-09 16:51:08 -07:00
Willem Melching e0a706e4f0
Stricter pylint (#550)
* stricter pylint

* Add as argument
2020-06-02 16:27:07 -07:00
Adeeb d7f7b14118
Enable almost all Flake8 checks (#548)
* fix W391

* E262

* E703

* W293

* some E

* E231

* some more E

* E225

* more E

* E252

* no tabs

* more tabs

* E701

* uds.py

* almost all of them

* only e265 left

* not sure why this is triggering on commented out code

* ignore esptool
2020-06-01 01:49:26 -07:00
Adeeb Shihadeh eba113cb67 backslash is redundant between brackets 2020-05-31 17:39:42 -07:00
Adeeb Shihadeh 275e76c2b2 fix linter complaint about too many blank lines 2020-05-31 17:20:47 -07:00
Adeeb Shihadeh 9102c16118 two spaces before inline comment 2020-05-31 14:07:01 -07:00
Willem Melching b8267341a1
Add pre commit checks + CI (#545)
* Add pre commit checks

* untested but should work

* fix typo in dockerfile

* add sqlite

* add pylintrc to ignore usb1 members

* Typo in stage name

* Move to requirements
2020-05-29 11:52:03 -07:00
Jafar Al-Gharaibeh 89658d0bde
Mazda: safety tests add missing safety checks (#525)
* Mazda: add safety test

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Update mazda safety to capture more events

    * gas press
    * brake press
    * speed - lkas on/off

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Customize safety tests

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Add RX checks

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Format

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Set lkas enable speed at 52 kph

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Test case when speed<enable_lkas_speed

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Be consistent with names in other places

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Add test case for lkas on when speed dips below lkas enable speed

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Make sure lkas disabled

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Use car's speed signal instead of wheel speed

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* Allow acc cancel msg

  When gas is pressed OP disenages stock cruise doesn't get disengaged.
panda needs to know when OP engages again. OP re-enageges on cruise button
presses. This commit uses the same re-enage logic in panda.

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* rebase

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* allow acc_cancel in safety tests

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>

* rename variable, fix comment

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
2020-05-28 13:09:54 -07:00
Adeeb 9ebde2535c
Reset state on safety mode init (#542)
* reset state on safety mode init

* more global state

* reset message seen too

* misra
2020-05-26 14:23:39 -07:00
Adeeb 0657064594
Hyundai checksum (#540)
* 3/5 hyundai checksums done

* cleanup

* these 3 should be universal across all hkg

* fix tests

* fix misra
2020-05-22 14:40:51 -07:00
Adeeb Shihadeh 0610ed1e25 Hyundai wheel speed counter is actually 4 bits spread over two signals 2020-05-17 22:40:51 -07:00
Adeeb 55b79b4721
GitHub Actions (#535) 2020-05-17 19:53:23 -07:00
Greg Hogan 01bf740240 remove 0x1BE checksum test 2020-05-14 15:44:38 -07:00
Greg Hogan c31b899a58 honda bosch longitudinal safety 2020-05-14 15:44:38 -07:00
Adeeb e4558c0737
Safety: message length check on RX and TX (#529) 2020-05-11 12:58:33 -07:00
Adeeb 869f123218
Hyundai: counter check (#530)
* hyundai counter check

* fix misra

* add counter to tests
2020-05-09 00:52:57 -07:00
Adeeb Shihadeh 0a123b1815 that too 2020-04-30 14:54:40 -07:00
Adeeb Shihadeh ba6355d4c0 unused lines 2020-04-30 14:53:43 -07:00
Adeeb c9102c00ee
Chrysler: use can packer in safety tests (#522)
* Chrysler: use can packer in safety tests

* bump opendbc
2020-04-30 14:26:28 -07:00
Adeeb 9874e73350
Abstract steering safety tests for Toyota and Chrysler (#520)
* start abstracting torque steering tests

* remove duplicate

* chrysler

* remove that

* revert that for now

* fix toyota

* unused
2020-04-29 20:37:12 -07:00
Chris Souers 2299ecffc4
Block 0xe5 (Honda Bosch) at the panda/uno. Only allow static values. (#515)
* Safety for static 0xe5

Passes Misra test

* Add e5 to test.

* Readd
2020-04-28 14:13:00 -07:00
Adeeb 3517306113
Subaru: fix steer torque scaling (#501)
* Subaru: fix steer torque scaling

* fix legacy test
2020-04-28 10:47:26 -07:00
Adeeb 0bc864b3d5
Make torque-based steering state global (#518)
* use generic steering state vars for toyota

* chrysler

* gm

* comment

* more unnecessary lines

* hyundai

* subaru

* vw

* fix mazda
2020-04-28 10:33:20 -07:00
Adeeb d9355c4148
Make cruise_engaged_prev a global + test case for it (#519)
* make cruise_engaged_prev a global

* test for cruise_engaged_prev
2020-04-27 22:13:30 -07:00
Adeeb 2115376412
Abstract sample speed test (#516)
* all cars move

* honda

* update comments

* vw
2020-04-27 21:36:56 -07:00
Adeeb Shihadeh 11dc9054f9 remove unused function 2020-04-27 20:38:27 -07:00
Adeeb e5a586eea9
Abstract gas interceptor tests (#517)
* abstract interceptor tests

* honda
2020-04-27 20:35:36 -07:00
Adeeb 1dbed65e38
Safety Test Refactor: Honda (#495)
* nidec

* bosch

* button

* more common

* packer

* more packer

* readability

* tx too

* don't need that

* delete StdTest

* don't need to duplicate this

* only nidec has interceptor
2020-04-27 19:40:15 -07:00
Adeeb Shihadeh 0632710acd base class for different panda safety tests 2020-04-27 15:39:08 -07:00
Adeeb Shihadeh bd98fe6031 safety tests: use shorter function name 2020-04-27 15:27:28 -07:00
Adeeb 884afa0ef7
Safety Test Refactor: Chrysler and Volkswagen PQ (#508)
* volkswagen pq

* chrysler

* cleanup
2020-04-17 13:34:23 -07:00
Adeeb d77b72d169
Safety Test Refactor: Nissan (#510)
* start nissan

* packer
2020-04-17 13:33:36 -07:00
robbederks 0336f625dc
Pedal gas pressed safety limits (#507)
* Fixed toyota pedal gas disengage and increased pedal limits to OP limits +5%

* Fix safety unit tests?

* Fix imports

* Fix imports #2
2020-04-16 14:52:59 -07:00
Willem Melching 715b1a1695
Hyundai-Kia-Genesis (HKG) (#503)
* update hkg steer torque message

* misra

* Get bus

* Allow sending LFA HDA message

* Add blacklisted addr

* Update safety replay

* Cleanup bus checks

* Update to new torque message
2020-04-15 19:33:41 -07:00
Adeeb 6f105e827b
Safety Test Refactor: Subaru (#502)
* subaru global kind of works

* all global uses can packer

* fix legacy

* legacy uses can packer

* bump opendbc

* i guess docker caches that
2020-04-15 17:00:21 -07:00
Adeeb 57cc954f24
Safety Test Refactor: GM (#504)
* start GM refactor

* use packer
2020-04-15 16:59:01 -07:00
Adeeb dd01c3b9ca
Safety Test Refactor: Hyundai (#505)
* use PandaSafetyTest for hyundai

* use packer
2020-04-15 16:58:13 -07:00
Adeeb 6c442b4c33
Safety Test Refactor: Volkswagen MQB (#493)
* pull test_volkswagen_mqb.py from safety-test-refactor

* prev_brake is now a standard test

* abstract cruise enable/disable tests

* unused

* move

* hack to get around unittest reporting skipped tests
2020-04-13 17:13:08 -07:00
Adeeb 8cc3a35700
remove cadillac (#496) 2020-04-13 14:43:46 -07:00
Adeeb 62e4d3c369
Chrysler: fix missing button signal on TX (#490)
* Chrysler: fix missing button signal on TX

* fix test
2020-04-10 13:48:41 -07:00
Adeeb abce8f32b1
Safety Test Refactor: Toyota + support code (#491)
* bring over toyota + support code from safety-test-refactor

* old tests still use StdTest

* don't duplicate

* test fwd

* make linter happy

* fix indent

* fix ident

* fix order

* whitespace

* move some common tests

* cleanup

* unused

* comment
2020-04-10 13:45:55 -07:00
robbederks 500370aecd
Make sure relay faults make it to the health packet (#492)
* Added relay malfunction handling

* Bump version

* Fixed safety test

* set/reset

* fixed test again
2020-04-09 15:53:46 -07:00
Adeeb bc90b60f97
toyota: use universal gas pressed bit (#488)
* toyota: use universal gas pressed bit

* fix tests
2020-04-09 12:09:34 -07:00
George Hotz d88013450d remove from there as well 2020-04-06 14:49:40 -07:00
eFini 4e98bbe8c9
Apply unsafe allow gas mode to all cars. (#480)
Apply unsafe iso accel/decel limit to toyota.
2020-04-06 08:56:36 -07:00
Jason Young b9a9ea395f
Unsafe gas disengage mods, fix test compile warning (#481) 2020-04-01 14:03:13 -07:00
Jason Young 08ef92d585
Safety model for Volkswagen PQ35/PQ46/NMS (#474)
* Align with VW Community port 0.7.4-devel

* Import of PQ35/PQ46/NMS safety work

* Add safety replay drive for PQ35/PQ46/NMS

* Unwind community port hax for upstream, bump Panda ver

* Update comment

* Reduce whitespace diff

* Reduce whitespace diff

* Don't test the drive until it's uploaded

* Propitiate MISRA

* Ixnay on the VERSION LF

* Remove VERSION LF, update safety_replay with PQ drive

* Freshen cereal ref to include fields used in VW PQ test drive

* Remove superfluous return

* Bypass Docker caching issue
2020-04-01 12:38:27 -07:00
Jason Young 51e0a55d6d
Support code for unsafe mode unit tests (#478)
* Support code for unsafe mode tests

* Fix pre-existing MISRA warning while I'm here
2020-04-01 10:17:51 -07:00
Willem Melching de89fcdc4f
Nissan leaf (#473)
* use rear wheels for speed

* Add leaf gas message

* Add brake press check to safety

* Fix typo in comparison

* threshold on gas and brake pressed and add cruise enabled check

* Fix brake pressed result

* Use same message for cruise enabled detection

* Fix typo

* Fix tests

* Add RX checks

* Allow sending cancel from panda

* Add cancel command to TX messages in tests

* Remove angle limit

* Change speed factor

* Change speed factor in tests

* Remove max angle from tests

* Fix tests

* try cancel using seatbelt

* Try different cancel message

* Fix TX_MSGS in test

* Fix fwd test
2020-03-27 21:45:16 -07:00
rbiasini 0696730c14
Toyota: add missing offset from speed signal (#469)
* Toyota: add missing offset from speed signal

* Let's also define ABS value in macro
2020-03-11 17:30:30 -07:00
Andre Volmensky 5b1a8dc873
Filtering LKAS HUD messages (#468)
* Filtering LKAS HUD messages

* Added nissan test_fwd_hook()

* Added Nissan TX_MSGS safety test

Co-authored-by: rbiasini <riccardo.biasini@gmail.com>
2020-03-11 00:00:33 -07:00
Riccardo Biasini 99050f4129 test_spam_can_buses was missing from Nissan 2020-03-10 17:42:07 -07:00
rbiasini 0f21b19bb3
Cleanup pedal nomenclature (#467)
* consolidate gas and brake nomenclature

* fixes in code and tests
2020-03-08 23:48:00 -07:00
rbiasini ceff91d3c5
Standardize brake safety tests (#465)
* WIP: improve safety test format

* Fix tests
2020-03-07 23:22:47 -08:00
rbiasini 04809e1329
Hyundai brake check (#464)
* WIP: adding brake check

* Added Hyundai brake tests
2020-03-07 21:26:03 -08:00
rbiasini 74c8ee0a7a
Subaru brake check (#463)
* WIP: subaru brake check

* FInalized logic and added tests to Subaru brake check
2020-03-06 22:29:46 -08:00
Jason Young c7d0d5fc7b
Volkswagen safety updates: Phase 3 (#462)
* Torque limit bump, change signal for ACC state tracking
2020-03-05 21:27:19 -08:00
rbiasini 4368748851
WIP: Toyota brake check. (#459)
* Toyota brake check with safety tests
2020-03-05 00:16:03 -08:00
rbiasini b2dbb504dc
remove toyota ipas safety code and tests (#460) 2020-03-04 10:54:13 -08:00
rbiasini 11ef24bc16
Improve tests (#456)
* much more thorough Honda-Bosch tests and better test inheritance. Also fix counter test bug

* Fixed other counters too

* remove unnecessary function
2020-02-29 09:00:29 -08:00
rbiasini fb02390d4c
Subaru checksum counter (#455)
* Added Subaru Global checksum and counter checks
2020-02-27 17:33:51 -08:00
rbiasini 9a44499879
Fix Subaru Legacy Torque driver bug (#454)
* Fix Subaru Legacy Torque driver bug
2020-02-27 17:20:58 -08:00
rbiasini dfa6b079de
separating subary legacy safety mode from global (#452)
* separating subary legacy safety mode from global

* added explicit tests for subaru legacy, which were absent before
2020-02-27 15:28:24 -08:00
rbiasini dad5858b8c
Chrysler: add brakepress cancellation (#451) 2020-02-26 18:19:18 -08:00
Andre Volmensky db94a5b813
Added Nissan safety (#244)
* Added Nissan safety
2020-02-26 11:11:56 -08:00
rbiasini d7f1195d1e
Chrysler Checksum/counter (#450)
* abstract crc function

* counter-checksum for chrysler

* also adding checksum to tests
2020-02-24 16:36:46 -08:00
rbiasini 1b49d3e830
Hyundai: add gas disengage and tests (#447) 2020-02-22 10:13:32 -08:00
Jason Young 598074c192
Volkswagen safety updates: Phase 2 (#445)
* CRC and counter checks, standstill/brake checks

* Clean up a tsk_06 that snuck through

* Be consistent about how we call _msg_esp_05

* Reduce scope: haunted by the ghost of MISRA future

* Improved check/test for in-motion braking

* MISRA styling fix
2020-02-20 13:57:07 -08:00
rbiasini b2ffaae60e
Chrysler: disengage on gas press (#442)
* add gas cancellation for chrysler
* added regr test too
* also add bus checks to chrysler. SHould have been there already
2020-02-19 23:46:38 -08:00
rbiasini 2ebbe3616b
Subaru: disengage on gas press (#446)
* Subaru: check for gas pressed

* added tests

* rx freq check on throttle

* also support for the not yet supported pre-global platform
2020-02-19 19:55:05 -08:00
Jason Young ccf75c456f
Volkswagen safety updates: Phase 1 (#444)
* Checkpoint Panda refactoring updates

* Rename MQB safety tests in preparation for PQ

* Refactor MQB tests, add missing torque test

* Bring in MQB init without CRC LUT setup

* Fix to ACC_06 test case

* Fix to ACC_06 test case

* Tweak comment for clarity

* Drop superfluous return
2020-02-19 12:37:38 -08:00
Arne Schwarck eb5020b7a9
Add the ability to communicate with BSM (#433)
* Add the ability to communicate with BSM

To poll the blind spot sensor 0x750 is required

* Add blindspot monitor communication
2020-02-11 10:15:39 -08:00
Riccardo fed3aca0da Honda: forward radar_hud msg 2019-12-22 18:42:46 -08:00
rbiasini d301a59d64
WIP: Checksum checks (#403)
* add lag message check for all supported cars
* add checksum and counter checks for toyota and honda
* add rx hook regression tests
2019-12-21 10:25:54 +01:00
Riccardo c08b480cea separate between bosch giraffe and harness hooks. Make tests more thorough 2019-12-20 23:18:20 -08:00
Riccardo 110ca03160 remove long_controls_allowed unused param and reduce technical debt 2019-12-20 16:17:37 -08:00
Riccardo d19fd3e6bd better differentation of honda safety modes 2019-12-20 15:51:32 -08:00
Riccardo 6bbae7be2f VW safety: allow cancel spam on both buses to be compatible with camera and gateway integration 2019-12-03 19:48:33 -08:00
Riccardo 878dd00ac8 solve race condition is relay_malfunction right after changing the relay status by adding a counter 2019-11-26 21:37:01 -08:00
Riccardo 8a044b3444 forgot Hyundai: now also using make_msg 2019-11-19 11:33:23 -08:00
Riccardo 4f9c879696 remove abunch of lines from safety regression tests by using common make_msg function 2019-11-19 11:29:04 -08:00
Riccardo d5c772b0b1 Fixe Toyota message white-list 2019-11-18 12:52:31 -08:00
Riccardo 212d336b3d Safety Chrysler: Added cancel spam button check 2019-11-17 22:32:13 -08:00
rbiasini 6249a183d6
tx_hook shall have a white-list of messages (#381)
* Started whitelisting messages

* Also toyota and cadilalc fix

* bug fixes and better checks. Need to figure out a solution for honda

* Whitelist also for subaru

* Added Chrysler as well to whitelist

* And Hyundai too

* now all supported cars should have a whitelist of messages

* Fix linter

* This should fix process replay

* Honda too is now whitelisted

* struct typedef

* Had forgot GM

* had a wrong addr for GM whitelist

* This should fix all the tests

* bump panda
2019-11-17 00:24:19 -08:00
Riccardo e0de1a4fc8 define ALLOW_DEBUG in safety tests 2019-11-15 13:19:02 -08:00
Riccardo e74ed93640 safety tests a bit more simplified 2019-11-15 01:12:54 -08:00
Riccardo 2027765bd0 relay malfunction test centralized 2019-11-15 01:03:34 -08:00
Riccardo 8af1a01ac6 clean up safety tests 2019-11-15 00:52:34 -08:00
rbiasini cfcce8f06b
WIP: Relay malfunction (#384)
* relay malfunction handling. WIP

* more cars to relay_malfunctions

* fixed safety tests

* minor change

* Fix linter

* all cars now have a relay_malfunction safety check

* added relay_malfunction safety test for fwd hooks

* added proper regression tests for relay malfunction to all cars

* temp patch to not fail regression in honda bosch

* also addr 0x194 is some nidec honda is steer control

* proper relay check for honda bosch too
2019-11-15 00:32:45 -08:00
Riccardo d063a18885 Hyundai safety: re-enable button spam safety check 2019-11-13 23:57:29 -08:00
Riccardo e8d7ed1d90 Rename function name to not confuse safety_set_mode and set_safety_mode 2019-11-06 14:30:22 -08:00
rbiasini 48d0d0c782
VW button spam: fix safety and add tests (#306)
* VW button spam: fix safety and add tests

* button spam is actually sent on bus 2

* Fix safety test. Still need to add gas safety test

* added gas safety test to VW and using consistent nomenclature

* style fixes
2019-10-29 15:11:42 -07:00
rbiasini a12a148d5f Uno (#274)
* Added uno

* Added usb switch support

* Added PWM and IR power functions

* Implemented bootkick

* Added uno as a new hw type

* Bumped version

* Added fan control and tach readout

* WIP: RTC support

* Working RTC

* Fixed python

* Misra compliance

* Added USB control messages for fan/IR power

* Added USB commands + tests for fan & IR control. Fixed bootstub and pedal compilation

* Added IR and fan to power saving mode

* Changed defaults

* Fix safety considering uno

* passing safety now

* Minor UNO tweaks

* Fixed version

* More minor temporary tweaks

* Removed usb load switch from uno

* Added power control for shutting down the fan completely

* Disable IR LEDs by default

* Fixed linter issue

* Linter fix #2
2019-10-25 16:22:42 -07:00
Riccardo 40075321dc VW: stricter limits to comply with comma safety policy 2019-10-24 19:52:16 -07:00
Riccardo 7434c5ce28 centralize requirements for tests 2019-10-15 14:21:33 -07:00
rbiasini fce38a91d7
Linter python (#299)
* Added pyflakes and Pylint for python

* Actually run linter in CI

* some simple pyflakes changes

* Add flake8 to panda reqs for linter test

* flake8 errors are fixed

* run flake8 in regression tests

* meant to run flake8

* hack to ignore unused import

* bug

* fix bugs in tucan_loopback

* Another fix by using set_safety_mode

* added pylintrc file

* more fixes and enabled pylint as well

* Fix pylint in circleci

* added linter to readme
2019-10-15 14:03:31 -07:00
Jason Young 4972376de3 Update VW regression test to follow Comma safety index refactoring (#296)
* Follow along with recent Comma safety index refactoring.
2019-10-10 14:57:16 -07:00
Jason Young 2f9e076289 Panda safety code for Volkswagen, Audi, SEAT, and Škoda (#293)
* Panda safety code for Volkswagen, Audi, SEAT, and Škoda.

* First pass at MISRA compliance.

* Second pass at MISRA compliance.

* Fix scope of violation boolean.

* MISRA doesn't care for implicit cast of unsigned int to boolean.

* Remove superfluous newline.

* Remove unused VW ignition hook code, preserve commentary.

* Add 50% padding to max delta check.

* Add 50% padding to max delta check.

* Add clarity around the origin of our safety constants.

* Update test RT delta to match safety.
2019-10-09 13:54:22 -07:00