Commit Graph

835 Commits (spacecruft)

Author SHA1 Message Date
Robbe 519e39e494 Changed heartbeat timeout to be 2 seconds on no ignition 2019-07-24 14:36:01 -07:00
rbiasini 59f5813173
Black (#254)
* late usb

* Added type support for black panda

* Added harness presence and orientation detection

* harness relay driving code

* Added intercept support in black panda code. Switched around can0 and can2

* Disable ADCs after orientation detection. Ignition interrupts via harness

* WIP: Hardware abstraction layer + black panda bringup

* Fixed bootstub build

* Fixed bootstub for pedal

* Fixed infinite loops

* Got CAN buses working on white again

* Fixed pedal build and black can interfaces

* Got CAN buses working on black panda

* Finished loopback test for black panda

* Erase all flash sectors on the panda. Increased binary limit. Added extra python functions.

* Fixed python

* Made new code MISRA compliant

* Cleaned up ignition. Fixed build

* Fixed health packet

* Fixed CAN mode on black bug. Changed OBD to switch on ELM mode

* Fixes from Github review

* Fixed MISRA issue for pedal

* Fixed failing gmlan tests

* ELM327 safety: allow diagnostic on all buses

* Cleaned up EON relay code

* delete only 3 sectors instead of 11 to allow a new build to be flashed. Much faster to flash

* Removed CAN only can0 output mode. Does not make sense on black panda due to reversibility issues.

* Added heartbeat logic for EON code on panda. Go to NOOUTPUT if EON does not send a heartbeat for 5 seconds.

* Remove all CAN buses live on EON startup. Shouldn't be necessary to have this separate case

* Formatting

* Added file I forgot to push

* Added heartbeat to testing code to make sure EON tests don't fail. Should probably find a better way to do this though. Heartbeat thread didn't work, concurrent USB connection issues...

* Safety: support black panda for Honda Bosch

* Disable OBD2 if setting to NOOUTPUT mode

* Run safety tests for all hw_types

* Fail test if subtest fails

* fix safety tests
2019-07-23 15:07:06 -07:00
dekerr 45d0d286f4 remove whitespace (#255) 2019-07-19 19:35:50 -07:00
rbiasini e49d0dbbd6
Pedal: use avg between tracks (#253) 2019-07-15 13:15:22 -07:00
rbiasini 01072bec0b
Misra 11.x: pointer usage. (#250)
* RDLR, RDHR gone from safety

* back at not failing misra safety

* fix safety tests

* did not mean this

* Use get-bytes in pedal too

* Ignore Misra 11.5 and Fix 11.8 violaitons

* Fix 11.3 violations

* Neglect Misra 11.4, fix pointer issue in bootstub and rutn on Werror for pedal builds

* Fix Misra 11.6: can't assign number to void pointer

* Fix test after changing honda_moving name

* for loop is better

* Fix bugs from fbck
2019-07-10 20:56:03 -07:00
rbiasini fd68c26aba
Propagate can_push errors (#249)
* Misra 17.7: counting can_push errors
2019-07-10 17:27:26 -07:00
George Hotz fcb1208e15 fix weird code in USB_ReadPacket 2019-07-09 15:08:25 -07:00
Riccardo 0b19206360 Misra 17.7: The value returned by a function having non-void return type shall be used. We should hang on initial failed safety_set_mode 2019-07-08 20:08:53 -07:00
Riccardo f45dd04c67 cppcheck: ignore redundantAssignment and selfAssignment for registers in llcan.h 2019-07-08 17:16:15 -07:00
Riccardo 9ce6311558 Misra 12.1 (operator order) and 10.4 (incompatible essential types) fixes, arised after properly checking UID_BASE config 2019-07-08 15:51:20 -07:00
rbiasini 23e3684d70
Cppcheck unused functions (#247)
* Skip cppcheck on unused functions that are consumed in large headers we can't pass to cppcheck
2019-07-08 15:13:52 -07:00
Riccardo c97d60be64 Removed bad language 2019-07-08 12:05:08 -07:00
Riccardo d9d0a62f2b Misra 5.5: missed this change from previous PR 2019-07-07 22:22:05 -07:00
rbiasini 85fa3c02ae
Misra 5.5: Identifiers shall be distinct from macro names (#246)
* Misra 5.5: Identifiers shall be distinct from macro names
2019-07-07 22:19:02 -07:00
Riccardo 190d604a0b Pedal: 2 minor fixes to Misra 15.7 (else needed) and 17.7 (non-void output must be used) 2019-07-07 22:07:14 -07:00
Riccardo 8ea01ff127 Pedal: no built-in functions to avoid puts and putc re-definitions 2019-07-07 21:38:40 -07:00
rbiasini 1f40d1e6a6
Misra pedal (#245)
* Fix misra on pedal
2019-07-07 16:59:31 -07:00
Riccardo e6dc4172b1 Minor indent error 2019-07-07 15:57:14 -07:00
Riccardo 247e128b45 Fix strict compiler on bootstub build 2019-07-07 15:05:47 -07:00
Riccardo ba68569216 Removed build strict test and enabled -Werror flag 2019-07-07 14:46:03 -07:00
rbiasini f7bd2c2f38
Misra 10.4: fix last 2 violations (#242) 2019-07-04 02:27:21 -07:00
rbiasini 9be5fdead9
finished misra 17.8 (#241) 2019-07-04 01:37:26 -07:00
rbiasini 3c3aba3dbc
Misra 10.4: Both operands of an operator in which the usual arithmetic conversions are performed shall have the same essential type category (#240)
* Almost done with 10.4, a couple of non-obvious violations remaining
2019-07-04 01:04:58 -07:00
Riccardo f2a3a177b3 Misra 15_7: fix what seems to be a false positive of cppcheck 2019-07-03 20:53:00 -07:00
rbiasini 812ace5386
Misra 15_7: if … else if constructs should be terminated with an else clause (#230)
* Fixed all Misra 15_7 violations
2019-07-03 20:48:02 -07:00
rbiasini 1bd9284372
Misra 17.7: the value returned by a function having non-void return shall be used (#237)
* Fixed Misra 17.7 violations except for can_push
2019-07-03 16:01:01 -07:00
George Hotz 18c9e88bc0
Merge pull request #238 from commaai/misra_17_8
Misra 17.8: a function parameter should not be modified
2019-07-03 13:36:49 -07:00
George Hotz 7ac321de4e
Merge pull request #235 from commaai/memxxx
memxxx function changes to be Misra compliant
2019-07-03 13:35:49 -07:00
Riccardo 7cd80de23a typo 2019-07-03 02:07:02 -07:00
Riccardo 385e33b32c 12.1 regression 2019-07-03 02:04:25 -07:00
Riccardo 955842bae6 WIP 2019-07-03 01:59:27 -07:00
rbiasini ea908cbb75
10_1 violations: Operands shall not be of an inappropriate essential type (#233)
* 10_1 violations
2019-07-02 23:43:06 -07:00
rbiasini fa33038055
Fix Misra 5.3: An identifier declared in an inner scope shall not hide an identifier declared in an outer scope (#236)
* Fix Misra 5.3
2019-07-02 22:39:00 -07:00
Riccardo cf6985ad15 memxxx function changes to be Misra compliant 2019-07-02 17:43:54 -07:00
Riccardo ecb9b6c01f Revert "Misra 10 1: Operands shall not be of an inappropriate essential type (#232)"
This reverts commit 8732e4faf0.
2019-06-30 13:43:21 -07:00
rbiasini 8732e4faf0
Misra 10 1: Operands shall not be of an inappropriate essential type (#232)
Fixe Misra 10.1 violations
2019-06-30 15:07:04 -05:00
rbiasini ae816c104a
Fix 15_6 violations (#231) 2019-06-28 13:46:57 -07:00
rbiasini abd841e9be
Fix all 16_4 violations (#229) 2019-06-27 15:50:00 -07:00
Riccardo ec3d0386c2 refactor set_power_save_state 2019-06-26 18:24:21 -07:00
Riccardo c27e7848f3 fix conflicts 2019-06-26 16:17:30 -07:00
rbiasini 4886b6b984
Misra 12.1: The precedence of operators within expressions should be made explicit (#227)
* Fixed all misra 12.1 violations
2019-06-26 16:16:35 -07:00
Riccardo 3fd6b337f9 ops, bug 2019-06-26 15:59:32 -07:00
Riccardo e3c5e7da8c Fix Misra 15_5 violations 2019-06-26 15:52:34 -07:00
Riccardo 52838e1c2a WIP 2019-06-26 14:47:06 -07:00
rbiasini 73ae4f6acf
Misra 14.4: The controlling expression of an if statement and the controlling expression of an iteration‑statement shall have essentially Boolean type (#225)
* Fixed 14.4 Misra violations
2019-06-26 13:13:16 -07:00
Riccardo 8a45958dfe Misra 17.7: puts function should have void output 2019-06-26 13:05:31 -07:00
Riccardo 97a11115bb hardwired input param is now a boolean 2019-06-26 12:18:06 -07:00
George Hotz fd96c02215 disable SPI on the EON variant 2019-06-26 12:01:57 -07:00
George Hotz 0e67890ac7
Merge pull request #224 from commaai/misra_13_3
Fixed Misra 13.3: A full expression containing an increment (++) or d…
2019-06-26 11:51:50 -07:00
Riccardo e41b5a4c4f Fixed Misra 13.3: A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator 2019-06-24 19:23:53 -07:00
Riccardo 541f8beee3 Fix bad bug 2019-06-24 19:16:53 -07:00
Riccardo 6a9ae3b7c3 The comma operator should not be used 2019-06-24 18:12:23 -07:00
Riccardo 5e3458df72 Fix Misra 20.7: Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses 2019-06-24 17:57:18 -07:00
Riccardo d1e6bd86b1 Fix Misra 16.6 and 16.7 by using a different COMPILE_TIME_ASSERT 2019-06-24 17:50:01 -07:00
Riccardo f03c3a9fb6 Fix Misra 8.11: When an array with external linkage is declared, its size should be explicitly specified 2019-06-24 17:10:14 -07:00
Riccardo 83eccb0b5c Fix obvious 10.1 Misra violations: Operands shall not be of an inappropriate essential type 2019-06-24 16:43:11 -07:00
rbiasini e2d781380a
Strict compiler (#222)
have no Wall warnings from the strict compiler and enforcing it in the regression test.
2019-06-24 10:25:30 -07:00
Riccardo 57217027e2 Toyota safety: block LTA message in TSS2 cars 2019-06-20 18:33:28 -07:00
Riccardo 2ef429e656 -pedantic is too much, let's fix wall first 2019-06-17 21:39:00 -07:00
Riccardo 198a4459cc MAX is now macro and cannot be used as function param 2019-06-17 18:48:38 -07:00
Riccardo 578ef22d52 Misra 12.1 violation in MIN/MAX macros 2019-06-17 18:39:17 -07:00
Riccardo 65fb5a48e7 Macro can trigger Misra violation due redef of var before their use 2019-06-17 15:29:04 -07:00
rbiasini 0a94643321
Misra 15 7 (#219)
* Fixed Misra 15_7 violations

* switch case for buttons
2019-06-17 14:13:50 -07:00
rbiasini a3f65d66e9
capitalize MIN and MAX macros (#220) 2019-06-17 13:48:14 -07:00
rbiasini bacfcd0fd0
Make macros to get msg attributes (#218)
* made GET_ADDR, GET_BUS and GET_LEN macros

* for simplicity, addr is int instead of uint32_t as it can only use up to 29 bits
2019-06-14 19:13:05 -07:00
George Hotz 00ebc16936 track can overflows 2019-06-14 13:33:30 -07:00
George Hotz d33bb4117c oops, have to call that now 2019-06-14 13:28:15 -07:00
George Hotz e0df5c81f6 pull in libc changes from harness branch 2019-06-14 13:26:27 -07:00
George Hotz 96dcfb18d4 pull in uart changes from harness branch 2019-06-14 13:26:01 -07:00
George Hotz 59eaec5dd6 add volatiles to the ring buffer pointers 2019-06-14 13:22:33 -07:00
George Hotz b35285ba7d can push failed only with debug 2019-06-14 13:19:30 -07:00
Riccardo 464f5c2b22 Tesla safety: reduced scope of vars 2019-06-14 12:30:59 -07:00
George Hotz f9d2e8876b can does not sleep 2019-06-14 12:14:21 -07:00
rbiasini 3601212ec5
Removed 10.1 violations (#217) 2019-06-14 12:08:59 -07:00
rbiasini c066c7838c
Misra 10.4 violations (#216) 2019-06-14 10:57:14 -07:00
rbiasini 78308c0bc5
All 14.4 violations are gone (#213) 2019-06-12 20:12:48 -07:00
Riccardo 0dc4f6fd30 cadillac safety: enforcing index not going outside array size 2019-06-12 20:07:42 -07:00
rbiasini 67b831ef45
Misra 15 5 (#210)
Remove 15.5 violations
2019-06-12 18:18:07 -07:00
rbiasini 57a6c493bb
Toyota gas pressed: reconcile panda code with openpilot (#212) 2019-06-12 17:51:47 -07:00
Riccardo 4c9e0af29e simplification of cadillac_get_torque_idx 2019-06-12 13:48:34 -07:00
Riccardo 2f71ba995a Tesla safety now using same line break rules as rest of the code 2019-06-12 13:10:51 -07:00
Riccardo 55679532aa Fix Misra 20.1 violations: Moved safety declarations in its own header and qdded optional input to run misra tests for safety code only. 2019-06-12 06:35:47 -07:00
Riccardo 0e251062c6 Fix Misra 10.8 violations: could not directly cast complex expressions from float to int 2019-06-11 21:46:10 -07:00
rbiasini 23461a176c
Misra 12 1 safety (#209)
* this gets rid of all 12.1 violations
2019-06-11 21:23:48 -07:00
Riccardo 242b3305fe Added fwd hook coverage test for Cadillac and created default_fwd_hook instead of nooutput and alloutput, which were teh same 2019-06-11 19:50:12 -07:00
Riccardo 264de67fe8 Minor clean up to Subaru fwd hook 2019-06-11 19:42:53 -07:00
Riccardo b4c52a1bda Cleaned up subaru FWD hook 2019-06-11 19:40:56 -07:00
Riccardo f4419b08b9 Simplify get_ts_elapsed 2019-06-11 02:07:02 -07:00
Riccardo fa1c928961 Fix Misra 13.4 on safety code 2019-06-11 01:10:45 -07:00
Riccardo 7372ade33e Fix Misra 15.6 on safety code 2019-06-11 01:07:41 -07:00
Riccardo a2d5c9b5f4 Fix Misra 17.8 on safety code 2019-06-11 00:58:22 -07:00
Riccardo b7ed7adc71 Fix Misra 20.7 on safety code 2019-06-11 00:49:26 -07:00
Willem Melching 50658b2b00 Use dfu-utils binary from panda repo on EON 2019-06-10 13:56:13 -07:00
Riccardo 1dfe11ed3a Set controls_allowed=0 in Chrysler safety init 2019-06-07 17:36:07 -07:00
Riccardo d77fa17913 deleted unnecessary subaru safety init and using nooutput_init instead 2019-06-07 15:11:28 -07:00
Riccardo 71099efaba AddedToyota safety test around long_controls_allowed logic and fixed a bug 2019-06-05 15:29:09 -07:00
rbiasini 380b7c75c5
Long allowed (#202)
* added long_controls_allowed to cars safety code. long_controls_allowed init to 1 for now, so safety tests pass
2019-06-05 14:00:07 -07:00
rbiasini 09714e3a44
Toyota gas cancellation (#200)
* cancel on pedal press for toyota.
2019-06-05 13:38:59 -07:00
Riccardo 436b203e0b Honda safety: fixed bug and properly abstracted gas_interceptor_detected variable 2019-06-04 13:36:46 -07:00
Riccardo 220cc8f4b5 Honda safety: this concludes the proper re-naming 2019-06-04 12:43:50 -07:00
Riccardo a00a50c622 Honda safety: better naming 2019-06-04 12:21:52 -07:00
Commaremote 192fd05318 Toyota safety: fixed rounding logic 2019-06-03 16:06:39 -07:00
George Hotz b35f6ff566 legacy build is no longer supported 2019-05-23 13:23:21 -07:00
George Hotz a06af9f2aa always LIVE on EON 2019-05-23 12:39:54 -07:00
George Hotz dc5979f66a LIVE on EON 2019-05-23 12:39:54 -07:00
George Hotz 0b26645b12 no EON by default 2019-05-23 12:39:54 -07:00
George Hotz 1906a4b769 panda now draws below 100mw in power save mode 2019-05-23 12:39:54 -07:00
George Hotz e70b44aa57 move that to main.c 2019-05-23 12:39:54 -07:00
George Hotz dfce5f6e36 minor fixes, and no more autobaud 2019-05-23 12:39:54 -07:00
George Hotz 96a7e3196f a soothing blue in power save mode 2019-05-23 12:39:54 -07:00
George Hotz a74f001ba7 refactor power savings to depend on car started bit 2019-05-23 12:39:54 -07:00
George Hotz 386d5dfdf2 can wake from sleep is removed, didn't work in the first place 2019-05-23 12:39:54 -07:00
George Hotz 881b1f442b not on pedal chip 2019-05-23 12:39:54 -07:00
George Hotz 0a9f8eb581 remove many ifdef PANDA 2019-05-23 12:39:54 -07:00
George Hotz 506900576b remove nested includes and include guards 2019-05-23 12:39:54 -07:00
George Hotz 3810452a02 WTF WHY WAS THIS SHIT PUT EVERYWHERE 2019-05-23 12:39:54 -07:00
George Hotz 3cf8db9351 can.h always has CAN3 2019-05-23 12:39:22 -07:00
George Hotz 1f97c2189b refactor pedal bootstub to use llcan 2019-05-23 12:39:22 -07:00
George Hotz 58ec63b31f oops, backward 2019-05-23 12:39:22 -07:00
George Hotz 6255097a10 new style power savings 2019-05-23 12:39:22 -07:00
George Hotz 6b282f1c06 tesla doesn't need a special LIN hook 2019-05-23 12:39:22 -07:00
George Hotz 1d2467756e refactor #ifdef EON 2019-05-23 12:39:22 -07:00
George Hotz 4af036e93a fixup puts 2019-05-23 12:39:22 -07:00
George Hotz 2c1e5f6325 the refactor continues 2019-05-23 12:39:22 -07:00
George Hotz 7517f2c174 remove ifdef PANDA from main 2019-05-23 12:39:22 -07:00
George Hotz aec40ae91c remove fan, as it was only for NEO board 2019-05-23 12:39:22 -07:00
George Hotz 605bb27bce fix bootstub build 2019-05-23 12:39:22 -07:00
George Hotz c0f1f6e068 move things around for simplicity 2019-05-23 12:39:22 -07:00
George Hotz f32f0395fd factor out clear_send 2019-05-23 12:39:22 -07:00
George Hotz 8221927215 this is probably broken. refactor out llcan and clock 2019-05-23 12:39:22 -07:00
Riccardo 1114cb1ad3 ELM327 safety mode: re use existing functions 2019-05-22 18:41:26 -07:00
rbiasini 1aa00c95ee
Misra c2012 (#192)
* Started making panda misra compliant: this fixes some of 12.1 warnings

* Also added a regression test for strict compiler warning
2019-05-20 22:13:45 -07:00
George Hotz 047bd725e0 fix tests and remove rev b support 2019-05-19 09:12:26 -07:00
Riccardo 3e199cb914 Subaru safety: ES_LKAS message should not be forwarded 2019-05-11 22:27:07 -07:00
dekerr 4a3b587c64 generate dependencies and clean (#184)
* gen dependencies
Main.o and bootstub.o were missing headers (like recent power_saving.h). Generate them instead to guarantee makefile re-makes if any dependency is modified.
2019-05-06 17:33:38 -07:00
Riccardo 005e131049 Toyota Safety: cleaned up logic for TSSP2.0 cars 2019-05-05 20:29:56 -07:00
wocsor b53fb2715c add ACCEL_CMD to filtering for TSSP2.0 cars (#185) 2019-05-05 20:22:18 -07:00
Riccardo Biasini 3b351b7018 Minor fix to current type 2019-04-23 13:53:43 -07:00
George Hotz 64bcc89a9c Subaru: 545 msg must be generated 2019-04-14 22:52:38 -07:00
Nigel Armstrong f8ab74a1cc L-line relay (#166)
* Initial version of L-Line Relay

* lline relay fix build, add to health

* Add lline relay to safety

* Lline relay fix build

* Fix tests

* Add lline safety init. Dont fwd with relay closed

* Turn on relay with CAN

* relay hook

* More reliable lline relay

* Longer LLine timeout

* Only turn on wifi if not eon

* Dont disable ESP in early

* Allow CAN to be turned off

 - CAN is turned off via USB.
 - CAN is turned on when either try to transmit or can is received
 - If only transmit is asleep, all messages should send okay
 - If receive is alseep, will miss first message while waking up
 - Sometimes will report error on second message while CAN perif wakes up
 - Saves 130mW!

* Power Saver Mode

 - Gray Panda power consumption 650mw -> 325mW
 - Turns off CAN, GMLAN, LIN, GPS when no activity for 10s
 - No acitvity is no CAN send, CAN Recv, Write to GPS

* Fix power_saving to better turn off can

 - On some cars when the can is turned off, it triggers a wakeup.
 Delaying the automatic wakeup seems to fix this

* Don't save power in pedal

* Fix relay clicking on startup

* Fix duplicate include

* consistent relay setting

* relay_status can be added when needed, as it's started_alt was consumed in other places

* need to skip forwarding only if relay control is claimed

* unneded change

* make lline_relay.h not depending on can.h

* less spaghetti I guess

* less lines

* reset pedal changes

* no unused input

* update version
2019-04-11 21:03:15 -07:00
Riccardo f383eee968 Power saving: wake on RX and don't print durint IRQ 2019-04-08 19:21:37 -07:00
Riccardo 9540db7445 Chrysler safety: better to mention messages we don't want to forward 2019-04-04 12:50:40 -07:00
Drew Hintz 1049502644 chrysler: forward bus 0 to bus 2 (#177)
* chrysler: forward bus 0 to bus 2
This keeps the stock LKAS camera active so that we can copy data from its messages.

* Only forward if giraffe switches are 1 0.
Forward LKAS_HEARTBIT messages from stock camera to bus 0.
2019-04-04 10:05:00 -07:00
Nigel Armstrong 4276c380e6
Additional Power saving (#170)
* Only turn on wifi if not eon

* Dont disable ESP in early

* Allow CAN to be turned off

 - CAN is turned off via timeout
 - CAN is turned on when either try to transmit or can is received
 - If only transmit is asleep, all messages should send okay
 - If receive is alseep, will miss first message while waking up
 - Sometimes will report error on second message while CAN perif wakes up
 - Saves 130mW!

* Power Saver Mode

 - Gray Panda power consumption 650mw -> 325mW
 - Turns off CAN, GMLAN, LIN, GPS when no activity for 10s
 - No acitvity is no CAN send, CAN Recv, Write to GPS

* Fix power_saving to better turn off can

 - On some cars when the can is turned off, it triggers a wakeup.
 Delaying the automatic wakeup seems to fix this

* Don't save power in pedal

* Cleanup power saving
2019-04-01 22:45:00 -07:00
Nigel Armstrong 06958e424c Fix pedal bootstub build 2019-03-22 21:42:14 -07:00
Nigel Armstrong f5817e6bd7 Fix Pedal bootstub version 2019-03-22 21:06:47 -07:00
Riccardo 9b5b696e83 Subaru: remove GM leftover 2019-03-20 14:20:21 -07:00
Nigel Armstrong 20c76ad592 Power Saving (#169)
* Only turn on wifi if not eon

* Make sure esp is disabled on eon

* Dont disable ESP in early
2019-03-13 20:58:00 -07:00
Riccardo 5686dae25b Subaru updated driver factor 2019-03-12 23:47:54 -07:00
rbiasini a6193a8285
Dcp remove (#168)
* No DCP charge mode when building from EON
2019-03-11 23:41:40 -07:00
Riccardo Biasini e437b9b4b1 Subaru: fixed bug and added safety tests 2019-03-11 02:12:22 -07:00
Riccardo Biasini 176f1325ba Subaru: added proper safety model 2019-03-11 00:29:50 -07:00
Riccardo 0b10bb70ec Subaru safety: move camera to bus 2 2019-03-05 15:37:17 -08:00
rbiasini bce279a627
Pedal: only one firmware (#164)
* Pedal: only one firmware
2019-03-03 21:04:41 -08:00
Riccardo Biasini 4f73cb48b8 Toyota pedal: checking for no pedal being commanded when openpilot is off 2019-03-02 15:22:09 -08:00
Riccardo 39c1e39e81 Cadillac: added brake msg forwarding 2019-02-18 17:04:10 -08:00
kernyan e0dd55841a Fixed undefined reference error when "make recover" in EON
In fd233832ef
the linker flag -lgcc might not work on EON as it does not have the
correct library.

The fix was a workaround in sha.c such that we no longer need to import
function __aeabi_llsr from library, by replacing right shift operation
with const argument.

E.g.,
uint64_t a = b >> i // requires __aeabi_llsr from libgcc
uint64_t a = b >> 2 // does not require external library

Resolves: #522
2019-02-13 00:43:30 -08:00
rbiasini c91f038eab
Toyota pedal support (#159) 2019-02-07 12:48:28 -08:00
Riccardo de1ba06d71 Build optimizer: back to Os now that 'make --recover' is fixed 2019-02-06 11:45:30 -08:00
Drew Hintz fd233832ef add -lgcc flag to fix "undefined reference to __aeabi_llsr" (#156)
https://github.com/commaai/openpilot/issues/522
2019-02-06 11:44:18 -08:00
Riccardo 1cc74e2b42 Reverted code optimizer option to O2 after 'make recover' broke 2019-02-05 22:17:35 -08:00
rbiasini 1218d09edb
Cadillac ascm proxy (#155)
* added safety_ascm

* better using one funciton

* GM_ASCM safety mode by default

* fixced ign bug and passing everything for now

* blocking 0x152-0x154 and reforwarding 0x153

* gotta fwd 152 as well on CH bus

* adding braking message block

* blocking gas cmd as well

* allow cadillac supercruise to pass through

* no more hardcoded ascm safety mode
2019-02-05 18:37:02 -08:00
Riccardo 93266a9fa7 Hyundai: allow the same max steer torque as stock 2019-01-28 21:46:13 -08:00
Bugsy d275fa8489 Subaru: Forwarding (#152)
Bus 0 to 1
Bus 1 to 0 exept LKAS
2019-01-28 21:42:06 -08:00
Drew Hintz 9ee628557f optimize board build for size to avoid going over the limit. (#150)
* optimize board build for size to avoid going over the limit.
Here are the sizes of board/obj/panda.bin with different settings:
-O2 32228
-Og 30172
-Os 28028

* warning if panda.bin is over the panda's limit

* if bin is too big, error out
2019-01-23 13:24:29 -08:00
Riccardo 20e8fa9716 Start introducing Bounties 2019-01-17 16:17:53 -08:00
Riccardo Biasini 37ee289fe6 chrysler safety: fixed comments 2019-01-06 19:04:26 -08:00
Willem Melching c2dfbadee7
tesla safety: return -1 to block forward (#149) 2019-01-03 18:07:38 +01:00
Riccardo be0061dccb Chrysler: safety now based on motor torque 2019-01-02 21:53:07 -08:00
Riccardo Biasini 9193eebfa0 Chrysler: safety limits updated 2018-12-30 19:05:04 -08:00
Riccardo 04f1d44f0e Chrysler safety: 3 sa max rate down for now 2018-12-29 14:54:09 -08:00
Riccardo cf3ecd629d Chrysler safety: re-using hyundai framework 2018-12-28 19:20:57 -08:00
George Hotz 49ed9bc1ec Update CLICKS for longer bootup time of EONS and avoid unwanted fast charge mode
updated panda version
2018-12-16 18:23:39 -07:00
Riccardo 293fa33f83 Honda: fixed message forwarding addresses from can2 to can0 2018-11-09 17:58:55 -08:00
Drew Hintz 799c33868d Chrysler safety controls (#130)
* Chrysler safety model and tests.

* fix comments

* when ACC is canceled, disallow controls

* update SAFETY_CHRYSLER value in Python API and add other SAFETY values
2018-11-06 12:28:33 -08:00
rbiasini c05b15b358
Toyota frc on (#141)
* Honda: forwarding CAN0 to camera, so camera can stay on

* forward cam on toyota

* fwd some honda camera msgs

* add crv and rdx steering msg to honda fwd filter

* only fwd cam on toyota if frc is connected

* toyota: remove unused variables

* toyota: don't forward frc bus when switch 1 is high

* toyota: check when switch 1 is high
2018-11-04 15:06:44 -08:00
Riccardo 8291971d9a Toyota: using a more generalized CRUISE_ACTIVE bit that works on all cars 2018-11-04 13:57:25 -08:00
rbiasini 6f157aab68
Toyota frc on (#140)
* Honda: forwarding CAN0 to camera, so camera can stay on

* forward cam on toyota

* fwd some honda camera msgs

* add crv and rdx steering msg to honda fwd filter

* only fwd cam on toyota if frc is connected

* toyota: remove unused variables

* toyota: don't forward frc bus when switch 1 is high
2018-11-03 22:33:06 -07:00
rbiasini 915ee4f585
Honda: forwarding CAN0 to camera, so camera can stay on (#139)
* Honda: forwarding CAN0 to camera, so camera can stay on

* fwd some honda camera msgs

* add crv and rdx steering msg to honda fwd filter
2018-11-03 17:11:51 -07:00
Robert Cotran 6385551f29 Added Tesla safety changes. (#132)
* Added Tesla safety changes.

* Use generic interpolate function from safety.h

* Moved Tesla safety include to within IFDEF PANDA as legacy neo boards don't support floats used in Tesla safety code

* Remove double-pull code and time tracking from CAN message.

Better enclose Tesla-relevant code in ifdef PANDA due to use of floats

* Changes as per requests by @rbiasini from conversations in https://github.com/commaai/panda/pull/132

* Removed unused variable

Do interpolation check at every step (not every 25)

Change tesla safety constant number to 8, not 7

* Add the HYUNDAI safety number

* Remove unused struct and function (fsample)

* fix build

* Add stub gmlan implementations in safety tests
2018-10-04 19:22:10 +02:00
Riccardo 627713948a GM Volt: allowing 300 max steer 2018-09-20 16:42:11 -07:00
Riccardo 63b7926364 Hyundai safety: temporarily disabled button spam check to avoid camera faults 2018-09-07 20:43:13 -07:00
Vasily Tarasov 53aef76cf1 GM: passive on LKA-only cars (#135)
If LKA camera is still connected to powertrain.
2018-09-06 21:48:47 +02:00
Riccardo 1c0ffd1a4d Hyundai safety: simplifications 2018-09-05 16:08:42 -07:00
Andrew Frahn 56794d6e1a Hyundai Safety Auto-Detect which CAN bus Camera is on (#134)
* This compiles, and steers the car, but no unit tests performed (yet)

* Updates

225 for max torque after discussions with users in #hyundai
Fixed violation disable as requested

* Hyundai Auto-Detect which CAN bus Camera is on
2018-09-05 15:39:37 -07:00
Riccardo f2292e420b Hyundai: added safety check for button spam 2018-08-31 22:47:50 -07:00
George Hotz 1a8c4c48a1 Hyundai safety: fwd option 2018-08-30 11:54:44 -07:00
Riccardo 487fcaef2f Safety hyundai: fixed RT check 2018-08-29 19:30:14 -07:00
Riccardo 04270b8fa7 Safety Hyundai: bug fixes 2018-08-29 19:23:49 -07:00
Commaremote d0c28b7b53 Hyndai safety: tuned 2018-08-28 20:05:58 -07:00
Commaremote ad1ba6970d Hyundai safety: fixed wrong param 2018-08-28 18:12:21 -07:00
Riccardo 8a1dcbec54 Hyundai safety: added Santa Fe safety: need to be tested. Removed some unnecessary funcitons 2018-08-28 16:01:40 -07:00
Commaremote 4e9d08aabb Hyundai safety: controls_allowed ==1 by default for now 2018-08-24 22:54:46 -07:00
Commaremote f42d092505 Hyundai all output for now 2018-08-23 19:00:30 -07:00
Riccardo 7927cabcc5 compiling the use of bitbang_gmlan only for panda 2018-08-20 19:28:05 -07:00
Willem Melching 3d67294cb6 keep pedal obj folder 2018-08-20 07:33:58 -07:00
Riccardo c2a08532ca Hyundai safety: 593 also needs ot be modified 2018-08-17 23:24:32 -07:00
Riccardo 594863cea3 Hyundai: added initial safety files which just fwd bus 0 to 2 and viceversa, except for lkas msgs 2018-08-17 21:31:00 -07:00
Riccardo 905a93583a fixed pedal and legacy board builds: no float support 2018-08-14 15:55:47 -07:00
Riccardo 0a480ec20e moved interpolate function to safety header 2018-08-13 22:52:31 -07:00
Adam Urban f9a46e3646 Match safety order from master
This will cause a merge conflict with the tesla branch.
2018-08-02 14:13:57 -04:00
Adam Urban aafbe05815 GMLAN GPIO Rebase 2018-08-02 12:39:53 -04:00
George Hotz 37df290a13 rename to gmlan_alt 2018-08-02 08:58:07 -07:00
rbiasini 98b71f3af1
Toyota safety: added support for camry and chr (#127)
* Toyota safety: added support for dsu-less Toyotas (Camry and C-HR)
2018-07-24 17:04:03 -07:00
Riccardo ba8762d5a3 Toyota safety: vars and consts need 'toyota_' prefix 2018-07-17 19:43:06 -07:00
Riccardo 1a94543a22 Panda safety: minor generalization of the function max_limit_check 2018-06-20 18:34:31 -07:00
Riccardo 6b316011b3 Safety: minor data type cleanup 2018-06-20 18:19:08 -07:00
Commaremote 0dcd84d791 Toyota safety: integer division bug 2018-06-16 19:04:30 -07:00
George Hotz 9a268f333e Toyota Safety: cleaner var types 2018-06-16 18:09:17 -07:00
George Hotz 8efa389745 detect ack 2018-06-15 16:54:01 -07:00
George Hotz f5fab4b42a nicer err 2018-06-15 16:46:10 -07:00
George Hotz ad4d4231d2 add gmlan fail count 2018-06-15 16:37:04 -07:00
George Hotz 998f7c0103 oops, set recessive 2018-06-15 16:23:22 -07:00
George Hotz 80051bea09 autoretry on chime 2018-06-15 16:21:53 -07:00
Riccardo 813218deae GM: allowing higher brakes in Volt, so decel can reach between 3 and 3.5 m/s2 2018-06-14 14:12:16 -07:00
Commaremote 74ad3d65c2 GM: max param definitions 2018-06-14 12:58:45 -07:00
rbiasini 38a9ea9ad9
added gm safety for steering (#123)
* added gm safety for steering
* safety tests done for safety_gm
2018-06-13 23:13:59 -07:00
Riccardo bf5db45ab1 Safety: made the driver steer check common so it can be shared across multiple safety files 2018-06-13 15:23:56 -07:00
Commaremote ef079e6da9 Safety: made rate limit check also common 2018-06-13 01:37:36 -07:00
Commaremote dc3cc240b9 Safety: made common the max torque check as well 2018-06-13 01:11:32 -07:00
Commaremote dbc3568a1b removing extra spaces 2018-06-13 00:57:36 -07:00
Commaremote 1966bdf348 Safety: made real time rate limit check a shared function 2018-06-13 00:56:29 -07:00
George Hotz e21447765e use timer for can bitbanging 2018-06-11 10:06:10 -07:00
George Hotz cb927337da minor bitbang refactor 2018-06-11 09:06:15 -07:00
George Hotz ed2920cf8a support extended addressing in canbitbang 2018-06-11 09:02:11 -07:00
George Hotz 36df0996c5 move speed 2018-06-10 23:54:06 -07:00
George Hotz 7edc88e54b put that back 2018-06-10 23:50:50 -07:00
George Hotz fa66e4b785 Revert "handle rollover"
This reverts commit 2ce3a26ab9.
2018-06-10 23:50:32 -07:00
George Hotz 2ce3a26ab9 handle rollover 2018-06-10 23:47:44 -07:00
George Hotz 223a1fb68f cleanin it up 2018-06-10 23:40:58 -07:00
George Hotz d917386bf8 bitbanging works 2018-06-10 23:29:20 -07:00
George Hotz 74af4417db can crc 2018-06-10 23:11:29 -07:00
George Hotz 932d727867 bit stuffing support 2018-06-10 22:52:53 -07:00
George Hotz be22522714 bros ok match bros 2018-06-10 16:48:53 -07:00
George Hotz a577583530 working on gmbitbang 2018-06-10 16:23:54 -07:00
Riccardo 875c2bd312 Cadillac: block OP messages if OP is on 2018-06-08 18:33:30 -07:00
Ted Slesinski 7caba241d0 Addition to Bosch safety to support Hatchback (#111)
* Addition to Bosch safety to support Hatchback

The computer brake is shown on 0x17c sensor on Accord and CR-V. We assumed all Bosch Hondas had the new 0x1be message which reports manual brake, but Civic Hatchback is not like this- It doesn't have this message and 0x17c works like the other Hondas so we are are passing a parameter from Openpilot for this.

* Renamed variable

* Make comment more descriptive

* Added safety check for cancel-only spamming

* Add regression test for brake on accord and crv

Init with bosch safety variables

Some more testing changes (still broken)

Make second test work

* Adds one more ttest

* Cannot implicitly convert type 'int' to 'bool '

* ok to spam resume if controls_allowed==true

* need to use current_controls_allowed. Still need to fix the message blocking

* checking for bus 0 on button spam

* better to use the car name in front of global vars

* even better name and fixed safety tests
2018-06-06 14:20:07 -07:00
George Hotz 63ca46bc24 modify before we forward 2018-06-06 13:46:12 -07:00
Commaremote bf70f51596 Safety: increase buffer for sampled signals. TBD a violation feedback from board to prevent car faults 2018-06-03 17:39:57 -07:00
Commaremote b0541a8316 Cadillac: monitoring the 4 torque messages independently 2018-06-03 01:53:06 -07:00
Riccardo ca0b6bebcc Cadillac: fixed typo. Need better regression tests to catch this 2018-06-02 23:27:32 -07:00
Riccardo d9f1e61643 Cadillac: simplified the ignition code by removing the timeout logic and resetting controls_allowed = 0 at each init 2018-06-02 19:18:32 -07:00
Riccardo 293fd1ac70 GM: using real ignition logic. Creedit to Jamezz 2018-06-02 19:08:10 -07:00
Riccardo 8fa507b621 GM: simplified max steer check logic, Cadillac: fixed can parsing bug 2018-06-02 14:06:15 -07:00
rbiasini c7e2c2d696
Cadillac (#119)
* added some steer safety to Cadillac

* bug fixes

* added cadillac full steering safety. To be tested

* RT checks and max checks working. Need to test driver torque based limits

* cadillac steer safety should be done

* unneded lines
2018-06-01 19:45:29 -07:00
rbiasini 83bcaa3980
small logic cleanup (#118) 2018-06-01 16:27:55 -07:00
Riccardo 9d92bf27c8 Cadillac: need to specify car name in const 2018-06-01 14:03:07 -07:00
Commaremote 79ab5af8c3 Toyota: moved common functions into safety header file 2018-05-31 18:49:12 -07:00
Riccardo 40c8ddaf7d Cadillac ignition: simplified logic 2018-05-30 19:49:02 -07:00
Commaremote 69be556de0 Cadillac: better ignition logic 2018-05-29 15:27:24 -07:00
Riccardo d176220c72 Ignition: made a default hook for GPIO 2018-05-25 18:20:55 -07:00
Riccardo bea51874e7 Cadillac: added max steer safety 2018-05-25 17:53:02 -07:00
Commaremote dbc11a17c1 Cadillac: always controls allowed for now 2018-05-25 14:42:18 -07:00
Commaremote ace232a91e Cadillac: ignition bug 2018-05-25 14:17:02 -07:00
Commaremote e2c89d6bc8 Cadillac: changed ignition logic to be based on can presence 2018-05-25 13:57:19 -07:00
Commaremote 528f901b4d Cadillac: simpler ignition logic 2018-05-25 12:44:46 -07:00
Commaremote 4e79ecf112 Cadillac: added safety file placeholder 2018-05-25 10:36:25 -07:00
rbiasini ace4a224c8
Ford safety (#115)
* added initial ford safety header

* added ford ok safety. Missing brake check

* added force cancel check in ford safety

* added brake check to fusion

* fixed nomenclature
2018-05-02 22:45:23 -07:00
George Hotz 988fbf5e32 disable autobaud by default 2018-04-26 09:38:52 -07:00
George Hotz 2253dd3c48 fix volt ign detect 2018-04-13 20:11:01 +00:00
George Hotz 3b299d79c7 add ignition and refactor 2018-04-12 12:01:36 -07:00
George Hotz af9af6d13e
Merge pull request #110 from Jamezz/volt
Add safety hook for ignition state for car platforms that don't support GPIO pin
2018-04-12 12:00:26 -07:00
George Hotz 13e850e18e more correct 2018-04-12 09:09:14 -07:00
George Hotz fec975889d gate that with debug 2018-04-11 21:55:47 -07:00
George Hotz 5516ebf3ce one more ifdef 2018-04-11 21:14:37 -07:00
George Hotz cac7b318f0 only panda has float 2018-04-11 20:47:29 -07:00
George Hotz 938d474723 fpu enable 2018-04-11 19:52:42 -07:00
George Hotz ffbf0c789a cleaner 2018-04-11 19:42:14 -07:00
George Hotz de30f27349 Revert "need f to not be double"
This reverts commit 4142acf2f9.
2018-04-11 19:41:44 -07:00
George Hotz 4142acf2f9 need f to not be double 2018-04-11 19:39:41 -07:00
George Hotz 3eb15c8502 refactor to share code 2018-04-11 19:24:03 -07:00
George Hotz a4c8b64678 change to O2 to fix make recover 2018-04-11 19:12:58 -07:00
Chris Vickery 711fd112b7 Enable compiler optimizations, fix things it breaks 2018-04-11 16:15:38 -07:00
George Hotz 2e6f774856 block IPAS in main toyota safety mode 2018-04-11 14:45:52 -07:00
George Hotz 367c9ad242 add safety toyota ipas 2018-04-11 14:31:58 -07:00
Greg Hogan 95919b932d Bounty: panda high quality CAN autobaud (#96)
* CAN auto-baud

* Disable autobaud when exiting silent mode
2018-04-11 14:31:48 -07:00
Riccardo 6557cd258a Toyota Safety: allow controls only on rising edge of cruise_engaged 2018-04-11 14:07:05 -07:00
Riccardo 02c1ddf5fc Revert "added steer override check when IPAS is in control (#106)"
This reverts commit 7d21acbccc.
2018-04-11 14:00:25 -07:00
Thomas Helms 9f925ba9d2 Fix the merge mess 2018-04-11 13:13:05 -07:00
Jamezz 23d3833d77 Merge from comma upstream 2018-04-11 13:04:16 -07:00
Jamezz a0cc51af15 Undo safety mode override
We don't need to force safety to GM for testing, fingerprinting should work.
2018-04-11 12:54:16 -07:00
Chris Vickery 6dbd8c972b
Implement WebUSB and upgrade WinUSB to 2.0 (#107)
* Implement webusb and winusb 2.0 specs

* Add missing constants

* Refactor string system, add support for USB2.1

* Uncapitalize the panda

* Add USB 2.0 extension descriptor and device qualifier getter

* Sleep during reconnect process to be more reliable

* Disable compiler optimizations because they break SPI coms
2018-04-11 10:08:56 -07:00
Thomas Helms 4fc83a5f5c Add safety hook for ignition and have GM use gear selector to determine ignition 2018-04-10 17:55:55 -07:00
rbiasini 7d21acbccc
added steer override check when IPAS is in control (#106)
* added steer override check when IPAS is in control

* same override threshold as carController

* added initial safety tests for angle control

* cleaned up safety tests and added ipas state override check

* ipas_override is an unnecessary global variable

* bump panda version
2018-04-05 13:30:44 -07:00
George Hotz 703c0b4ec1 Gas Interceptor: another fix to gas pressed logic 2018-03-17 15:50:42 -07:00
George Hotz 196d383d8e Interceptor: fixed gas pressed logic 2018-03-17 15:20:20 -07:00
George Hotz 67d52089a1 fix signedness issue in toyota safety 2018-03-13 20:33:47 -07:00
George Hotz 11c2b08c2f add fault invalid 2018-03-12 19:56:57 -07:00
George Hotz 27c76372e9 forgot the counter 2018-03-12 17:55:24 -07:00
George Hotz bfa7d2eb3d canloader works 2018-03-10 11:28:32 -08:00
George Hotz b259e2ae91 can flasher is close to working 2018-03-10 11:22:22 -08:00
George Hotz 83f2edfb78 isotp can support in softloader 2018-03-10 11:06:40 -08:00
George Hotz 190b4f6841 start work on canflasher 2018-03-10 10:13:30 -08:00
George Hotz 5c655c992b add recover support 2018-03-10 09:34:48 -08:00
George Hotz ae3457f477 usbflash is reliable 2018-03-10 09:28:53 -08:00
George Hotz f7a0ab09bf pedal usbflash works 2018-03-09 17:47:13 -08:00
George Hotz 000715b51d start work on pedal canloader 2018-03-09 14:30:28 -08:00
George Hotz 626e3123c6 pedal has a bootstub now 2018-03-09 14:02:00 -08:00
George Hotz 3662d1e66a redundant check 2018-03-09 13:33:20 -08:00
George Hotz 30fd66a74a
Merge pull request #93 from vntarasov/volt
Tweak Volt's brake pedal stickiness
2018-03-08 08:37:08 -08:00