Commit Graph

615 Commits (f9053f5df4f2a0be475d5b76c84d371f0b26b7b0)

Author SHA1 Message Date
Jason Young 2f9e076289 Panda safety code for Volkswagen, Audi, SEAT, and Škoda (#293)
* Panda safety code for Volkswagen, Audi, SEAT, and Škoda.

* First pass at MISRA compliance.

* Second pass at MISRA compliance.

* Fix scope of violation boolean.

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

* Remove superfluous newline.

* Remove unused VW ignition hook code, preserve commentary.

* Add 50% padding to max delta check.

* Add 50% padding to max delta check.

* Add clarity around the origin of our safety constants.

* Update test RT delta to match safety.
2019-10-09 13:54:22 -07:00
robbederks 0812362b52 GPS UART fix until boardd is refactored (#294)
* Temporary GPS fix

* spaces
2019-10-08 19:41:10 -07:00
robbederks 0894b28f1e Fixed USB power mode on black (#291)
* Fixed USB power mode on black

* bump version
2019-10-05 20:34:19 -07:00
rbiasini 4b3358c921
patch to be able to switch from EON to PC with a Panda that has EON b… (#290)
* fix switching from EON to PC with a Panda that has EON build and not 12V supply
2019-10-04 14:51:26 -07:00
robbederks a95c44a717
Made setting of NOOUTPUT on no heartbeat more efficient (#287)
* Made setting of NOOUTPUT on no heartbeat more efficient

* Stupid mistake

* Fixed hardcoded safety mode
2019-10-04 13:30:00 -07:00
robbederks 9486836886
UART instability fix with high interrupt load (#283)
* Fixed UART overrun error

* Added stability test scripts

* Refactored UART code. ESP/GPS now uses DMA in circular mode to directly write into the ring buffer, saving a bunch of interrupts and potential race conditions.

* Changed stability test to use amount of bytes instead of amount of non-zero messages, since the ring buffer pointer is only updated on half or full DMA transfer or on line idle (e.g. no more 1 char messages from the gps)

* Increase data limit. It's too low sometimes in normal operation

* Forgot to set write pointer in ring buffer

* Increased test limit even more
2019-10-04 13:28:56 -07:00
rbiasini 9a9e9d47bc
Fix usb_power_mode missing initialization (#289)
* Fix usb_power_mode missing initialization

* typo

* re-added NONE usb power mode, so usb_power_mode is only set in set_usb_power_mode func
2019-10-04 10:48:17 -07:00
rbiasini 70219d7bb2
match safety enum in cereal (#285)
* match safety enum in cereal

* removing tons of hardcoding

* add pythonpath to safety test

* Fix safety test in Docker
2019-10-02 18:20:32 -07:00
rbiasini 78ef4a6ebc
Stop charge (#284)
* CDP by default in EON build on white panda

* Cleaned up power mode setting

* send usb power mode in health

* cleaner CDP setting on ignition

* bump panda
2019-10-02 11:48:40 -07:00
Arne Schwarck 5266a40287 Fix typo (#286) 2019-10-02 11:40:38 -07:00
Riccardo f4787ec5a2 Revert "turn on CDP when ignition switches on (#281)"
This reverts commit 8c1df559f7.
2019-10-01 17:01:14 -07:00
Riccardo d37daee978 Revert "NONE and CLIENT should be the same thing in white/grey pandas"
This reverts commit e97b283e77.
2019-10-01 15:20:59 -07:00
Riccardo e97b283e77 NONE and CLIENT should be the same thing in white/grey pandas 2019-10-01 15:16:13 -07:00
rbiasini 8c1df559f7
turn on CDP when ignition switches on (#281) 2019-09-30 21:48:30 -07:00
rbiasini fac0277169
Misra update (#280)
* Updated cppcheck ref. New rules to be fixed

* changed 2 MACRO names that had more than 31 characters in common

* Fix newly popped 10.4: same type on arithmetic ops

* Fix 18.4: operators should not be applied to an expression

* ensure a NULL pointer isn't dereferenced
2019-09-27 17:18:02 -07:00
Robbe c4ac3d63be Disable GPS load switching on black pandas 2019-09-27 13:22:06 -07:00
Riccardo 2dc34096a0 2to3 applied 2019-09-24 22:33:46 -07:00
Riccardo 1e2412a297 env python -> env python3 2019-09-24 17:50:53 -07:00
Jafar Al-Gharaibeh 9881e61184 Panda for Mazda (#165)
Implement the safety limits
Smarter forwarding:
   Detect what msgs are sent by OP and drop corresponding CAM msgs
   Detect if Stock CAM is connected
   Detect if CAM is in hardware passthrough

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
2019-09-09 15:58:41 -07:00
Bugsy a8ed7d2199 add subaru outback/legacy to subaru safety (#259)
* add subaru outback/legacy safety

* subaru safety passes misra check

* change violation to bool
2019-09-09 15:13:02 -07:00
George Hotz bdeb1c953f mazda is #12 2019-09-09 14:56:14 -07:00
Riccardo 14ea4d2e07 merge safety gm in a single file 2019-09-08 14:07:05 -07:00
Vasily Tarasov bf1ef875ee Add GM passive safety mode (#266) 2019-09-08 14:02:27 -07:00
BogGyver c131fffaeb fix canflash for pedal (#267) 2019-09-05 08:24:49 -07:00
George Hotz 3397b1527e only allow bootloader entry on debug builds 2019-09-04 16:05:50 -07:00
rbiasini d68356b924
Honda Nidec: fwd stock AEB (#257)
* Honda Nidec: fwd stock AEB

* bug

* correct aeb bit

* typo

* Revert "typo"

This reverts commit d424198b1fbc5a783c39b5bdd7d034865ed61a83.

* typo

* bug fix

* don't have tx hook blocking aeb messages from stock system

* typo

* fwd stock brake even if they are the same

* only stop forwarding aeb when aeb flag clears

* Fix safety tests

* Added fwd safety tests

* tiny bit more readable
2019-08-30 20:15:03 -07:00
robbederks 6f532c6d51 Black panda Jenkins (#256)
* Jenkins test refactor and black panda addition

* Added HW types needed by previous commit

* Fixed ignition interrupts when not on EON build

* Added functions for load switches

* More test scripts for black panda

* Added NONE power mode to the code

* Fixed race condition when setting GPIO pins was interrupted.

* Added relay test script

* Fixed flashing with critical sections and GPS load switch

* Fixing critical depth after reboot

* Made the loopback test asserting

* Made critical depth a local variable to avoid race conditions

* Added GPS to power savings mode

* Fixed DFU mode on white panda and bumped version

* Fixed PEDAL_USB compilation error

* Fixed misra compliance of new critical depth code

* Cleaned up heartbeat logic in the testing code. Re-added ALL_CAN_BUT_MAIN_SILENT. Bumped version. Improved critical section code.

* Fixed DFU flashing (once again)

* Fixed VERSION

* Added relay endurance test

* Changed to alloutput on ELM mode for fingerprinting.

* Fixed minor remarks
2019-08-28 12:57:42 -07:00
robbederks d68508c79a Gpio race condition fix (#263)
* Fixed pedal not initializing

* Interrupt changes

* More changes
2019-08-28 12:53:51 -07:00
robbederks d69d05fc0f Fixed pedal not initializing (#262) 2019-08-26 19:24:24 -07:00
Riccardo 36067e01c7 Honda safety: fixed incorrect brake decoding. Due to the specific limit of 255, this change does not affect the safety behavior 2019-08-22 20:29:44 -07:00
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