Commit Graph

69 Commits (d7f7b141181c290e8ceb982a69e0f5729532c67f)

Author SHA1 Message Date
Adeeb d7f7b14118
Enable almost all Flake8 checks (#548)
* fix W391

* E262

* E703

* W293

* some E

* E231

* some more E

* E225

* more E

* E252

* no tabs

* more tabs

* E701

* uds.py

* almost all of them

* only e265 left

* not sure why this is triggering on commented out code

* ignore esptool
2020-06-01 01:49:26 -07:00
Adeeb Shihadeh 9102c16118 two spaces before inline comment 2020-05-31 14:07:01 -07:00
Willem Melching b8267341a1
Add pre commit checks + CI (#545)
* Add pre commit checks

* untested but should work

* fix typo in dockerfile

* add sqlite

* add pylintrc to ignore usb1 members

* Typo in stage name

* Move to requirements
2020-05-29 11:52:03 -07:00
bkralik c2bea78f6d
Fix python library on Windows (#523)
On Windows, setAutoDetachKernelDriver is not supported (http://libusb.sourceforge.net/api-1.0/group__libusb__dev.html#ga5e0cc1d666097e915748593effdc634a) and causes libusb to get stuck (simple try-catch is not working). This prevents any issues when running both at native windows python and cygwined python...
2020-05-02 12:18:26 -07:00
Willem Melching f07a6ee7c5
panda recover should go through bootstub first (#498) 2020-04-13 15:12:06 -07:00
Adeeb 8cc3a35700
remove cadillac (#496) 2020-04-13 14:43:46 -07:00
Greg Hogan da8e00f115
TX message guaranteed delivery (#421)
* wait for tx slots before clearing nak

* fix bootstub

* Fixed misra

* Cleanup

* Added bulk write test to test USB NAK on bulk CAN messages

* Added automated bulk tx test

* Fixed linter

* Fixed latency test influence

* Added timeout to python API

* Disabled can write timeout in bulk write test

Co-authored-by: Robbe <robbe.derks@gmail.com>
2020-04-06 16:49:42 -07:00
Shreyansh Chandak 0c2c149490
Fixing libusb busy error (#174)
Detaching all kernels before attempting to claim the usb
2020-04-02 10:12:03 -07:00
Jason Young 08ef92d585
Safety model for Volkswagen PQ35/PQ46/NMS (#474)
* Align with VW Community port 0.7.4-devel

* Import of PQ35/PQ46/NMS safety work

* Add safety replay drive for PQ35/PQ46/NMS

* Unwind community port hax for upstream, bump Panda ver

* Update comment

* Reduce whitespace diff

* Reduce whitespace diff

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

* Propitiate MISRA

* Ixnay on the VERSION LF

* Remove VERSION LF, update safety_replay with PQ drive

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

* Remove superfluous return

* Bypass Docker caching issue
2020-04-01 12:38:27 -07:00
rbiasini b2dbb504dc
remove toyota ipas safety code and tests (#460) 2020-03-04 10:54:13 -08:00
rbiasini dfa6b079de
separating subary legacy safety mode from global (#452)
* separating subary legacy safety mode from global

* added explicit tests for subaru legacy, which were absent before
2020-02-27 15:28:24 -08:00
Andre Volmensky db94a5b813
Added Nissan safety (#244)
* Added Nissan safety
2020-02-26 11:11:56 -08:00
Jason Young ccf75c456f
Volkswagen safety updates: Phase 1 (#444)
* Checkpoint Panda refactoring updates

* Rename MQB safety tests in preparation for PQ

* Refactor MQB tests, add missing torque test

* Bring in MQB init without CRC LUT setup

* Fix to ACC_06 test case

* Fix to ACC_06 test case

* Tweak comment for clarity

* Drop superfluous return
2020-02-19 12:37:38 -08:00
Willem Melching 38fc1d39ff add option to not do a clean st build 2019-12-20 19:39:50 -08:00
Riccardo d19fd3e6bd better differentation of honda safety modes 2019-12-20 15:51:32 -08:00
Riccardo 01244d7557 Fix panda libs 2019-12-20 14:34:59 -08:00
Riccardo 268ab9acf3 send can_rx_errs in health 2019-12-19 18:17:09 -08:00
Willem Melching ad10c8c7ee get_signature return bytes instead of bytearray 2019-12-18 17:03:31 -08:00
Willem Melching 7c13bec09f
Command to get signature (#399)
* Commands to get signature from panda

* does this make misra happy?

* Can I do this in misra?

* this works and makes misra happy

* Add jenkins test for get signature

* Remove comments

* Add comment about code size

* Fix firmware file path
2019-12-09 10:54:48 -08:00
Robbe ca39a5d8f6 Added faults integer to health packet 2019-11-26 17:07:51 -08:00
Robbe 22464356c3 Fixed health struct size. We should really get an automated test for this 2019-11-22 16:02:08 -08:00
robbederks f458d67a7c Add uptime counter to the health packet (#391)
* Added uptime counter to the health packet

* fix tests by setting power save on on EON build
2019-11-21 16:47:49 -08:00
rbiasini 1192d934a0
Power saving refactor (#389)
* Exit power saving also for CAN based ingition detection and replace interrup with simple state machine. a bit of delay it's fine

* bug fixes and also CDP set on start

* sorry misra

* move comment

* typo

* remove ignition interrupts

* Power saving state machine should be done by boardd, which also sets safety modes and usb power modes

* typo

* Added usb command for power save state setting

* Added power save enabled packet

* Added power_save_enabled to python lib too
2019-11-21 12:53:00 -08:00
rbiasini 597436d32a
NOOUTPUT safety mode is now SILENT. NOOUTPUT still exists but keeps C… (#388)
* NOOUTPUT safety mode is now SILENT. NOOUTPUT still exists but keeps CAN live

* README mention of 'no output'

* mispelled
2019-11-20 11:56:26 -08:00
Robbe 6626a54241 Fixed python health api 2019-11-15 21:01:46 -08:00
Robbe f2cbec161e Added has_obd() to python library 2019-11-05 18:25:42 -08:00
robbederks e0762c2e77
Add Python & USB API for controlling phone power (#313)
* Added interface for phone power

* Add power function in python

* Fixed struct
2019-11-04 17:26:37 -08:00
Robbe ba9fb69f65 New health packet struct also in the python libs 2019-10-31 17:08:02 -07:00
rbiasini a12a148d5f Uno (#274)
* Added uno

* Added usb switch support

* Added PWM and IR power functions

* Implemented bootkick

* Added uno as a new hw type

* Bumped version

* Added fan control and tach readout

* WIP: RTC support

* Working RTC

* Fixed python

* Misra compliance

* Added USB control messages for fan/IR power

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

* Added IR and fan to power saving mode

* Changed defaults

* Fix safety considering uno

* passing safety now

* Minor UNO tweaks

* Fixed version

* More minor temporary tweaks

* Removed usb load switch from uno

* Added power control for shutting down the fan completely

* Disable IR LEDs by default

* Fixed linter issue

* Linter fix #2
2019-10-25 16:22:42 -07:00
rbiasini 1102e69652
make ignition logic common for all cars (#303)
* make ignition logic common for all cars

* ignition_can is not a safety thing. move it to can drivers

* bump version

* gm safety passive is deprecated

* move tx 1 on logic into board specific headers.
2019-10-22 15:10:43 -07:00
rbiasini fce38a91d7
Linter python (#299)
* Added pyflakes and Pylint for python

* Actually run linter in CI

* some simple pyflakes changes

* Add flake8 to panda reqs for linter test

* flake8 errors are fixed

* run flake8 in regression tests

* meant to run flake8

* hack to ignore unused import

* bug

* fix bugs in tucan_loopback

* Another fix by using set_safety_mode

* added pylintrc file

* more fixes and enabled pylint as well

* Fix pylint in circleci

* added linter to readme
2019-10-15 14:03:31 -07:00
rbiasini 6b1f28f574
fix more encoding and some bytes cleanup (#300) 2019-10-15 12:05:33 -07:00
rbiasini f9053f5df4
more Python 3 fixes, attempting to fix jenkins wifi regresison test (#295)
* more Python 3 fixes, attempting to fix jenkins wifi regresison test. Not successful, but closer.
2019-10-10 12:34:52 -07:00
Jason Young 2f9e076289 Panda safety code for Volkswagen, Audi, SEAT, and Škoda (#293)
* Panda safety code for Volkswagen, Audi, SEAT, and Škoda.

* First pass at MISRA compliance.

* Second pass at MISRA compliance.

* Fix scope of violation boolean.

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

* Remove superfluous newline.

* Remove unused VW ignition hook code, preserve commentary.

* Add 50% padding to max delta check.

* Add 50% padding to max delta check.

* Add clarity around the origin of our safety constants.

* Update test RT delta to match safety.
2019-10-09 13:54:22 -07:00
rbiasini ffbdb87a8d
python2 -> 3 fixes to pedal flasher (#292)
* python2 -> 3 fixes to pedal flasher

* fix Debug flash as well

* Fixes to wifi-test
2019-10-08 19:07:59 -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
Robbe c4aabae591 Fixed some python3 bugs in the test scripts and PandaSerial 2019-09-27 15:22:13 -07:00
Riccardo 5f2bc44606 better 2019-09-25 16:52:51 -07:00
Riccardo b2a30fdbdf make works! 2019-09-25 16:52:03 -07:00
Riccardo fe727706bd read file as byte and no tab before sleep 2019-09-25 14:34:28 -07:00
Riccardo 2dc34096a0 2to3 applied 2019-09-24 22:33:46 -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
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
George Hotz 3810452a02 WTF WHY WAS THIS SHIT PUT EVERYWHERE 2019-05-23 12:39:54 -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
Nigel Armstrong 1d2f8f0abf
Jenkins (#179)
* Improve panda automated testing

 * begin testing both white and grey panda
 * Improve wifi reliability

* First commit for docker

* Fix usb devices not showing up on reconnect

* Add tests for two pandas, latency and throughput

* Add Jenkinsfile

* Allow flashing release on wifi

* Fix Jenkins stuck in DFU mode and docker container running

* Add pandaextra from xx to docker

* Need more time for ST to restart, sometimes

* Add xml output to tests

* Try making wifi more reliable

* Fix infinite loop in ping

* Check connected after flash

* Cleanup two panda tests

* Try fixing failing test with check after udp

* Try to fix with sleep

* Temporarily run just 5 and 6

* Cleanup

* Desperate times call for desperate measurse

* BUGFIX: power saving when rx only

* Fix failing when white panda is first after udp

* Test both Dev and EON build

* Jenkins test results for both builds

* Better test case naming
2019-04-09 14:09:18 -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 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
rbiasini a6193a8285
Dcp remove (#168)
* No DCP charge mode when building from EON
2019-03-11 23:41:40 -07:00
Nigel Armstrong d7d08892e7 Capture make failure so it can be logged to sentry 2019-02-21 01:48:36 -08:00