Commit Graph

2990 Commits

Author SHA1 Message Date
Shane Smiskol
a5753a2077 safety helpers: hide debug print for now 2023-12-09 02:28:10 -08:00
Shane Smiskol
cf108cd4cc safety: full coverage (#1750)
* stash

* if x > xy.x[0], then subsequent x < xy.x[i+1] enforces it is monotonic, or uses last y

* rm

* test safety tick

* coverage: include safety.h

* car-only test

* MAX

* op

* add safety_config_valid
2023-12-09 02:27:29 -08:00
Adeeb Shihadeh
fbef31126f remove misra-c2012-21.1 suppression (#1765) 2023-12-09 01:31:52 -08:00
Adeeb Shihadeh
6e96d2e57a misra test cleanup (#1764)
* misra test cleanup

* fix pedal

* cleanup

* debug

* fix

* undo debug

* add CAN3
2023-12-09 01:28:50 -08:00
Adeeb Shihadeh
7340ece196 misra mutation test (#1763)
* misra mutation test

* a few cases

* revert that

* fixups

* test that

* build fw
2023-12-08 23:20:42 -08:00
Shane Smiskol
80782bcbe4 Toyota: LTA steering control safety (#1189)
* simple lta safety

* fix compilation error

* allow current angle when disabled

* toyota angle rate limits

* use GET_BIT

* update limits, temp fix blocked msgs (not critical safety)

* try these limits

* debug

* add setme check, double rate limit for half rate

* update safety limits to openpilot (2 bp)

* had duplicate checks here

* rm line

* better comment

* silly bug

* draft

* Revert "draft"

This reverts commit 756ef70135.

* toyota: add safety for tester present

* block ACC_HUD

* check stock ECU

* add test

* and now pass test

* safety replay: support toyota lta

* remove radar stuff

* max torque safety

max torque safety

* driver torque

* one line

* match openpilot limits

* rename to max_angle and check quality flag

* measure current angle

* clean up

* oh we can combine

* no driver torque limiting for now

* todo: decide the tolerance if any

* add max angle and prepare for to enable inactive safety

* enable inactive safety

* fix replay when inactive

fix replay when inactive

* fix qf check

* ohh this was a bug

* measure vehicle speed

* because safety is in m/s

* rm MeasurementSafetyTest

* stash very draft changes

* fix

* uncomment

* clean up

* rm

* already added

* clean up

* temp fix

* test angle measurements

* add constant

* ltl cleanup

* include this test in test_angle_measurements

* better

* order makes more sense

* fix

* clean up ford cmts

* move to base

* todo

* misra

* already do this below

* angle tests: take in max angle as argument

useful for safety modes that are limited (ford/toyota)

* fix ramp test: round measurement since toyota's scale isn't round

* clean that up

* no subtest

* back

* is tested now!

* flat is more clear

* add check for mismatching bits

* LTA is fully tested now

* clean up

* test_angle_cmd_when_enabled

* whops

* flip

* fix broken test

* need this if we type angle meas func

* should set prev torque

* no subtest

* remove default valid qf

spce

* one line

* cmt

* fixes

* vehicle speed macro

* vehicle speed macro v2

* Update board/safety_declarations.h

* easier to follow

* one line

* rightttt

* rename to toyota_lka_rx_checks, not default
2023-12-08 15:00:23 -08:00
Shane Smiskol
f741a90de8 safety: macro to update vehicle speed (#1762)
vehicle speed update macro
2023-12-06 18:05:07 -08:00
Shane Smiskol
845658e169 Toyota LTA: set torque measurement (#1761)
* catch

* fix ramp test: round measurement since toyota's scale isn't round

* reorder

* can be in main PR
2023-12-06 17:46:48 -08:00
Adeeb Shihadeh
fa2b8c0e47 pre-commit: autoupdate hooks (#1759)
Update pre-commit hook versions

Co-authored-by: adeebshihadeh <adeebshihadeh@users.noreply.github.com>
2023-12-05 11:04:47 -08:00
Shane Smiskol
ea78657bef Toyota: rename LTA torque wind down signal (#1757)
* rename setme_x64

* bump opendbc ref
2023-12-04 21:05:02 -08:00
Adeeb Shihadeh
a9af9cbd74 run safety tests in parallel (#1756)
* run safety tests in parallel

* fix

* fix path
2023-12-04 20:50:43 -08:00
Adeeb Shihadeh
892ca5a0f1 this is a better name 2023-11-30 19:20:08 -08:00
Adeeb Shihadeh
b50455cc76 safety: specify RX message frequency in Hz (#1754)
* safety: specify RX message frequency in Hz

* these are redundant now

* update that

* cleanup
2023-11-30 14:55:15 -08:00
Shane Smiskol
c57a3c2d15 safety replay: support Nissan (#1753)
* nissan safety replay

* hex
2023-11-29 23:07:25 -08:00
Shane Smiskol
2ee6e36e99 safety replay: set angle measurement (#1752)
set angle meas in safety replay
2023-11-29 23:04:14 -08:00
Shane Smiskol
d070f6e7c9 Toyota tests: rx speed messages in correct scale (#1751)
because it's kph, safety works in m/s
2023-11-29 20:49:50 -08:00
Adeeb Shihadeh
09465a753c pre-commit: autoupdate hooks (#1748)
Update pre-commit hook versions

Co-authored-by: adeebshihadeh <adeebshihadeh@users.noreply.github.com>
2023-11-28 14:22:03 -08:00
Adeeb Shihadeh
e6fadef4dd one more int -> bool 2023-11-27 16:29:07 -08:00
Shane Smiskol
5884962372 Honda: fix alt brake address check race condition (#1746)
* common honda addr checks

* oohhhh

* rename RxCheck from merge

* more rename

* checked data and found 0x1A6 does not exist on any Bosch, so combining with 0x296 is safe

* formatting

* need this since refactor

* clean up

* fixup

* misra

* coverage caught another bug!

* another duplicate addr from multi tests

* proper base class

* formatting

* misra

* flat

* Revert "flat"

This reverts commit d5ea2adf26.

* forgot to specify bus (fuzzy test caught it, but whitelisting rx addrs
would so much quicker)
2023-11-27 00:18:24 -06:00
Shane Smiskol
beffd7bcbf Nissan: check bus for brake pressed msg (#1740)
* never checked bus!

* easy fix
2023-11-26 21:07:20 -06:00
Adeeb Shihadeh
6eb89cefdf board: remove set_phone_power (#1747) 2023-11-25 13:17:08 -08:00
Adeeb Shihadeh
c67c973b99 Revert "Honda: fix alt brake address check race condition (#1723)"
This reverts commit 42a62936fb.
2023-11-24 16:49:55 -08:00
Adeeb Shihadeh
aa6ea0772b Revert "safety: check interceptor msg counter (#1738)"
This reverts commit 83acc65743.
2023-11-24 16:49:26 -08:00
Adeeb Shihadeh
dc1fd96118 Revert "H7: fix GMLAN bitbang timer (#1542)" (#1745)
This reverts commit 5778c0ae5d.
2023-11-24 16:00:18 -08:00
Adeeb Shihadeh
574d2db10d remove more kline usage 2023-11-23 17:29:53 -08:00
Adeeb Shihadeh
666a462450 remove low level LIN support (#1744) 2023-11-23 17:18:25 -08:00
Adeeb Shihadeh
4c0d2505b7 remove k-line driver (#1743) 2023-11-23 17:09:10 -08:00
Adeeb Shihadeh
3b22bc18c6 safety: more int -> bool (#1742) 2023-11-23 16:48:08 -08:00
Adeeb Shihadeh
f1cd12651c safety: remove LIN hook (#1741)
* safety: remove LIN hook

* rm more
2023-11-23 16:30:20 -08:00
Adeeb Shihadeh
194f2d9657 safety: cleanup comments 2023-11-23 16:16:03 -08:00
Shane Smiskol
83acc65743 safety: check interceptor msg counter (#1738)
* toyota: check interceptor counter

* add counters and check rx

* honda: check counter

* clean up
2023-11-21 17:23:37 -08:00
Shane Smiskol
8b068880d1 safety tests: common interceptor msg (#1737)
* common interceptor msg creation

* cnt not needed yet
2023-11-21 14:35:35 -08:00
Adeeb Shihadeh
897e3d8c28 pre-commit: autoupdate hooks (#1736)
Update pre-commit hook versions

Co-authored-by: adeebshihadeh <adeebshihadeh@users.noreply.github.com>
2023-11-21 13:08:12 -08:00
Shane Smiskol
42a62936fb Honda: fix alt brake address check race condition (#1723)
* common honda addr checks

* oohhhh

* rename RxCheck from merge

* more rename

* checked data and found 0x1A6 does not exist on any Bosch, so combining with 0x296 is safe

* formatting

* need this since refactor

* clean up

* fixup

* misra

* coverage caught another bug!

* another duplicate addr from multi tests

* proper base class

* formatting

* misra

* flat

* Revert "flat"

This reverts commit d5ea2adf26.
2023-11-20 19:27:18 -08:00
Shane Smiskol
c345bc3cae Rename forgotten functions (#1731)
fix forgotten functions
2023-11-20 11:37:51 -08:00
Adeeb Shihadeh
933a301cad safety: do TX whitelist check in top level hook (#1730)
* new fields

* add check

* do first one

* first two

* all done

* fix all output

* simpler

* unused now

* fix body and elm

* fix that

* fix misra

* revert that
2023-11-20 00:15:46 -08:00
Adeeb Shihadeh
b1ca493580 safety: fix ambiguous names (#1729)
renames
2023-11-19 22:44:13 -08:00
Adeeb Shihadeh
606d7580c8 safety: cleanup init return struct (#1728)
* try 1

* do the rest

* fix misra
2023-11-19 21:05:53 -08:00
Adeeb Shihadeh
3d2f99dd40 safety: move RX addr check into top level hook (#1727)
* safety: move RX addr check into top level hook

* tesla

* rest

* can't forget about the body

* rm more

* fix that

* cleanup

* drop the fn
2023-11-19 20:03:35 -08:00
Adeeb Shihadeh
c6248d6504 safety: cleanup ints that are bools (#1726)
* safety: cleanup ints that are bools

* update tests
2023-11-19 16:47:09 -08:00
Shane Smiskol
9fed95003e Ford: fix possible standstill mismatch (#1725)
fix ford standstill mismatch
2023-11-18 00:04:34 -08:00
Shane Smiskol
3b165ed21b Hyundai: fix brake pressed bitmask (#1724)
* fix

* test this
2023-11-17 19:58:53 -08:00
Shane Smiskol
7c84475410 safety: use address check helper (#1721)
use SET_ADDR_CHECKS
2023-11-16 22:36:05 -08:00
Adeeb Shihadeh
37f53acece pre-commit: autoupdate hooks (#1720)
Update pre-commit hook versions

Co-authored-by: adeebshihadeh <adeebshihadeh@users.noreply.github.com>
2023-11-14 15:03:06 -08:00
Shane Smiskol
5fe1d67b77 safety: test coverage (#1699)
* run in CI

* test

* make report optional

* 100% GM coverage

comments

* more coverage: these are unhittable lines

* vw mqb: convert switch to if, consistent with all other safety modes

* we don't check any of these yet

* rm

* ensure honda_fwd_brake is reset

* can rm this

* test honda brake latching

* honda: add rx brake function

* use loops for more coverage and more compact code

* other honda stuff

* remove car-specific stuff from init_tests

* don't need to have car safety modes reset interceptor detected (global init does)

* use get_bit

* ahh ford counter is unhittable: counter check disabled due to skipping

* misra

* test nooutput and alloutput

* required changes for that

* fix test

* more all/nooutput coverage

* start on lin

* rx coverage

* lin tx coverage

* some barebones body test

* double negative

* draft elm327 safety (git stash)

* fixes from merge

* clean up test cov

* add rm

* no body

* failed grep returns exit code 1

* more clear msgs
2023-11-10 19:37:41 -08:00
Shane Smiskol
57e280ad29 safety: add body safety tests (#1716)
* partial body safety tests

* cmt

* test this flasher msg

* move

* address check on can flashing msg

* no other test tests this, valid when we rx one

* this is more reflective on the current behavior

* better test

* clean up

* stash

* clean up

* revert

* Update board/safety/safety_body.h

* fix misra
2023-11-10 19:02:32 -08:00
Shane Smiskol
4383ac35f5 safety: add ELM327 safety test (#1715)
* elm safety test

* comment
2023-11-10 03:03:35 -08:00
Shane Smiskol
55946a060d safety tests: more coverage (#1714)
* more coverage

* we don't check the counter of this ford message

* there are no messages with these lengths to check
2023-11-10 01:53:41 -08:00
Shane Smiskol
5e22e87cf6 Hyundai CAN: update driver braking signal (#1713)
* use DriverOverride

* Update board/safety/safety_hyundai.h
2023-11-10 01:03:33 -08:00
Adeeb Shihadeh
a1d699b87d SOM boot recovery (#1712)
* reset

* simpler

* only once per panda boot

* cleanup

* also check serial
2023-11-09 18:01:46 -08:00