Commit Graph

161 Commits (e91613bc625dfac43e9d3c4135dec8a1757ade37)

Author SHA1 Message Date
Dean Lee e4e669bb0f
add space after function name and if statement (#21225) 2021-06-11 10:17:52 +02:00
Dean Lee c53cb5d570
Use C++ header files instead of C header files. (#21192)
* use cstring instead of string.h

* use cstdio instead of stdio.h

* remove inttypes.h

* use cstdlib instead of stdlib.h

* use cstdint instead of stdint.h

* #include <cstddef>

* cstdlib

* use cmath

* remove stddef.h

* use cassert

* use csignal

* use ctime

* use cerror

* rebase master
2021-06-08 13:46:22 -07:00
Adeeb Shihadeh f04d6a9b3f
log on startup when panda heartbeat is lost (#21151)
* log when heartbeat lost

* bump panda

* bump panda

* add to pandaState

* move that
2021-06-04 23:22:08 -07:00
ShaneSmiskol 36beaf0d68
Add CLEAR_ON_IGNITION_OFF param type (#21121) 2021-06-03 15:21:53 -07:00
robbederks 4a24d389c4
Add harness connection as requirement for powerdown (#21087)
* add harness connection as requirement for powerdown

* fix unittests
2021-05-31 13:32:26 +02:00
Willem Melching ea5141d909
Store almanac on ublox poweroff (#20967)
* Store almanac on ublox poweroff

* send current UTC time

* move message building to ublox_msg.h
2021-05-20 11:43:03 +02:00
Dean Lee 0495426535
Cleanup includes (#20925)
* remove #include <pthread.h>

* remove #include<stdbool.h> for cc files

* remove #include<iostream>
2021-05-17 10:31:31 +02:00
Adeeb Shihadeh e694f0b4d6
boardd: set can and pandaState valid flags (#20899)
* boardd: set can and pandaState valid flags

* add event

* bump cereal

* consistency
2021-05-14 21:26:02 -07:00
Dean Lee 7222d0f20d
Cleanup selfdrive/ includes (#20822)
* cleanup include path

* continue

* format includes

* fix testraw.cc

* remove include path from SConstruct

* regroup

* rebase master

* almost done

* apply review

* rename FileReader.xx to filereader.xx

* rename Unlogger.x->unlogger.x

* rename FrameReader.xx -> framereader.xx

* apply reviews

* ui.h

* continue

* fix framebuffer.cc build error:mv util.h up

* full path to msm_media_info

* fix qcom2 camerad

Co-authored-by: Comma Device <device@comma.ai>
2021-05-08 22:15:17 -07:00
Willem Melching ab319d4f54
Replace ifdef with hw abstraction layer (#20843)
* Replace ifdefs with hardware abstraction layer (#20801)

* add type to class hadwareXXX

* replace ifdefs with hardware layer

* continue

* continue

* new function get_driver_view_transform

* full path to hw.h

* fix build error setup.cc

* apply review

* fix typo

* fix deprecated error:replace deprecated fromPath with new

* fix build error

* Fixes after ifdef clenaup (#20842)

* inheritance doesnt work with static

* fix debayer

* small cleanup

* Update selfdrive/camerad/cameras/camera_common.cc

* Update selfdrive/ui/qt/offroad/settings.cc

* Update selfdrive/common/modeldata.h

* flip conditions

* fix comment

Co-authored-by: Dean Lee <deanlee3@gmail.com>
2021-05-06 14:39:05 +02:00
Willem Melching 3a95d3ccaa Revert "Replace ifdefs with hardware abstraction layer (#20801)"
This reverts commit 757d2923d2.
2021-05-06 12:29:30 +02:00
Dean Lee 757d2923d2
Replace ifdefs with hardware abstraction layer (#20801)
* add type to class hadwareXXX

* replace ifdefs with hardware layer

* continue

* continue

* new function get_driver_view_transform

* full path to hw.h

* fix build error setup.cc

* apply review

* fix typo

* fix deprecated error:replace deprecated fromPath with new

* fix build error
2021-05-06 11:41:46 +02:00
Adeeb Shihadeh b4447993c1
add CLEAR_ON_IGNITION param type (#20810) 2021-05-04 11:32:40 -07:00
Adeeb Shihadeh 8a280fbb8e bump cereal 2021-05-03 20:47:11 -07:00
Adeeb Shihadeh 6954eb6259
clear controls ready flag on falling edge of ignition (#20807) 2021-05-03 19:09:42 -07:00
Adeeb Shihadeh f9a961f6fb
delay controls start (#20761)
* delay controls start

* shouldn't need this stuff anymore

* only delay board

* bail after 2s

* fix loopback test

* fix process replay

* update refs

* bump cereal

Co-authored-by: Comma Device <device@comma.ai>
2021-04-30 13:55:17 -07:00
Willem Melching 34328ba305
Remove panda set power functions (#20712)
* remove panda set power functions

* removed
2021-04-20 15:31:19 +02:00
Willem Melching a163daf5e0
Improve robustness of ublox init procedure (#20685)
* improve ublox init robustness

* cleanup

* only log if running at 1hz

* not needed
2021-04-15 14:11:53 +02:00
Adeeb Shihadeh 9edda6fbc1
tici: offline big cluster while offroad (#20668)
* tici: offline big cluster while offroad

* shuffling

Co-authored-by: Comma Device <device@comma.ai>
2021-04-12 23:06:24 -07:00
Willem Melching 8ede1b30aa
tici: move real-time processes to high-performance cores (#20634) 2021-04-09 13:41:43 +02:00
Comma Device 28a5db2e6a boardd: log slow hwmon reading 2021-04-09 00:13:01 -07:00
Willem Melching 301b755179
cloudlog on RTC read/write (#20536)
* cloudlog on RTC read/write

* log with correct offsets

* log old rtc time when updating

* compute dt

* fixes

* utc

* if more than 1
2021-03-30 11:29:58 -07:00
Dean Lee 98e55996f6
Params: python-like interface (#20506)
* rebase master

* delete outdated test_params.c

* putBool & more robust getBool

* putBool(SshEnabled)
2021-03-30 12:54:59 +02:00
Willem Melching 0a88304e8d
use class AlignedBuffer (#20388)
* use class AlignedBuffer from cereal (#20343)

* AlignedBuffer

* move AlignedBuffer to cereal/messaging.hpp

* rename function aligned to get

* use overloaded function AlignedBuffer:: get(Message *)

* use AlignedBuffer

Co-authored-by: Dean Lee <deanlee3@gmail.com>
2021-03-17 14:43:23 +01:00
Willem Melching 3c23226edc
verify safetyParam read back from PandaState (#20384)
* verify safetyParam read back from PandaState

* update ref

* bump panda
2021-03-17 14:20:05 +01:00
Willem Melching e3ad952902 Revert "use class AlignedBuffer from cereal (#20343)"
This reverts commit 7aa379e123.
2021-03-16 20:21:03 +01:00
Dean Lee 7aa379e123
use class AlignedBuffer from cereal (#20343)
* AlignedBuffer

* move AlignedBuffer to cereal/messaging.hpp

* rename function aligned to get

* use overloaded function AlignedBuffer:: get(Message *)
2021-03-16 11:13:15 +01:00
Willem Melching 8573bdbf2f ublox logs level logging.debug -> logging.info 2021-03-15 12:53:54 +01:00
Willem Melching aaf9ceac4b boardd.cc: lower log level of ublox timing issues 2021-03-15 12:14:30 +01:00
Willem Melching 70d683261c boardd: stricter ublox logging 2021-03-10 14:50:26 +01:00
Adeeb Shihadeh dd74f09eab
turn pigeon off when going offroad (#20296)
* cleanup

* power off pigeon

* comment

Co-authored-by: Comma Device <device@comma.ai>
2021-03-09 22:48:27 -08:00
Willem Melching d66661fa67 boardd: 0.9s timeout, only log no reset 2021-03-09 17:54:40 +01:00
Willem Melching 6884d7c9bd boardd: increase CLASS_RXM timeout 2021-03-09 17:28:19 +01:00
Willem Melching fbdeee5738 boardd: remove check on CLASS_MON 2021-03-09 15:45:22 +01:00
Willem Melching fff5cde352 board: respect 10 second ublox init time 2021-03-09 12:05:16 +01:00
Willem Melching 4fc81c2a08
Boardd: Track ublox message frequency and re-init (#20278)
* track message frequency

* also keep old reset trigger

* cleanup

* improve comments

* Add 10 seconds

* these are now signed

* also check ignition last

* cleanup

* correct include

* lower threshold

* dont clear map
2021-03-09 11:49:58 +01:00
Dean Lee 12928cdae2
use cached buffer for FlatArrayMessageReader (#20233) 2021-03-08 11:02:21 +01:00
robbederks 35b43d2084
also shutdown on tici (#20130) 2021-02-22 15:46:22 +01:00
Adeeb Shihadeh 312b681a46
cereal cleanup part 2 (#20092)
* car stuff

* thermal

* Revert "car stuff"

This reverts commit 77fd1c65eb.

* panda state

* camera stuff

* start deg

* most is building

* builds

* planner + controls run

* fix up paramsd

* cleanup

* process replay passes

* fix webcam build

* camerad

* no more frame

* thermald

* ui

* paramsd

* camera replay

* fix long tests

* fix camerad tests

* maxSteeringAngle

* bump cereal

* more frame

* cereal master
2021-02-16 21:39:32 -08:00
Adeeb Shihadeh 4ace476f14 fanSpeedRpmDesired -> fanSpeedPercentDesired 2021-02-11 17:00:26 -08:00
Dean Lee 2a935a2010
boardd: check do_exit in usb_retry_connect (#20007) 2021-02-08 12:01:12 +01:00
Adeeb Shihadeh 000bd226aa
Cereal cleanup (#20003)
* start cleanup

* fan speed

* cleanup dm

* fix cereal

* hwType -> pandaType

* update refs

* update refs

* bump cereal

* freeSpacePercent

* cereal master
2021-02-03 19:57:30 -08:00
Dean Lee 13ea8b5fc9
move global connected_once into function static (#19999) 2021-02-02 14:39:19 +01:00
Dean Lee 3fde3a5f7d
pigeon_thread: ensure the pigeon->init() will not be called twice (#19963)
* ensure init is not called twice

* add space
2021-01-31 12:55:11 -08:00
Dean Lee b0c8ce4863
pigeon_publish_raw: use capnp::Data::Reader instead of Builder (#19952) 2021-01-30 19:16:21 -08:00
Dean Lee 4d6584a315
boardd: remove global variables spoofing_started&fake_send (#19966) 2021-01-31 00:02:03 +01:00
Dean Lee dd3a260676
boardd: refactor usb_connect, delete panda on failure (#19956) 2021-01-29 13:10:56 +01:00
Dean Lee c4215d8476
Panda: refactor get_firmware_version, return std::optional<std::vector> (#19896)
Co-authored-by: Willem Melching <willem.melching@gmail.com>
2021-01-28 16:25:05 +01:00
Dean Lee 96cc633d91
panda: refactor get_serial, return std::optional<std::string> (#19895) 2021-01-28 16:21:18 +01:00
Dean Lee 511bad6a9f
fix indentation (#19925) 2021-01-26 14:43:37 -08:00
Dean Lee 0f8b5db8ce
boardd: use setUbloxRaw to avoid memory alloc&copy in pigeon_publish_raw (#19884)
* use setUbloxRaw to avoid memory copy

* const std::string &dat
2021-01-26 17:21:02 +01:00
Dean Lee b0c0de5b66
Fix panda: dangling pointer problem in can_receive (#19892)
* refactor can_receive

* still send empty msg
2021-01-26 16:04:38 +01:00
Dean Lee 83003bdeac
boardd: use std::atomic for ignition to ensure thread-safety (#19882) 2021-01-22 15:26:27 -08:00
Dean Lee 2df9736bb2
boardd: declare MessageBuilder close to usage (#19883) 2021-01-22 15:25:54 -08:00
Dean Lee 595830135b
merge utilpp.h into util.h (#19710) 2021-01-10 14:57:32 -08:00
Willem Melching 0cdb9e8658
Fix battery voltage reading (#19699)
* tici: correct battery voltage

* read current

* use current too
2021-01-08 17:21:58 +01:00
Dean Lee 86fe2d1697
common exit handler (#19661)
* common signal handle

* fix typo

* rename to ExitHandler

* remove include signal.h

* remove include csignal

* rename variable exit to v

* rebase master
2021-01-05 20:19:53 -08:00
Adeeb Shihadeh 87950eb312
setup clang tidy (#19533)
* setup clang tidy

* config

* some cleanup

* little more

* remove that

* fix qcom build
2021-01-05 12:50:23 -08:00
Dean Lee c1cf0882bd
Replace usleep with util::sleep_for (#19643)
* replace usleep with sleep_for

* sleep microseconds

* sleep nanoseconds

* Trigger Build
2021-01-04 18:03:11 +01:00
Adeeb Shihadeh ffa7e0cbdb
manager tests + make all processes exit cleanly (#19595)
* manager tests

* logcatd exits cleanly

* sigint

* boardd

* multiple dbus connections hangs for some reason

* clocksd proclogd

* network type from thermal

* fix tests

* fix android logcatd

* fix mac

* fix mac proclogd

* move on device athena tests

* build first

* build first

Co-authored-by: Comma Device <device@comma.ai>
2020-12-29 22:32:03 -08:00
robbederks 80dbda5342
Don't re-init pigeon while offroad (#2687)
* don't re-init pigeon while offroad

* we don't need this
2020-12-03 17:54:46 +01:00
Willem Melching ff65dc1401
Stricter check on date for RTC time sync (#2582)
* More strict check on time

* Also update thermald
2020-11-20 11:47:39 +01:00
Shane Smiskol 5eea86cbf4
Abstract set_unsafe_mode function to Panda (#2431)
* Abstract set_unsafe_mode function to panda.cc

* whoops

* use uint16_t
2020-10-28 13:21:07 -07:00
Willem Melching 2e182e5c57
Params refactor, simplified (#2300)
* always c++

* Create C++ params class

* get works

* tests hang now

* passes tests

* cleanup string formatting

* handle interrupt in blocking read

* fix memory leak

* remove unused constructor

* Use delete_db_value directly

* Rename put -> write_db_value

* filename cleanup

* no semicolons in cython

* Update common/SConscript

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

* add std::string version of delete_db_value

* This is handled

* cleanup encoding

* Add clear method to clear all

* add persistent params

* fix android build

* Should be called clear_all

* only import params when needed

* set params path on manager import

* recusrively create directories

* Fix function order

* cleanup mkdirp

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
2020-10-13 16:23:23 +02:00
eFini ea81d36c41
white/grey/black pandas still have power ctrl function (#2308) 2020-10-12 13:58:36 +02:00
Willem Melching cfd16faad2
boardd always send can packet (#2307)
* boardd always send message

* Only log missed cycles when ignition is on

* Just clip, no completely different code paths
2020-10-09 12:45:43 +02:00
Adeeb Shihadeh ef21b83937
Improve realtime performance on NEOS (#2166)
* fix setting core affinity

* dmonitoringd doesn't need rt priority

* android only gets two cores

* model and planner get core 2

* log missed cycle count

* neos update

* prod image

* revert NEOS changes

* still need this
2020-09-16 15:33:12 -07:00
Dean Lee 9fa56b4eab
more messagebuilder (#2162)
* more messagebuilder

* little more

* revert

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2020-09-13 13:00:06 -07:00
Adeeb Shihadeh 4d5733924a
message builder (#2161)
* use custom MessageBuilder from cereal

* use MesageBuilder.toBytes

* bump cereal

* unused

* another one

* fix ui msg

Co-authored-by: deanlee <deanlee3@gmail.com>
2020-09-12 21:48:15 -07:00
Willem Melching 9eb3d89ca2
Thermald cleanup (#2049)
* Thermald cleanup

* no Temps, fix ui formatter

* Fix scaling

* Don't touch that

* typo

* Fix fan control

* Fix if

* change cereal

* Update comment
2020-08-24 14:17:41 +02:00
robbederks c624b40842
more panda fault types (#2036) 2020-08-17 13:02:06 +02:00
robbederks 7555379b2b
Car power integrator + power management refactor (#1994)
* wip, ready to test

* tweaks

* fix

* fix

* fix power monitoring

* fix param writing

* no forced charging on high voltage

* reset capacity on reboot

* don't shutdown unless started seen

* fix unused var warning

* fix linting errors

* time is always valid

* QCOM gate

* Local params

* decimate saving

* fix linting

* rename param

* Log car battery capacity

* fix put_nonblocking

* Added some unit tests

* Add test to docker test list

* fix precommit

* cleanup

* run tests in CI

* bump cereal

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2020-08-17 11:56:27 +02:00
Willem Melching 502cc665e0
Pigeon abstraction layer (#1977)
* pigeon abstraction layer

* Fix string literals

* more generic pigeon class

* add TTYpigon

* nicer tty error handling

* close tty fd on pigeon delete

* pigeon receive return std::string

* use sizeof

* max receive size to prevent infinite loop

* remove namespace

* add unistd include for usleep

* fix is pigeon

* Handle tty error in opening

* fix printing binary strings with dump.py

* fix pigeon build on macos

* Handle errors seperately

Co-authored-by: Comma Device <device@comma.ai>
2020-08-13 10:10:50 +02:00
Comma Device a228c4d0a0 fix boardd build 2020-08-12 09:02:13 +00:00
Willem Melching 80acb32825
Panda abstraction layer in boardd (#1919)
* start on panda abstraction layer

* handle bulk transfer in library

* Safety model abstraction

* Abstract hw type into library

* Handle disconnect

* RTC stuff

* Fan control

* Health

* Panda fw version

* Read serial

* Power saving

* Power mode

* Cleanup pigeon thread init

* Rename safety setter variable name

* Remove comment

* Unused global cleanup

* malloc -> new

* whitespace

* Use std::thread

* Use std::thread for safety setter

* Cleanup igntion_last global

* Heartbeat

* logd

* More global cleanup

* Put back sleep

* ir pwr

* Always broadcast health

* init struct with zeroes

* Fix eon build

* fix race condition

* fix Adeebs comments

* abstract can send and receive
2020-07-31 23:14:31 +02:00
Dean Lee cf1ae581ed
boardd: use enum instead of magic number (#1927) 2020-07-26 14:30:56 -07:00
Dean Lee 1da11c26b6
boardd: Add new functions usb_read, usb_write (#1856)
* add func usb_write&usb_read

* rename cnt to err

* pass in device handle

* use defines for flag values

* consistent spaces

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2020-07-23 17:27:08 +02:00
Dean Lee c788aa99dd
fix buffer overflow (#1871) 2020-07-23 15:52:59 +02:00
Dean Lee 2232efbcd4
boardd: release claimed interface before closing usb (#1855)
* release claimed interface

* pass device handle by reference

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2020-07-23 15:37:28 +02:00
Adeeb Shihadeh eb1aa3d831
Wunused (#1841)
* enable Wunused, first pass

* unused stuff in snpe model

* these are used on phone

* handle sigint and sigterm in modeld

* fix phone build

* camera qcom

* QCOM build works

* delete unused camerad vars

Co-authored-by: Comma Device <device@comma.ai>
2020-07-09 09:25:32 -07:00
Greg Hogan c458f5a5d3
k-line 5 init fault type (#1821)
* k-line 5 baud fault type

* update name

* bump cereal

* fix name

* add missing event
2020-07-06 09:33:16 -07:00
ZwX1616 1036c68251
Reduce C2 dcamera noise at night (#1798) 2020-06-30 19:58:40 -07:00
Willem Melching 16a23c98fa eon needs include for errno 2020-06-23 16:05:47 -07:00
Willem Melching 28110ea880 Set timeouts on boardd and ubloxd receive sockets 2020-06-23 15:56:30 -07:00
Dean Lee fa0b47e6f2
save Reader to local variable to avoid repeating validate the pointer (#1717) 2020-06-19 11:37:31 -07:00
Dean Lee 90d97de74d
add function read_db_bytes (#1662) 2020-06-09 13:46:49 -07:00
Willem Melching 19512315ff
boardd: no conflate on sendcan (#1645) 2020-06-05 14:20:52 -07:00
Jason Young 68531b071c
Reduce scheduler latency for realtime processes (#1638)
* WIP: reduce boardd and other lags

* Copypasta fault

* Silence spurious startup warning

Co-authored-by: Comma Device <device@comma.ai>
2020-06-05 17:09:41 -04:00
Adeeb 7666d99694
Remove common/messaging.h (#1635)
* remove common/messaging.h

* release files
2020-06-05 12:46:49 -07:00
Willem Melching 4cec8bcc30 Fix indentation in board.cc 2020-05-30 10:31:40 -07:00
Yahya Lmallas 3ddbb7fe5b
Call to gmtime is potentially dangerous (#1598)
* Call to gmtime is potentially dangerous

* Revert "Call to gmtime is potentially dangerous"

This reverts commit cc531e4e19.

* Call to gmtime is potentially dangerous

* oops

* not a pointer

* Little identation fix
2020-05-30 10:06:29 -07:00
Willem Melching ab5af232b2
Use C++ version of SubMaster and PubMaster (#1548)
* add PubMaster & SubMaster

remove 'delete msg'

remove headers

* use constructor to initial all submster

* modify drain sockets

* fix typo in ssconscript.remove lines

no checkValid in loggerd

last modify

handle_message:event->&event

fix type

remove heads

event to auto

* new interface

* api changed

* Revert "use constructor to initial all submster"

This reverts commit 73be7ea46250a325ce41d3a0445e34395a2ae692.

* change to new api

* revert loggerd

* dd

* use new PubSub api

* update to new interface

don't modify loggerd

reset panda

reset opendbc

remove empty lines

* switch to new pubMaster

* update to the new inteface

change

remove error code

. to ->

merge paramsd.cc

update panda

fix typo

simplify

fix typo

* Fix build

* always conflate

Co-authored-by: deanlee <deanlee3@gmail.com>
2020-05-21 16:04:33 -07:00
robbederks 71bebc4fca
Ambient light calibration parameters on persist partition (#1429)
* WIP: light sensor persistent params

* fix params writing

* Persistent params argument in C params lib. Fixed symlink flow

* Removed debug prints

* fix boardd

* fix ui

* remove debug print
2020-05-08 19:39:18 -07:00
George Hotz d5ca841b0f Revert "Bypass alignment related copy whenever possible (#1443)"
This reverts commit b225016628.
2020-05-04 09:54:05 -07:00
Erich Moraga c30b3b9fc9
Line # 9 was a duplicate to # 5 (#1451)
Duplicate line...
#include <string.h>
2020-05-02 08:25:17 -07:00
Dean Lee b225016628
Bypass alignment related copy whenever possible (#1443)
remove blank lines

add file messagehelp.h

remove blank line

simplify

after review
2020-05-01 19:21:00 -07:00
Willem Melching 02e474580e
Release messaging sockets and context on shutdown (#1391)
* release resources when thread is done

* add white space

* add white space

Co-authored-by: deanlee <deanlee3@gmail.com>
2020-04-17 16:37:34 -07:00
Dean Lee 5967690499
fix build warning: libusb_set_debug is deprecated (#1383)
* fix build warning:libuse_set_debug is deprecated

* use enum LIBUSB_LOG_LEVEL_INFO(3)
2020-04-17 13:39:42 -07:00
Dean Lee dd05d1df83
close usb handle after faile (#1352) 2020-04-13 15:10:47 -07:00
Willem Melching 7d54453f04 No hardcoded bitset size 2020-04-09 13:45:18 -07:00