Commit Graph

1483 Commits

Author SHA1 Message Date
Adeeb Shihadeh f37f8d90ba
cleanup build, prep for jungle (#1549)
* cleanup build, prep for jungle

* cleanup

* update pedal obj path
2023-08-03 19:07:41 -07:00
Shane Smiskol 3e429ac0f8
Honda: remove duplicated relay transition time check (#1544)
already checked
2023-08-02 21:09:09 -07:00
Justin Newberry 1154eb2d75
Subaru: cleanup panda logic (#1543)
cleanup subaru
2023-08-02 15:13:01 -07:00
Robbe Derks feef2e6c71
Harness tick at 8Hz (#1541)
harness tick at 8Hz

Co-authored-by: Comma Device <device@comma.ai>
2023-08-01 21:31:15 -07:00
Robbe Derks b4700a876f
Stable ADC on H7 (#1540)
* 256x oversampling

* reduce to 128x

* fix misra

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-08-01 20:48:10 -07:00
Robbe Derks a945053ade
Force relay drive (#1539)
force drive

Co-authored-by: Comma Device <device@comma.ai>
2023-08-01 16:33:34 -07:00
Adeeb Shihadeh 7f1944cf43
debug endpoint for custom clock source period (#1538)
* debug endpoint for custom clock source period

* cleanup

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-08-01 16:17:42 -07:00
Adeeb Shihadeh ed8ff7e48a
H7: explicitly disable GMLAN for now (#1532) 2023-07-24 15:01:19 -07:00
Adeeb Shihadeh 8258d18e87 spi: bump version 2023-07-20 11:15:01 -07:00
Justin Newberry 72032e2850
Subaru: use generator for limits (#1527)
* generator

* remove torque reference

* fix misra

* misra
2023-07-19 23:32:31 -07:00
Adeeb Shihadeh b2741013f6
instructions for flashing internal panda (#1521)
* instructions for flashing internal panda

* Update board/README.md
2023-07-17 20:17:18 -07:00
Adeeb Shihadeh e8da4eab2e SPI: increase buffer size on H7 2023-07-16 12:56:05 -07:00
Cameron Clough 0c33554624
Ford CAN FD safety (#1455) 2023-07-16 15:09:37 +01:00
Cameron Clough 6e5009125a
Ford: namespaced constants (#1516) 2023-07-16 12:13:09 +01:00
Igor Biletskyy a9a3227008
can_health: remove enter and exit critical calls from health updater (#1513)
init
2023-07-14 19:36:04 -07:00
Igor Biletskyy ad9ec716ac
H7: CAN core reset on no ACK and high transmit error counter (#1502)
* init

* comment
2023-07-14 19:00:43 -07:00
Justin Newberry 6d2b70a147
Subaru: Use macros for gen1/gen2 (#1505)
* macro

* revert these for first PR
2023-07-13 19:01:45 -07:00
Adeeb Shihadeh 6b9b448259
log device boot time (#1503)
* log device boot time

* misra

* only log real boots

* set gpio

* true

* initial

* log bootkick

* fix RPv2

---------

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Igor Biletksyy <bs@privacy.im>
2023-07-12 20:34:46 -07:00
Justin Newberry 8ba5683881
Subaru: improve readability in panda code (#1380)
* improve readability

* cleanup for PR

* switch to #define

* i guess i forgot how #define works

* fix #define

* improve for preglobal too

* rename because of conflicts

* rename with subaru in name

* missed some

* missed that one too

* made it pretty

* whitespace

* infotainment match opendbc

* whitespace

* whitespace

* parameterize the bus too

* fix that

* fix misra violation

* multiline

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-07-07 01:48:30 -07:00
Shane Smiskol c1e79333fb
angle safety: make angle conversion factor a float (#1498)
* make this a float

* no need to cast to float now
2023-07-06 17:06:31 -07:00
Shane Smiskol c97f572208
safety_toyota: use GET_BIT (#1496)
* use GET_BIT

* same for gas pressed

* brake pressed too

* fix

* another fix
2023-07-06 15:31:40 -07:00
Adeeb Shihadeh a687b183ee
SPI: update max IRQ rate (#1493) 2023-07-03 22:06:35 -07:00
Adeeb Shihadeh 14fd5ff5a3
SPI: send bootstub status in version request (#1492)
* mv first

* switch to crc8

* bootstub

* test

* cleanup

* little more

* misra

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-07-03 15:23:12 -07:00
Adeeb Shihadeh d693e89df2
SPI: send hw type with version (#1490)
Co-authored-by: Comma Device <device@comma.ai>
2023-07-02 23:50:30 -07:00
Adeeb Shihadeh abcbfb44b4
SPI: send serial with protocol version (#1489)
* SPI: send serial with protocol version

* misra

* fix test

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-07-02 23:13:57 -07:00
Adeeb Shihadeh 5abb2b58da
SPI: add protcol version request (#1488)
* SPI: add protcol version request

* quick test

* fix linter

* misra

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-07-02 15:51:35 -07:00
Adeeb Shihadeh 1f50a84b86
update old comment (#1282) 2023-07-01 18:57:53 -07:00
Robbe Derks 694aae9c26
Faster log retrieval (#1484)
improve get_logs
2023-06-30 17:26:39 +02:00
Igor Biletskyy a35e9a1edb
CAN health: add IRQ call and core reset counters (#1453)
* initial

* old method

* comment
2023-06-28 14:40:00 -07:00
Igor Biletksyy 8a8bcb865e H7: clear irqs on reset 2023-06-28 12:39:47 -07:00
Igor Biletskyy 73798d7dce
Disable CAN irqs when transceivers are disabled in power save mode (#1485)
init test

MISRA 15.7
2023-06-28 12:33:17 -07:00
Igor Biletksyy 3a06eeec3c bxCAN: check overrun flag on error irq 2023-06-27 16:03:43 -07:00
Justin Newberry b2cf197679
Subaru: Signals Cleanup (#1470)
cleanup
2023-06-23 21:00:59 +01:00
Igor Biletskyy 5889e3784f
H7: fix FDCAN_IR register check (#1480)
* init

* typo

* misra

* leftover
2023-06-21 18:56:10 -07:00
Igor Biletskyy 9d56e80390
Change can_health request method (#1472)
* init

* fix typo

* remove tx lost as fake and add rx lsot
2023-06-20 12:29:20 -07:00
Igor Biletskyy 0f4e8f79f5
add IRQ rate helper function (#1471)
init
2023-06-20 11:47:43 -07:00
Adeeb Shihadeh 58b80f3b77
H7: adjust SPI IRQ call rate (#1469)
* H7: adjust SPI IRQ call rate

* u

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-06-19 20:44:02 -07:00
Adeeb Shihadeh fdd898bd08
H7: split SPI/DMA faults (#1466) 2023-06-16 21:54:28 -07:00
Cameron Clough 55ef91d9ab
Ford: don't check vehicle roll quality flag (#1461) 2023-06-17 01:11:21 +01:00
Robbe Derks 054344de6b
Flash bounds checking outside of bootstub (#1459)
* add bounds checking on flash operations outside of bootstub

* fix test
2023-06-14 15:28:49 +02:00
Robbe Derks 116485443d
UART overwrite mode (#1457)
* overwrite mode

* typo
2023-06-14 13:33:47 +02:00
Igor Biletskyy 3a7a0e0bae
H7: fix lockup on disconnected bus (#1431)
* fix h7 lockup

* love MISRA!

* EW and EP isn't actual errors

* cleaner

* typo

* oops

* increase error limit before reset
2023-06-13 14:34:15 -07:00
Robbe Derks 0cc91a7f7b
Logging (#1445)
* try 1

* some fixes

* fix some misra

* first poc working

* more things

* more misra fixes

* fix misra

* add rate limiting

* fix misra

* add some unit tests through libpanda

* add more tests and fix some stuff

* fix misra again

* add startup log hitl test

* list

* don't fail on wrong timestamps

* improvements

* fix tests

* expected logs test?

* not sure why this passed

* oh, it doesn't reset

* only show last few

* guess at expected logs

* needs this

* ugh

* reduce compiler warnings

* adjust expected logs

* this is correct

* is it really 1?

* min max

* reduce spam in SPI test

* some cleanup
2023-06-13 17:00:56 +02:00
Adeeb Shihadeh 237f5bd6e4
fix debug console spam during IRQ call rate fault (#1448)
* fix debug console spam during IRQ call rate fault

* flip

* fix build
2023-06-08 11:31:50 -07:00
Adeeb Shihadeh bf2c007103
H7: fix CAN RX delay (#1446) 2023-06-06 18:48:19 -07:00
Adeeb Shihadeh 17ca4171df
H7 SPI: disable IRQs only when necessary (#1437)
less irq disable

Co-authored-by: Comma Device <device@comma.ai>
2023-06-03 15:53:16 -07:00
Robbe Derks 5847d7dbc0
Tesla safety: fix wrong message rate (#1277)
* half the freq, double the rate

* fix test

* fix names
2023-06-01 23:10:36 +02:00
Adeeb Shihadeh c898ec7ce8
refresh can tx slots available after write (#1432)
Co-authored-by: Comma Device <device@comma.ai>
2023-05-20 22:00:13 -07:00
Adeeb Shihadeh 52f96bac68
spi: nack on can tx endpoint if buffer is full (#1426)
* spi: nack on can tx endpoint if buffer is full

* handle in python lib

* fix timeout

* fix timeout

* fix linter

* cleanup

* fix

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-05-19 22:43:34 -07:00
Shane Smiskol 2a53833753
Ford safety: prevent disable AEB (#1428)
* Ford AEB safety

* whoops

* working tests

* debugging

* clean up

* stock aeb test

* split up test

* rm

* cmt

* rm

* just test stateless sigs for simple branch

* clean up

* rm

* just test this bit

* it's signed now

* cmt

* cmt

* clean up

* ohh
2023-05-18 14:14:26 -07:00
Igor Biletskyy 622106d7d4
Revert "H7: fix lockup on disconnected bus" (#1430)
Revert "H7: fix lockup on disconnected bus (#1410)"

This reverts commit 03435947bb.
2023-05-18 13:54:30 -07:00
Shane Smiskol 14bd994f83
Ford: add longitudinal safety (#1359)
* add ACCDATA msg

* ford long safety

* long flag

* split stock and op long tests

* use accel limits for brake

* add comment

* fix acceleration limits

fix acceleration limits

* fix gas limits

* temp bug

* fix min gas, allow -0.5 (engine braking?)

* fix test

* fix tests

* yay it caught this

* pylint

* base name

* typing

* Revert "typing"

This reverts commit 7fb5e304cb.

* temp fix

* rm line

* this is handled by PandaSafetyTest

* revert

* move

---------

Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
2023-05-18 00:21:29 -07:00
Adeeb Shihadeh 2ed514807e
H7: restart SPI peripheral between transfers (#1424)
* H7: restart SPI peripheral between transfers

* fix misra

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-05-17 20:59:37 -07:00
Adeeb Shihadeh a93bc954c5
SPI HITL tests + cleanup (#1417)
* start comms hitl tests

* pull that out

* revert that

* more test

* fix warnings

* fix linter

* another simple case

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-05-17 17:13:12 -07:00
Shane Smiskol 3c9d277276
safety: always allow inactive gas command (#1418)
* always allow inactive gas

* rewrite this

* revert

* no functional change but test it correctly

* also here
2023-05-17 15:52:50 -07:00
Justin Newberry 0a738b7ee8
Subaru: rename legacy to preglobal (#1415)
* rename

* missing some variables

* fix find/replace error
2023-05-15 17:22:40 -07:00
Adeeb Shihadeh f95f4a5294
stricter simple watchdog (#1413) 2023-05-15 14:15:48 -07:00
Igor Biletskyy 03435947bb
H7: fix lockup on disconnected bus (#1410)
* fix h7 lockup

* love MISRA!

* EW and EP isn't actual errors
2023-05-12 19:20:42 -07:00
Robbe Derks 1e131f2b17
RX/TX lost reversal for bxcan (#1408)
this should be reversed
2023-05-11 17:21:34 +02:00
Adeeb Shihadeh 98a15f2a90
harness: fix register divergent on GEN1 (#1405)
* harness: fix register divergent on GEN1

* has harness

* revert that

---------

Co-authored-by: Bruce Wayne <batman@comma.ai>
2023-05-08 15:02:18 -07:00
Adeeb Shihadeh 2eef7f3fff reset heartbeat_engaged once heartbeat is lost 2023-05-08 10:15:31 -07:00
Robbe Derks 2c937656cf
Continuous harness detection (#1402)
* read in mV and make threshold board-dependent

* refactor and add SBU voltages to health

* refactor relay driving

* more refactoring and readout lock

* avoid race condition

* fix misra

* continuous detection

* 1Hz is fine

* another race condition

* use harness detection to trigger bootkick

* update orientation detection test

* more in-depth harness tests

* fix ignition

* fix

* raise threshold
2023-05-08 13:30:23 +02:00
Shane Smiskol 35609dfdce
safety utils: add ROUND helper (#1397)
* add round macro

* Update board/utils.h

* function

* one line

* misra

* use here too
2023-05-06 21:25:25 -07:00
Adeeb Shihadeh e7f2e72c3d
setup independent watchdog (#1404)
* setup independent watchdog

* builds

* same file

* configurable timeout

* disable for now

* no feed

* rm

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-05-05 16:46:38 -07:00
Robbe Derks fea1feb598
ADC cleanup (#1401)
* cleanup function names

* cleanup voltage reading

* define constant

* fix misra

* remove comments
2023-05-04 13:22:01 +02:00
Shane Smiskol cedb5fd1a6
Ford: remove safety mode from debug flag (#1400)
remove from debug
2023-05-04 06:08:10 +00:00
Shane Smiskol 94cd9a0788
Ford: curvature rate limits (#1258)
* ford curvature rate limits draft

* make common angle tests work with curvature

* comment

* no need for this

* extra line

* fix test

* generic curvature test class

* more reasonable limits

* adjust limits

* draft

* works

* works

* clean up

* add vehicle speed

* works

* clean up

* clean up

* more clean up

* more clean up

* lower

* double

* add updated bp

* remove

* can clean that up

* draft

* this works!

* think that's the correct placement

* try this

* closer

* use min

* add/sub one to not falsely trip

* remove old angle error safety

* i'm not sure if clamp is more readable

* fix that

* fix

* stash

* fix these tests

* ternary

* floats are a pain

* draft, works kinda

* even better

* round that

* need tolerance

* this should work (adding tol=1 wouldn't let us have multiple rate limits)

* test works

* clamp breaks if low is higher than high :(((

down from 150 blocked msgs to 7!

* no blocked msgs!!!

* test a whole bunch

* stash

* stash

* clean up test

* clean up test to be more like torque (+ speeds)

* clean up

* cmt

* test up

* up and down are good

* rename and remove

* this is tested

* uncomment

* this is tested by ensuring we move towards error at a minimum rate

* not used any more

* revert common

* clean up test_ford a bit more

* some clean up (combine variables where it makes sense)

* yeah can't use clamp since min isn't always < max, min(max(.. handles this

* clean up

* revert that

* comments

* cmt

* another

* that's old

* misra!

* Update board/safety/safety_ford.h

* Update board/safety/safety_ford.h

* add todo, fix test case

* more clear, matches panda

* add comment

* Update tests/safety/test_ford.py

* more fine speed increments

* rm comment

* better names

* this is expected behavior (tested by common checks)

* CURVATURE_ERROR_LIMIT_SPEED

* better name?

* pretty clean!

* same for up

* only used in one place now

* these are now clear

* common term

* make vehicle_speed a sample_t

* need to use values[0]

* speed is a float

* Revert "speed is a float"

This reverts commit 01af02f1d3.

* Revert "need to use values[0]"

This reverts commit 8f6d68345a.

* Revert "make vehicle_speed a sample_t"

This reverts commit ecd8dc86b6.

* safety fixes for new speed sample

* test fixes for new speed sample

* fix misra and make intermediate variable

* this isn't needed
2023-05-04 04:59:35 +00:00
Shane Smiskol 3a64b6ccb5
safety: make vehicle_speed a sample (#1391)
* convert vehicle_speed into sample_t, change no behavior

* draft

* round

* test

* clean up

* round

* round all

* use min

* remove round macro from this PR

* reset speed measurement

* debug

* bbd

* rm

* revert

* test above and below

* need this now

* misra pt 1

* misra pt 2

* misra pt 3

* i don't understand this one, not different from other cases

* fix test

* test

* revert that

* draft

* test the sample_t works properly for safety modes that use it (angle only)

* can combine these tests

* test decimals

* global

* misra

comment

* suggestions

* fix

* use new helper
2023-05-04 03:37:56 +00:00
Shane Smiskol aa30b15de5
Ford safety: more clear variable names (#1392)
* that's a better name

* that too
2023-05-03 03:45:33 +00:00
Shane Smiskol 69ad3dd8e8
angle safety: add comment about rate limits at 0 (#1389)
* up when 0

* Revert "up when 0"

This reverts commit fc9b459651.

* add comment

* whoops
2023-05-03 00:07:23 +00:00
Robbe Derks 641d9c4f3a
Tesla: DAS_control is on bus 2 (#1374)
these are on bus 2
2023-05-02 00:55:00 -07:00
Adeeb Shihadeh 8e1ca608b0
H7: remove busy wait on TXC (#1381)
* works

* cleanup

* less irq

* less diff

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-05-01 20:18:23 -07:00
Shane Smiskol dbe941004a
safety: reset torque_meas on init properly (#1250)
* reset min torque meas too

* add test that fails

* cmt

* cmt

* clean up test

* don't be random

* above test tests this pretty much

* test angle too

* fix

* also test driver torque

* whoops

* whoops
2023-04-28 17:45:02 -07:00
Shane Smiskol 001f9917ef
ford: disable counter check for second speed (#1375)
add comment and disable counter for second speed
2023-04-28 14:25:35 -07:00
Shane Smiskol 4160d8d71c
safety: common angle safety function (#1369)
* draft clean up

* always check

* add angle to name

* ford sends curvature when not steering and bit is 0.

it's not torque, curvature of 0 will still apply torque

* need this to be generic

* formatting

* rm

* test that we can send curvature=0 if enabled=False while control_allowed=True (let's say EPS faults, OP doesn't want to actuate)

* revert ford tests to master

* this <i>should</i> preserve behavior

* this is fine to remove

* and this should also be covered

* yeet

* change opt name, combine checks, much better!

* one more

* modes

* Add comment

* misra has a bug :(

* ugh

* make this clear

* ?

* order

* fix

* comments
2023-04-27 23:33:54 -07:00
Shane Smiskol 69a0b6ed34
safety: use max_limit_check helper in angle safety (#1373)
* better

* ?

* ?

* Revert "?"

This reverts commit ae70c7ff3b.

* Revert "?"

This reverts commit db7fd644a9.
2023-04-27 23:19:26 -07:00
Shane Smiskol aac46a2ef2
angle safety: enforce disabled angle when not steering (#1372)
* enforce disabled angle when bit not set, below we enforce bit to be 0 when not controls allowed

* test

* other test

* combine tests

* comment
2023-04-27 21:41:38 -07:00
Shane Smiskol 240370cdd1
ford: allow 0 curvature when controls are allowed if not steering (#1370)
* test that we can send curvature=0 if enabled=False while control_allowed=True (let's say EPS faults, OP doesn't want to actuate)

* draft

* only check error if apply bit is 1

* subtest

* no subtest

* fix safety and tests

* tests say this works

* clean up

* subtests are sloww

* Revert "subtests are sloww"

This reverts commit 560c6745c8.

* fix test from merge

* add comment

* add comment

* add another comment

* spacing
2023-04-27 17:44:32 -07:00
Shane Smiskol c9c3cb38f6
Ford safety: curvature error limit (#1353)
* set ford vehicle speed

* parse yaw rate signals

* misra

* misra

* misra

* misra

* draft

* update module

* already checked

* and set it properly

* some stuff

* draft

* clean up (will fail tests because we don't send yaw rate yet)

* could do something like this

* this is better and less prone to bugs

* match simple op limiting, debugging

* set checksum for messages in tests

* clean up

* fix that

* one m/s fudge

* fix sign of yaw rate

* interpolate detects size

* forgot OP flips the curvature sign. it matches yaw on can

* all my debugging crap

* make replay work for ford

* fix panda blocking messages (array is fixed size so size-1 is 0 rate at high speed)

* uncomment safety test limits

* revert

* round for zero blocked msgs

* fix limits

* meas safety checks that down rate is >=, not <

* test pass

* lots of comments and draft what one meas torque check would look like

* fix that

* add curvature meas

* add debugging stuff

* Revert "add debugging stuff"

This reverts commit 449783fc62.

* messy but at least one test passes now

* draft

* add max_steer

* some safety clean up

* and that

* start with a test that works

* another test that works (sort of, we need more strict panda safety without false positives)

* no max curvature check (not safety related), allow any rate limits

* add new function

* also need to consider max val here, since OP will send up to that

* and now use the function

* lower to 10

* compilation fixes

* clean up (no rate limiting)

* remove that too

* curvature diff test

* more clean up

* debug

* ?

* better names

* more official

* use _curvature_meas_msg_array here

* bit faster

* no i don't

* revert that

* why not just use angle_meas?

* bb ll

* bb deb

* clean up debug vals

* more

* revert replay drive debugging changes

* Update board/safety.h

* rm line

* only need to round the final thing

* not needed, under 10 ms

* make a class variable

* fix a misra?

* another misra?

better

* ?

* 12.1

* need to explicitly convert

* add one to not false trigger the violation (float rounding)

* not really needed

* rm line

* cmt

* use clamp

* rename

* in struct

* comment

* use max_limit_check

* draft clean up

* Revert "draft clean up"

This reverts commit d1a0e8acd1.

* make a global

make a global

* this is fine
2023-04-27 00:40:29 -07:00
Shane Smiskol 4269b74a84
safety: use max_limit_check (#1368)
use max_limit_check
2023-04-26 23:55:04 -07:00
Adeeb Shihadeh 7aef934d4c
Fix undefined behavior in GET_BYTES macro (#1367) 2023-04-26 22:59:58 -07:00
Shane Smiskol f444f1554f
Ford: check second speed for mismatches (#1358)
* Add second speed

* 2.5 m/s is 9 kph, 4 kph is the max in the field

* add quality signal

* qf signal name

* comment

* checksum matches except it goes to zero when turning the car off despite counter still active

* update comments

* now test it

* spacing

* Update board/safety/safety_ford.h

* zzzz

* not needed

* whoops

* test vehicle state mismatch

* add to safety_helpers

* probably misra

* we might want to check it in both speed signals in case one doesn't exist on a car

* Revert "we might want to check it in both speed signals in case one doesn't exist on a car"

This reverts commit 3338931409.

* fix formatting

* 2 m/s (7 kph)

* set controls_allowed directly like other safety models

remove vehicle_state_mismatch

* obv
2023-04-26 22:37:36 -07:00
Shane Smiskol 5c21b14049
Ford: check 2nd speed message (#1365)
* Add second speed

* 2.5 m/s is 9 kph, 4 kph is the max in the field

* add quality signal

* qf signal name

* comment

* checksum matches except it goes to zero when turning the car off despite counter still active

* update comments

* now test it

* spacing

* Update board/safety/safety_ford.h

* zzzz

* not needed

* whoops

* test vehicle state mismatch

* add to safety_helpers

* probably misra

* we might want to check it in both speed signals in case one doesn't exist on a car

* Revert "we might want to check it in both speed signals in case one doesn't exist on a car"

This reverts commit 3338931409.

* fix formatting

* 2 m/s (7 kph)

* revert mismatch stuff
2023-04-26 21:49:39 -07:00
Shane Smiskol 048ddeea4a
safety: make addr index getter more explicit (#1361)
make this explicit
2023-04-26 21:15:55 -07:00
Shane Smiskol f3d6d613c0
safety: don't check out of bounds array item (#1360)
* safety: don't check out of bounds array item

* better name

* cleanup

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2023-04-26 19:43:30 -07:00
Adeeb Shihadeh b342c2d724
fan: add stall threshold backoff (#1357)
* fan: add stall threshold backoff

* Update board/config.h

* cleanup

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-04-21 15:41:26 -07:00
Adeeb Shihadeh 272b81e97b
fan: fix stall detection (#1351)
* cleanup and fix

* dos must stall

* clean those up

* fix misra

* more test

* fix import

* cleanup

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-04-20 15:44:12 -07:00
Adeeb Shihadeh 6093301bc9
add CLAMP macro (#1356)
* add CLAMP macro

* fix
2023-04-20 14:34:11 -07:00
Adeeb Shihadeh 3c75a8bc00
add fan stall count to health (#1355)
* add fan stall count to health

* fix misra

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-04-20 13:30:56 -07:00
Adeeb Shihadeh 0e2eb9c0f5
fan debugging script (#1354)
* fan debugging script

* merge those

* disable

* better print

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-04-20 13:00:40 -07:00
Adeeb Shihadeh e6cad01955
H7: fix CAN FD IRQ rate (#1332) 2023-04-19 17:34:31 -07:00
Robbe Derks 237ffedcb3
Dos fan fix (#1335)
* hitl fan test

* enable cooldown on dos as well

* small cleanup

* get expected RPM from panda class

* fix

* overshoot test

* fix max RPM getting

* fix percentage

* revert cooldown fix

* add cooldown for dos fan as well

* remove feedforward from the fan controller to eliminate overshoot

* update clip

* cleanup

* add that back

---------

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2023-04-18 14:15:06 -07:00
Justin Newberry 1f8b03666d
Subaru: add ability to send infotainment status message (#1333)
* added infotainment status to panda

* dont fwd infotainment status

* revert placeholder and add test case

* Fix test case

* gen2 only

* fix test case

* Revert "fix test case"

This reverts commit 8cc7579620.

* Revert "gen2 only"

This reverts commit 6a511a9976.

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-04-17 18:47:51 -07:00
Adeeb Shihadeh 2f79621893
improve flash and recover scripts (#1349)
* improve flash and recover scripts

* update references

* cleanup

* less spaces

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-04-16 15:08:46 -07:00
Jason Young 6ec078db5a
VW MQB: Cleanup HCA control message (#1310)
* VW MQB: Cleanup HCA control message

* update opendbc ref

* revert this before merging

* MISRA

* revert Dockerfile to comma master

* reverted a little too much
2023-04-15 11:34:42 -07:00
Shane Smiskol ada8b49cb5
Honda Bosch Radarless: allow alt brake (#1341)
* radarless can use this

* fix addr check

* update opendbc ref
2023-04-14 01:51:19 -07:00
Igor Biletskyy 0117ff9d13
H7: Rx FIFO lost counter (#1345)
* fifo rx lost counter

* add comment
2023-04-13 17:37:48 -07:00
Jason Young fddca54fd6
VW: Allow inactive accel values at all times (#1247)
* allow inactive accel values at all times

* cleaner

* unnecessary, done by default

* better comments

* move test to common class

* fix

* flip

* comment

* append 0 and INACTIVE_ACCEL to test accels + check acc_07 sends if inactive only

* cleanup

* fix that

* copy testing convention of VW and Honda

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-04-13 17:28:33 -07:00
Igor Biletskyy 0832d65347
Fix CAN message corruption on H7 under high load (#1342)
* fix RX FIFO corruption

* Add checksum to CANFD test data

* cleaner and MISRA

* nah

* oops

* fix test
2023-04-12 11:07:58 -07:00
Adeeb Shihadeh 85cc70d4aa
safety: only pass addr to fwd hook (#1339) 2023-04-08 16:45:59 -07:00
Adeeb Shihadeh 2a567674dc
Tesla: move reading AEB state to RX hook (#1340) 2023-04-08 16:20:38 -07:00
Adeeb Shihadeh 6f852b44a9
SPI: log checksum errors in health (#1334)
* SPI: log checksum errors in health

* actually send it

* check in hitl teardown

* check that

* fix misra
2023-04-05 22:05:14 -07:00
Adeeb Shihadeh e516a5752b
watchdog to log fault on heartbeat loop (#1328)
Co-authored-by: Comma Device <device@comma.ai>
2023-04-04 18:51:35 -07:00
Adeeb Shihadeh 0400ac28af
fake siren: fix false positive fault (#1327) 2023-04-03 20:48:26 -07:00
Robbe Derks 79708f912d
USB enumeration based on frame numbers (#1324)
* use frame numbers to detect host connection

* fix weird formatting

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-04-03 17:13:02 +02:00
Adeeb Shihadeh b6c378ad02
CI: set PYTHONWARNINGS=error (#1323)
* CI: set PYTHONWARNINGS=error

* update resetter

* fix build warnings

* bump jungle

* fix one more

* fix linter

---------

Co-authored-by: Bruce Wayne <batman@comma.ai>
2023-04-02 09:33:35 -07:00
Adeeb Shihadeh cb35309160 spi tx timeout print 2023-03-31 14:39:30 -07:00
Adeeb Shihadeh 12b9b65985
fake_siren: add fault on codec enable failure (#1308)
* fake_siren: add fault on codec enable failure

* little shorter

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-03-29 15:07:12 -07:00
Vivek Aithal a1e1451d1c
GM: Reduce steer down limit and increase driver allowance (#1281)
reduce steer down limit and increase driver allowance
2023-03-29 10:39:25 -07:00
royjr db6c50cd09
Honda Bosch Radarless longitudinal safety (#1008)
* civic22_long

use long flag

* maybe?

* Update safety_honda.h

* revert the 0x1c8 addition

* init radarless safety check

* correct accel parsing

* add test class (WIP)

* remove current_controls_allowed

* Fix ACC_HUD

* patch

* Add missing safety to test name

* Pass irrelevant test

* move comment

* remove unused comments

* add comment to TestHondaBoschRadarlessSafety

* Fix message overlap

The "exceptions for common msgs across different hondas" fix does not seem to be working. Created another exception for TestHondaBoschRadarless based on the HondaNidec exception above

* Fix base

* remove comment

* remove buttons from LONG TX

* make a base Radarless test class

* can't remove them, since safety doesn't check bosch

* test accel limits

* test accel limits

* we can do the clean up in another pr

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: sshane <shane@smiskol.com>
2023-03-27 23:10:25 -07:00
Igor Biletksyy 01ea26e342 prevent host from setting wrong returned flag 2023-03-27 10:38:04 -07:00
Adeeb Shihadeh c5cd0a0232
Enable siren for multi-panda setups (#1300) 2023-03-21 18:49:58 -07:00
Adeeb Shihadeh d70fa4e120
tres: fix fan spin on startup (#1297)
* tres: fix fan spin on startup

* new init
2023-03-21 11:19:12 -07:00
Shane Smiskol e4cc97d882
Toyota: check SETME_X64 signal for LTA (#1296)
* check SETME_X64

* use itertools.product for better coverage

* fine
2023-03-16 22:56:25 -07:00
Shane Smiskol c83d6894ef
Toyota: base LTA safety (#1295)
* part 1 of clean up

* make it work and pass

* remove lta stuff

* remove commented lta tests

* more

* move test back to where it was

* rm line

* rename that

* fix that

* start to add LTA

* angle test

* fix tests and add base stock longitudinal class

* formatting

* clean that up

* convention

* add ALLOW_DEBUG
2023-03-16 22:32:56 -07:00
Robbe Derks c0aea3273a
Tres: fan cooldown + no stall recovery (#1287)
* add fan cooldown

* refactor to be inside the fan driver

* fix rebase

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-03-16 14:15:43 +01:00
Adeeb Shihadeh 09ad59489e
tres: adjust siren volume (#1290)
Co-authored-by: Comma Device <device@comma.ai>
2023-03-14 21:48:42 -07:00
Igor Biletskyy 75792fb255
Fix different ADC scales (#1288)
* different ADC scales

* add HITL

* we had it, remove
2023-03-14 14:49:39 -07:00
Vincent Wright 0afee2e0ff
Raise max steer limits for Ram DT (#1284)
* Raise max steer limits for Ram DT

* Update test_chrysler.py

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2023-03-13 17:24:02 -07:00
Jason Young 3a5bbc6f20
VW PQ: Corrected message name for ACC_GRA_Anzeige (#1286) 2023-03-13 13:36:41 -07:00
Adeeb Shihadeh 2de7140117
SPI support in bootstub (#1227)
* always build spi

* no dos for now

* spi gpio init

* detect bootstub

* cleanup

* revert that

* move fx stuff

* fix linter

* set erase timeout

* fix types

* cleanup

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-03-07 14:55:15 -08:00
Adeeb Shihadeh 544cf2ba82
bootstub: add hw type endpoint (#1278) 2023-03-06 22:26:56 -08:00
Shane Smiskol f7ba061279
Ford: test quality flags (#1266)
* adeeb

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

* check checksum

* think pylint won't like this

* complete test

* do this

* no need

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2023-03-01 19:17:40 -08:00
Shane Smiskol 8bb62cf226
Ford: check quality flag (#1264)
* quality flag support

* add NULL to other safety modes

* add to safety helpers debug print

* comment

* rename to quality_flag and add comment
2023-02-24 22:54:51 -08:00
Shane Smiskol a5ddde5d20
Ford: check checksums (#1263)
* add signal names

* add checksum for BrakeSysFeatures

* add yaw data

* order

* misra
2023-02-24 19:44:37 -08:00
Shane Smiskol 384211eb13
Ford: check counter for yaw rate (#1262)
add yaw rate
2023-02-24 17:10:42 -08:00
Shane Smiskol f07309f74b
Ford: set vehicle speed and check counter (#1261)
* set vehicle speed and check counter

* organize

* fix

* and test it properly

* fix horrible bug :( test_models now passes!
2023-02-24 16:51:10 -08:00
Robbe Derks 1923b14189
RTC: increase LSE drive strength on H7 (#1252)
* higher LSE drive strength

* split out init per chip type

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-02-24 16:59:58 +01:00
Shane Smiskol ff39bc472d
Angle control safety: match openpilot limits (#1254)
* make limits match OP

* make tesla match too

* fudge speed

* we reason

* needs to be negative
2023-02-22 20:05:33 -08:00
Shane Smiskol a99f85dc8c
Nissan: use averaged left and right wheel speeds (#1255)
* average left and right for a more accurate speed

* fix

* fix (again)
2023-02-22 19:46:07 -08:00
Comma Device d076e9fb75 fix register divergent 2023-02-22 15:49:11 +00:00
Adeeb Shihadeh 9fe24bd368
Revert "GM: update steering limits (#1239)" (#1248)
This reverts commit 0d2ee00921.
2023-02-21 15:34:09 -08:00
Robbe Derks d2c2d5f926
Fix short pulse of relay drive after reset (#1244)
fix order of gpio init

Co-authored-by: Comma Device <device@comma.ai>
2023-02-20 13:47:35 +01:00
Adeeb Shihadeh 0d2ee00921
GM: update steering limits (#1239)
* lower steer down val, increase allowance

* fix test fail

---------

Co-authored-by: nuwandavek <vivekaithal44@gmail.com>
2023-02-14 12:55:26 -08:00
Robbe Derks d6af117c62
Microsecond timer fix (#1236)
* add microsecond timer readout

* add CI test

* fix
2023-02-14 12:16:15 +01:00
Adeeb Shihadeh 14051f9ce3
Chrysler: revert rate limit increase (#1240)
* Revert "Chrysler: add flag for alternate steer limits (#1238)"

This reverts commit d15250cb14.

* Revert "Chrysler: increase torque rate limits (#985)"

This reverts commit ae051c94a3.
2023-02-13 14:13:40 -08:00
Adeeb Shihadeh d15250cb14
Chrysler: add flag for alternate steer limits (#1238) 2023-02-10 22:20:50 -08:00
Robbe Derks 796d771912
Enable control over the fan on C3 while still in the bootloader (#720)
* GPIO control over the fan from ABL

* fixes

* leave this todo

---------

Co-authored-by: Comma Device <device@comma.ai>
2023-02-08 16:01:14 +01:00
Shane Smiskol 7d27eb10fb
GM: adjust steering rate limits for slower message rate (#1235)
* Adjust GM steering limits for 50Hz -> 33Hz change

* fix test
2023-02-07 23:33:51 -08:00
Shane Smiskol 0f964c6db3
Ford: lateral motion control safety (#1228)
* assert the other signals are zeroed

* add to tja function

* fix misra

* test

* should tx

* ?

* rm line

* up here

* Update tests/safety/test_ford.py

* faster

* adjust round
2023-02-02 23:02:03 -08:00
Robbe Derks 33e576214d
Tres: enable IR power irregardless of fan state (#1225)
* enable IR power irregardless of fan

* fix misra

Co-authored-by: Comma Device <device@comma.ai>
2023-01-26 18:06:02 +01:00
Adeeb Shihadeh ae051c94a3
Chrysler: increase torque rate limits (#985) 2023-01-25 18:51:36 -08:00
Robbe Derks 687676be40
Add timeout to spi driver (#1223)
add timeout to spi driver

Co-authored-by: Comma Device <device@comma.ai>
2023-01-24 13:50:51 +01:00
Igor Biletksyy 9b23622e91 RP: pull USB_EN up 2023-01-23 17:23:33 -08:00
Igor Biletskyy 4750449f3c
RP: obsolete USB load switch (#1219) 2023-01-19 17:07:50 -08:00
Adeeb Shihadeh 3743b2de51
chiplet: move OBD_SBU_RELAY2 to PA3 (#1217)
Co-authored-by: Igor Biletksyy <bs@privacy.im>
2023-01-18 16:31:51 -08:00
Adeeb Shihadeh 60cf9e9d22 Revert "chiplet: move OBD_SBU_RELAY2 to PA3"
This reverts commit a0bd6bb21a.
2023-01-18 14:32:25 -08:00
Igor Biletksyy a0bd6bb21a chiplet: move OBD_SBU_RELAY2 to PA3 2023-01-17 16:27:00 -08:00
Adeeb Shihadeh b8693da342
add comms handler to get MCU UID (#1212)
* cleanup first

* get uid

* add to bootstub and test

* fix pedal

* match that

Co-authored-by: Comma Device <device@comma.ai>
2023-01-15 20:13:26 -08:00
Robbe Derks 11d90f9e78
No more magic for the can chunks (#1191)
* no more magic

* bump version

* no need for this

* comment cleanup

* add comms_can_reset tests

* we can't ensure this for compatibility reasons

* add CANPacket_t checksum
2023-01-13 10:59:58 -08:00
Shane Smiskol 0b3b906036
VW: match openpilot standstill check (#1064)
* VW: match openpilot standstill check

* fixes

* check > 0

* fix comments

* misra

* better
2023-01-10 22:00:20 -08:00
Robbe Derks 744b21ef69
Bring back green led mode + fix small python lib bug (#1206)
bring back green led mode

Co-authored-by: Panda Provisioning <panda@comma.ai>
2023-01-10 15:09:51 -08:00
Willem Melching 8b513970c3
fix debug uart buffer size (#1204) 2023-01-09 17:27:46 -08:00
Robbe Derks 3034180753
Reset CAN ign when the specific message is not seen anymore (#1200) 2023-01-09 14:27:18 -08:00
Robbe Derks 6ba9afc33e
H7 clock source (#1194)
it's literally the same everything

Co-authored-by: Comma Device <device@comma.ai>
2022-12-14 16:12:09 +01:00
Robbe Derks 1d732d4747
F4: Cleanup clock src, second try (#1193)
* F4: cleanup clock source

* little more

* void

* restore the timer setup

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2022-12-14 15:30:04 +01:00
Robbe Derks d1d1f8a22d
Fake siren (#1192)
* DAC POC

* change freq

* some cleanup

* wip: cleaning up and trying to use DMA

* no clue why this doesn't work

* this works

* wip multi-master i2c for fake siren

* cleanup and some more i2c stuff

* seems more stable

* retry disabling and cleanup force siren

* fix misra violations

* not needed

* messed up rebase

Co-authored-by: Comma Device <device@comma.ai>
2022-12-14 11:25:54 +01:00
Adeeb Shihadeh 4edd1a6021
Hyundai: alt steering limits (#1186)
* Hyundai: alt steering limits

* parans
2022-12-02 23:34:06 -08:00
Shane Smiskol a6d0765b69
safety: common angle checks (#1182)
* common angle checks

* clean up

* clean up check and add comments

* readable

* ints

* tests draft

* clean up

* comment

* pylint exception

* clean up

* duplicate
2022-12-02 16:45:23 -08:00
Adeeb Shihadeh 616450c525
tres bootkick (#1183)
* tres: bootkick

* replace usb enum

Co-authored-by: Comma Device <device@comma.ai>
2022-12-01 20:04:30 -08:00
Robbe Derks 288e14cde9
Simple CAN chunking (#1011)
* simple chunking

* make pylint happy

* misra happy?

* good practice anyways since we cast to a uint32_t later

* fix bug dropping packets

* minor fixes + prepare for shared lib testing

* working library now

* first queue test

* can send test

* fix running in github actions?

* add big rx test and fix it

* don't complain about empty buffers

* disable for now

* comment

* test runs

* some cleanup

* merge those

* test works

* rm that

* comment

* proper logging

* makes things too slow

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-11-30 23:38:00 -08:00
Adeeb Shihadeh 88b30e1a84
CAN comms test (#1181)
* CAN comms test

* remove those

* cleanup

* little more
2022-11-30 22:12:28 -08:00
Shane Smiskol b238d41979
safety: clean up passing in longitudinal_allowed (#1176)
* clean up

* clean up

* and fix that

* interceptor func

* fix

* draft

* fix that
2022-11-30 22:09:13 -08:00
Jason Wen 9c50939cfb
HKG CAN-FD radar-SCC: fix controls mismatch (#1173)
* Need to check on bus 4 as well

* Fix 0x1a0 check race condition

* Update board/safety/safety_hyundai_canfd.h

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

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-11-30 21:23:55 -08:00
Shane Smiskol a0b1d64e4e
Honda Nidec: max gas safety and common speed cmd checks (#1179)
* limit gas and speed

* gas safety test
2022-11-30 18:56:05 -08:00
Shane Smiskol cb8fc6bd42
safety: common interceptor checks (#1178)
* interceptor checks

* only one line needed for now

* whoops

* misra

* misread as |
2022-11-30 17:22:42 -08:00
Adeeb Shihadeh 27504639f0
cleanup + prep for more tests! (#1172)
* panda for pc!

* little more

* fake panda

* move some more stuff

* increase timeout

* move that

* print helpers

* cleanup

* just move it for now

* revert jenkins changes
2022-11-30 14:15:09 -08:00
Shane Smiskol e8bd1df511
safety: common gas & brake safety checks (#1168)
* do toyota, hyundai, gm

* comments

* honda draft

* Revert "honda draft"

This reverts commit a1f466a5c9.

* do tesla

* vw draft

* finish vw

* fix safety

* clean up

* fix function names

* do honda and fix safety test not checking pos accel for bosch

* clean that up
2022-11-29 23:45:55 -08:00
Adeeb Shihadeh e6f62a62aa
rename puts to avoid conflict with stdio.h (#1174)
* rename puts to avoid conflict with stdio.h

* better name
2022-11-29 22:55:10 -08:00
Shane Smiskol 2baa0ffed5
Safety: common acceleration cmd checks (#1171)
* do toyota, hyundai, gm

* comments

* honda draft

* Revert "honda draft"

This reverts commit a1f466a5c9.

* do tesla

* vw draft

* finish vw

* fix safety

* only accel

* only accel

* some clean up

* fix mqb tests

* rename
2022-11-29 16:46:32 -08:00
Adeeb Shihadeh 80dac4cd94
cleanup CAN definitions (#1170) 2022-11-29 15:56:43 -08:00
Shane Smiskol 8accca13ad
VW: explicitly test for inactive accel (#1167)
* explicitely test for inactive accel

* fix the safety

* and catch the mistake

* revert
2022-11-28 22:37:59 -08:00
Shane Smiskol ba6b3710db
GM: use common steering safety test (#1166)
gm is the last
2022-11-28 22:30:23 -08:00
Jason Young e4c4253964
VW MQB: Redundant brake pressed signals (#1137)
* VW MQB: Redundant brake pressed signals

* bump timer for safety tests in CI

* use nicer f-string syntax

* don't need that
2022-11-22 14:27:52 -08:00
Adeeb Shihadeh c075050d5d Revert "F4: cleanup clock source (#1160)"
This reverts commit f0f67ccf85.
2022-11-21 20:31:01 -08:00
Adeeb Shihadeh 15a945d303
tres: IR LEDs (#1163) 2022-11-17 21:23:35 -08:00
Adeeb Shihadeh ae66bbcaa8
tres fan (#1162)
* fan on

* little cleanup

* move to main
2022-11-17 21:02:37 -08:00
Adeeb Shihadeh 3df9099660
Misc cleanup (#1161)
* unused python stuff

* green led

* docs cleanup

* little more
2022-11-17 11:46:43 -08:00
Robbe Derks 5aa5f855e4
setup UART for SOM debugging (#1151)
* cleanup external debug serial

* wip: bring up uart7

* more wip

* this does something

* this works

* increase fifo size

* fix misra

* cleanup

* fix misra again

* add SOM debug enum

* reduce SOM buffer on F4

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-11-17 17:59:11 +01:00
Adeeb Shihadeh f0f67ccf85
F4: cleanup clock source (#1160)
* F4: cleanup clock source

* little more

* void
2022-11-17 07:49:26 -08:00
hoomoose 5dc5cd8e20
Hyundai: longitudinal support for all CAN-FD EV + Hybrid (#1128)
* Update safety_hyundai_canfd.h

* Update safety_hyundai_canfd.h

* Update safety_hyundai_canfd.h

* cleanup

* add test

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-11-15 14:48:45 -08:00
Adeeb Shihadeh e7131fcee0
H7 SPI comms (#1158)
* getting health packets

* start cleanup

* pull state machine out

* cleanup
2022-11-14 13:52:52 -08:00
Robbe Derks 9db0ae7056
Remove external debug UART support (#1159)
cleanup external debug serial
2022-11-14 11:46:04 +01:00
Adeeb Shihadeh c75c276301
add has_spi board property (#1153)
* always spi for h7

* disable for now
2022-11-13 19:57:20 -08:00
Shane Smiskol c0632cd32b
GM: enable on rising edge of resume (#1157)
* rising edge of resume

* fix test

* comment

* todo fix tests

* fix test

* we want to test the transition from btn prev to btn cur, not unpressed to x to y

* range
2022-11-13 19:10:45 -08:00
Shane Smiskol 0096d0c4fc
GM: handle run-away set speed (#1156)
* Revert "GM: enable on rising edge of resume (#1155)"

This reverts commit 5aa33e1b2f.

* allow set/resume to any other button (except cancel)

* explicit test

* This is a test of both PRs combined

* Revert "This is a test of both PRs combined"

This reverts commit c7fdc3b00c.

* fix test
2022-11-12 01:55:41 -08:00
Shane Smiskol ff48ecc34e Revert "GM: enable on rising edge of resume (#1155)"
This reverts commit 5aa33e1b2f.
2022-11-12 01:47:13 -08:00
Shane Smiskol 5aa33e1b2f
GM: enable on rising edge of resume (#1155)
* rising edge of resume

* fix test

* comment
2022-11-12 00:01:15 -08:00
Igor Biletskyy cc3b7d9470
H7: add comments on buses clocks (#1154)
comment
2022-11-11 15:30:37 -08:00
Shane Smiskol d573111268
Hyundai: fix button enable controls mismatch (#1152)
* fix hyundai long button controls mismatch

* test

* comment
2022-11-11 14:43:35 -08:00
Adeeb Shihadeh 966f7e0539
SPI: fixes + fake bulk transfers (#1150)
* check spi checkusm

* ugh, fix control handler

* fake bulk xfer

* cleanup

* one more

* unused

* fix linter

* some typing

Co-authored-by: Comma Device <device@comma.ai>
2022-11-10 21:34:43 -08:00
Igor Biletskyy a9e0357883
H7: enable USB LDO and fix RGB LED gpios (#1148)
* enable USB LDO

* open drain for RGB LED gpios

* naming

* comment
2022-11-10 19:29:44 -08:00
Igor Biletskyy eae58b378b
F4 CAN: fix SCE IRQ double fire (#1149)
fix
2022-11-10 19:29:22 -08:00
Robbe Derks d574f4aebc
STM32F4: SPI communications (#998)
* 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

* llspi misra fix

* enable SPI on F4 and setup gpio

* duh

* wip: spi comms

* more spi wip

* dynamic sector erasing

* Revert "dynamic sector erasing"

This reverts commit fce1215a2e.

* more sectors to be erased

* debugging

* woah, this works

* cleanup on the panda side

* add sync and checksum checks, and fix recovery on errors

* this seems relatively stable

* add retrying

* this is stabler

* some endianness and endpoint fixes

* builds

* revert that

* add that back

* checksum start

* start splitting up driver

* spi behind flag

* cleanup test

* bump up timeout

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-11-09 18:46:20 -08:00
Shane Smiskol 281eb7731b
GM Camera: use ECM brake pressed bit (#1138)
* GM camera: use ECM brake pressed bit

* back to ECMEngineStatus

* length 8

* common gmcamera class

* move to longitudinal base

* Revert "move to longitudinal base"

This reverts commit 67abe4c86b.

* fix
2022-11-08 20:17:02 -08:00
Jason Wen 1ccdff90c5
HKG CAN-FD: support radar ACC cars (#1134)
* HKG: Car Port for Genesis GV70 2023

* Revert "HKG: Car Port for Genesis GV70 2023"

This reverts commit 01bfda6dff.

* 0x1a0 rx check

* Wrong one oops

* Check 0x1a0 based on param

* no need

* getting a bit messy, clean up soon!

* clean up

* clean up

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-11-07 22:44:13 -08:00
Shane Smiskol ca681ff829
Hyundai: CAMERA_SCC works on both safety modes (#1139)
* Make camera SCC work on both safety modes

* update in safety

* move to common
2022-11-07 22:13:17 -08:00
Jason Wen f3fc343262
Hyundai CAN-FD: support for ICE cars (#1031)
* Hyundai: Car Port for Santa Cruz 2022

New struct and params for CAN-FD ICE models

fixup! New struct and params for CAN-FD ICE models

* Longitudinal Control: ICE CAN-FD models

* fixup! Longitudinal Control: ICE CAN-FD models

* fixup! Longitudinal Control: ICE CAN-FD models

* fixup! Longitudinal Control: ICE CAN-FD models

* fixup! Longitudinal Control: ICE CAN-FD models

* Gate radar disable behind HDA2 only

* Remove unnecessary HDA2 checks

* Fix MISRA violation

* not needed, in HYUNDAI_CANFD_HDA2_LONG_TX_MSGS

* revert longitudinal changes

* fix addr check logic, clean up

* revert more long stuff

* fix addr check

* temp

* tests

* work?

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-11-04 16:43:33 -07:00
Shane Smiskol c8d108e2b8
Hyundai CAN-FD long: fix brake address check (#1132)
* we don't check 0x65 any more

* fix

* that too
2022-11-04 00:54:54 -07:00
Adeeb Shihadeh 49e2034098
tres (#1130)
* tres

* pull out chiplet

* add to python lib
2022-11-03 16:34:18 -07:00
Igor Biletskyy 9147cba1af
F4: more RAM (#1126)
* F4 more ram

* more flash
2022-11-02 16:57:14 -07:00
Igor Biletskyy f7c74e08c6
bugfix: D2 SRAM clocks and CRun CPU state (#1125)
D2 SRAM clocks
2022-11-02 14:28:23 -07:00
Jason Young 0ca6d9d924
VW MQB: Longitudinal safety (#920)
* VW MQB: Longitudinal safety

* disregard ACC_13 for now

* abstraction cleanup

* fix long control flag name

* quick hack

* VW MQB: Cleanup message counter handling

* various cleanup

* try without ACC_04

* follow DBC updates

* bump Docker opendbc ref

* additional main switch and cancel handling/testing

* pacify linter

* style

* handle the overlap tests like HKG CANFD

* update replay route

* commonize elements between MQB and PQ

* Apply suggestions from code review

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

* proper use of globals/conventions

* make these global

* this is better for now

* better comment on accel boundary scaling

* spelling error

* reset on init

* try bumping openpilot

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-11-01 08:13:58 -07:00
Jason Shuler cf4aa6bb30
GM: longitudinal support for camera-integrated cars (#1014)
* 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

* openpilot long safety

* do this in another PR

* add back

* add safety tests

* rename

* struct for safety

* not used

* temporary fault fix

* adjust max gas

* allow PSCMStatus in long mode

* stash

* fix max gas

* fix and clean up tests

* clean up longitudinal tests into a common class

* fix pylint

* subclass

* clean that up

* rm

* blocking

* comment

* comment

* lower case

* brake bus

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-11-01 00:58:18 -07:00
Shane Smiskol 997e328074
Nissan: check two wheel speeds for standstill (#1124)
* safety

* use already parsed wheel speed
2022-10-31 19:40:44 -07:00
Shane Smiskol 187fdee385
safety: remove pre-enable state (#1121)
* current_controls_allowed is now unused

* reduce diff

* remove from honda

* these test nothing

* fix
2022-10-27 17:51:20 -07:00
Adeeb Shihadeh 609a8e087a
fan: reset error integral when disabled (#1119) 2022-10-27 13:58:19 -07:00
Igor Biletskyy bd8d2481dd
H7: free up 29120 bytes of RAM (#1120)
free up some RAM
2022-10-25 21:15:46 -07:00
Shane Smiskol 2db69bc941
Revert "GM: different brake thresholds by platform (#1104)" (#1116)
This reverts commit 5962bcd08a.
2022-10-21 18:11:31 -07:00
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 9ed3f75f67
Fix MISRA violation (#1109) 2022-10-17 20:53:03 -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
Adeeb Shihadeh eabebfe188
Hyundai CAN-FD: ignore LKAS steering on HDA2 long mode (#1101) 2022-10-13 07:52:59 -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
Greg Hogan 2f3e2825e5
CAN-FD non-ISO support (#1082)
CAN FD non-ISO support
2022-10-12 15:28:20 -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 ca11326bd9
GM: abstract PCM-related hw check (#1090)
abstract hw check to if pcm_cruise or not
2022-10-09 12:39:48 -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
Adeeb Shihadeh e987e6c639
add pandaState.safetyRxChecksInvalid field (#1083)
* add fault for invalid safety RX checks

* fix test build

* debug

* fix debug

* fix test

* just a bool in health
2022-10-03 16:05:16 -07:00
Adeeb Shihadeh 4248085d7c
Hyundai: fix addr check race condition (#1084) 2022-10-02 17:48:22 -07:00
Robbe Derks 10c0991666
Add the 0x600 range for UDS messages (#1077)
add the 0x600 range for UDS messages

Co-authored-by: Comma Device <device@comma.ai>
2022-09-23 11:17:15 +02:00
Igor Biletskyy b86199244a
merge health.h and can_health.h (#1075)
init
2022-09-19 16:11:49 -07:00
Igor Biletskyy a19f12559e
check if set CAN speed is valid (#1073)
* check

* MISRA
2022-09-16 23:51:55 -07:00
Igor Biletskyy fd226de0a4
board struct: add has_canfd (#1072)
* add

* gate this

* and this

* forgot white
2022-09-16 21:56:48 -07:00
Igor Biletskyy 59ede3fe61
CAN health packet: add speed and canfd info (#1071)
in
2022-09-16 20:39:18 -07:00
Igor Biletskyy f029c99440
health packet: fix confusing variable names (#1068)
* fix naming

* different buffer overflows

* naming
2022-09-15 13:08:46 -07:00
Igor Biletskyy 0eef8cf333
CAN: health message for each CAN module (#1067)
* initial can health pkt

* MISRA: variable scope

* MISRA 10.4

* typo

* add total_fwd_cnt

* check size of can_health_t

* improve

* comment

* that's better

* move

* add health check to tests

* why?

* ...

* revert later

* meh

* Revert "meh"

This reverts commit 0eb8432194.

* Revert "revert later"

This reverts commit 2d98957a8f.

* adjust test
2022-09-15 13:04:10 -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
Igor Biletskyy 15eda6a7c9
CAN bus: adjust SJW and time quanta to SAE 2284-3 (#1061)
* adjust clocks and tq

* debug console keyboard interrupt

* MISRA
2022-09-12 14:31:22 -07:00
Igor Biletskyy ac21dbe551
H7: add chiplet panda support (RPv2) (#1049)
* temporarily disable Jenkins

* firmware

* python lib

* tests

* ..

* usb load switch to high

* it is still red

* usb power mode remove

* Revert "temporarily disable Jenkins"

This reverts commit a911cfad8d.

* forgot this

* common periph

* change name

* board tick

* add V2 to CI

* update known bootstub
2022-09-09 20:13:06 -07:00
Igor Biletskyy 1b210a8974
H7: remove manual bus off handling (#1062)
remove this
2022-09-09 15:24:19 -07:00