Merge pull request #949 from commaai/nightly

openpilot v0.7.1
pull/920/merge
Willem Melching 5 years ago committed by GitHub
commit adf25bcb5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .gitignore
  2. 2
      Dockerfile.openpilot
  3. 27
      Pipfile
  4. 1422
      Pipfile.lock
  5. 4
      README.md
  6. 9
      RELEASES.md
  7. 9
      SConstruct
  8. BIN
      apk/ai.comma.plus.frame.apk
  9. BIN
      apk/ai.comma.plus.offroad.apk
  10. 2
      cereal/.gitignore
  11. 42
      cereal/README.md
  12. 4
      cereal/SConscript
  13. 20
      cereal/car.capnp
  14. 11
      cereal/log.capnp
  15. 12
      cereal/messaging/__init__.py
  16. 2
      cereal/messaging/bridge.cc
  17. 17
      cereal/messaging/impl_msgq.cc
  18. 24
      cereal/messaging/messaging.cc
  19. 24
      cereal/messaging/msgq.cc
  20. 4
      cereal/service_list.yaml
  21. 22
      common/android.py
  22. 22
      common/logging_extra.py
  23. 4
      common/params.py
  24. 24
      common/spinner.py
  25. 8
      common/transformations/camera.py
  26. 10
      installer/updater/update.json
  27. 47
      launch_chffrplus.sh
  28. BIN
      models/driving_model.dlc
  29. BIN
      models/monitoring_model_q.dlc
  30. BIN
      models/posenet.dlc
  31. BIN
      models/supercombo.dlc
  32. 1
      opendbc/.gitignore
  33. 10
      opendbc/acura_ilx_2016_can_generated.dbc
  34. 9
      opendbc/acura_rdx_2018_can_generated.dbc
  35. 3
      opendbc/azure-pipelines.yml
  36. 11
      opendbc/can/packer_pyx_setup.py
  37. 12
      opendbc/can/parser_pyx_setup.py
  38. 13
      opendbc/can/tests/test_generator.sh
  39. 14
      opendbc/generator/honda/_bosch_2018.dbc
  40. 15
      opendbc/generator/honda/_honda_2017.dbc
  41. 3
      opendbc/generator/honda/acura_ilx_2016_can.dbc
  42. 2
      opendbc/generator/honda/acura_rdx_2018_can.dbc
  43. 7
      opendbc/generator/honda/honda_civic_touring_2016_can.dbc
  44. 2
      opendbc/generator/honda/honda_crv_touring_2016_can.dbc
  45. 3
      opendbc/generator/honda/honda_fit_ex_2018_can.dbc
  46. 3
      opendbc/generator/honda/honda_fit_hybrid_2018_can.dbc
  47. 3
      opendbc/generator/honda/honda_odyssey_exl_2018.dbc
  48. 7
      opendbc/generator/honda/honda_odyssey_extreme_edition_2018_china_can.dbc
  49. 3
      opendbc/generator/honda/honda_pilot_touring_2017_can.dbc
  50. 3
      opendbc/generator/honda/honda_ridgeline_black_edition_2017_can.dbc
  51. 14
      opendbc/honda_accord_lx15t_2018_can_generated.dbc
  52. 14
      opendbc/honda_accord_s2t_2018_can_generated.dbc
  53. 14
      opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc
  54. 14
      opendbc/honda_civic_touring_2016_can_generated.dbc
  55. 14
      opendbc/honda_crv_ex_2017_can_generated.dbc
  56. 14
      opendbc/honda_crv_hybrid_2019_can_generated.dbc
  57. 9
      opendbc/honda_crv_touring_2016_can_generated.dbc
  58. 10
      opendbc/honda_fit_ex_2018_can_generated.dbc
  59. 3
      opendbc/honda_fit_hybrid_2018_can_generated.dbc
  60. 14
      opendbc/honda_insight_ex_2019_can_generated.dbc
  61. 10
      opendbc/honda_odyssey_exl_2018_generated.dbc
  62. 14
      opendbc/honda_odyssey_extreme_edition_2018_china_can_generated.dbc
  63. 10
      opendbc/honda_pilot_touring_2017_can_generated.dbc
  64. 10
      opendbc/honda_ridgeline_black_edition_2017_can_generated.dbc
  65. 8
      panda/README.md
  66. 2
      panda/VERSION
  67. 24
      panda/board/boards/grey.h
  68. 3
      panda/board/drivers/can.h
  69. 13
      panda/board/main.c
  70. BIN
      panda/board/obj/panda.bin.signed
  71. 6
      panda/board/provision.h
  72. 122
      panda/board/safety.h
  73. 5
      panda/board/safety/safety_cadillac.h
  74. 16
      panda/board/safety/safety_chrysler.h
  75. 3
      panda/board/safety/safety_defaults.h
  76. 2
      panda/board/safety/safety_elm327.h
  77. 3
      panda/board/safety/safety_ford.h
  78. 23
      panda/board/safety/safety_gm.h
  79. 1
      panda/board/safety/safety_gm_ascm.h
  80. 283
      panda/board/safety/safety_honda.h
  81. 27
      panda/board/safety/safety_hyundai.h
  82. 5
      panda/board/safety/safety_mazda.h
  83. 16
      panda/board/safety/safety_subaru.h
  84. 3
      panda/board/safety/safety_tesla.h
  85. 132
      panda/board/safety/safety_toyota.h
  86. 5
      panda/board/safety/safety_toyota_ipas.h
  87. 20
      panda/board/safety/safety_volkswagen.h
  88. 42
      panda/board/safety_declarations.h
  89. 8
      panda/board/spi_flasher.h
  90. 10
      panda/drivers/windows/ECUsim CLI/ECUsim CLI.vcxproj
  91. 10
      panda/drivers/windows/ECUsim DLL/ECUsim DLL.vcxproj
  92. 2
      panda/drivers/windows/README.md
  93. 10
      panda/drivers/windows/panda/panda.vcxproj
  94. 6
      panda/drivers/windows/pandaJ2534DLL Test/pandaJ2534DLL Test.vcxproj
  95. 2
      panda/drivers/windows/pandaJ2534DLL/MessageRx.h
  96. 2
      panda/drivers/windows/pandaJ2534DLL/PandaJ2534Device.cpp
  97. 6
      panda/drivers/windows/pandaJ2534DLL/pandaJ2534DLL.vcxproj
  98. 10
      panda/drivers/windows/panda_playground/panda_playground.vcxproj
  99. 18
      panda/drivers/windows/panda_shared/panda.h
  100. 4
      panda/drivers/windows/redist/vscruntimeinfo.nsh.sample
  101. Some files were not shown because too many files have changed in this diff Show More

5
.gitignore vendored

@ -3,11 +3,14 @@ venv/
.tags .tags
.ipynb_checkpoints .ipynb_checkpoints
.idea .idea
.overlay_init
.overlay_consistent
.sconsign.dblite .sconsign.dblite
.vscode .vscode
model2.png model2.png
a.out a.out
*.dylib
*.DSYM *.DSYM
*.d *.d
*.pyc *.pyc
@ -27,6 +30,7 @@ a.out
config.json config.json
clcache clcache
persist
board/obj/ board/obj/
selfdrive/boardd/boardd selfdrive/boardd/boardd
selfdrive/logcatd/logcatd selfdrive/logcatd/logcatd
@ -51,4 +55,5 @@ panda_jungle
.coverage* .coverage*
htmlcov htmlcov
pandaextra

@ -17,12 +17,14 @@ RUN apt-get update && apt-get install -y \
libffi-dev \ libffi-dev \
libglew-dev \ libglew-dev \
libgles2-mesa-dev \ libgles2-mesa-dev \
libglfw3-dev \
libglib2.0-0 \ libglib2.0-0 \
liblzma-dev \ liblzma-dev \
libmysqlclient-dev \ libmysqlclient-dev \
libomp-dev \ libomp-dev \
libopencv-dev \ libopencv-dev \
libssl-dev \ libssl-dev \
libsqlite3-dev \
libtool \ libtool \
libusb-1.0-0-dev \ libusb-1.0-0-dev \
libzmq5-dev \ libzmq5-dev \

@ -8,71 +8,54 @@ opencv-python= "==3.4.2.17"
PyQt5 = "*" PyQt5 = "*"
ipython = "*" ipython = "*"
networkx = "==2.3" networkx = "==2.3"
azure-common = "==1.1.23" azure-core = "==1.1.1"
azure-common = "==1.1.24"
azure-nspkg = "==3.0.2" azure-nspkg = "==3.0.2"
azure-storage-blob = "==2.1.0" azure-storage-blob = "==2.1.0"
azure-storage-common = "==2.1.0" azure-storage-common = "==2.1.0"
azure-storage-nspkg = "==3.1.0" azure-storage-nspkg = "==3.1.0"
bincopy = "*"
bleach = "*"
boto = "*" boto = "*"
"boto3" = "*" "boto3" = "*"
celery = "*"
control = "*" control = "*"
datadog = "*" datadog = "*"
decorator = "*"
dlib = "*" dlib = "*"
dominate = "*"
elasticsearch = "*" elasticsearch = "*"
fasteners = "*"
future = "*" future = "*"
futures = "*" futures = "*"
gevent = "*"
pycocotools = {git = "https://github.com/cocodataset/cocoapi.git",subdirectory = "PythonAPI"} pycocotools = {git = "https://github.com/cocodataset/cocoapi.git",subdirectory = "PythonAPI"}
gunicorn = "*" gunicorn = "*"
"h5py" = "*" "h5py" = "*"
hexdump = "*" hexdump = "*"
"html5lib" = "*" "html5lib" = "*"
imageio = "*" imageio = "*"
intervaltree = "*"
ipykernel = "*" ipykernel = "*"
joblib = "*" joblib = "*"
json-logging-py = "*" json-logging-py = "*"
jupyter = "*" jupyter = "*"
libarchive = "*" libarchive = "*"
lru-dict = "*" lru-dict = "*"
lxml = "*"
"mpld3" = "*" "mpld3" = "*"
msgpack-python = "*" msgpack-python = "*"
nbstripout = "*" nbstripout = "*"
nose-parameterized = "*"
numpy = "*" numpy = "*"
osmium = "*" osmium = "*"
pbr = "*" pbr = "*"
percache = "*" percache = "*"
pprofile = "*" pprofile = "*"
psutil = "*"
pycurl = "*" pycurl = "*"
git-pylint-commit-hook = "*" git-pylint-commit-hook = "*"
pymongo = "*" pymongo = "*"
"pynmea2" = "*" "pynmea2" = "*"
pypolyline = "*" pypolyline = "*"
pysendfile = "*"
python-logstash = "*" python-logstash = "*"
pyvcd = "*"
redis = "*" redis = "*"
redlock = "*"
"s2sphere" = "*" "s2sphere" = "*"
scikit-image = "*" scikit-image = "*"
"subprocess32" = "*" "subprocess32" = "*"
supervisor = "*"
tenacity = "*" tenacity = "*"
tensorflow-gpu = "" tensorflow-gpu = ""
utm = "*"
"v4l2" = "*"
PyJWT = "==1.4.1" PyJWT = "==1.4.1"
PyMySQL = "==0.9.2" PyMySQL = "==0.9.2"
Theano = "*"
Werkzeug = "*" Werkzeug = "*"
"backports.lzma" = "*" "backports.lzma" = "*"
Flask-Cors = "*" Flask-Cors = "*"
@ -84,7 +67,6 @@ PyNaCl = "*"
reverse_geocoder = "*" reverse_geocoder = "*"
Shapely = "*" Shapely = "*"
SQLAlchemy = "*" SQLAlchemy = "*"
uWSGI = "*"
scipy = "*" scipy = "*"
fastcluster = "*" fastcluster = "*"
backports-abc = "*" backports-abc = "*"
@ -92,15 +74,13 @@ pygame = "*"
simplejson = "*" simplejson = "*"
python-logstash-async = "*" python-logstash-async = "*"
seaborn = "*" seaborn = "*"
tensorflow-estimator = "*"
pyproj = "*" pyproj = "*"
mock = "*" mock = "*"
blinker = "*"
gast = "==0.2.2"
matplotlib = "*" matplotlib = "*"
dictdiffer = "*" dictdiffer = "*"
aenum = "*" aenum = "*"
coverage = "*" coverage = "*"
azure-cli-core = "*"
[packages] [packages]
overpy = {git = "https://github.com/commaai/python-overpy.git",ref = "f86529af402d4642e1faeb146671c40284007323"} overpy = {git = "https://github.com/commaai/python-overpy.git",ref = "f86529af402d4642e1faeb146671c40284007323"}
@ -144,6 +124,5 @@ pillow = "*"
scons = "*" scons = "*"
cysignals = "*" cysignals = "*"
[requires] [requires]
python_version = "3.7.3" python_version = "3.7.3"

1422
Pipfile.lock generated

File diff suppressed because it is too large Load Diff

@ -57,7 +57,7 @@ openpilot should preserve all other vehicle's stock features, including, but are
Supported Hardware Supported Hardware
------ ------
At the moment, openpilot supports the [EON DevKit](https://comma.ai/shop/products/eon-dashcam-devkit). A [car harness](https://comma.ai/shop/products/car-harness) is recommended to connect the EON to the car. In the future, we'd like to support other platforms as well. At the moment, openpilot supports the [EON DevKit](https://comma.ai/shop/products/eon-dashcam-devkit) and the [comma two](https://comma.ai/shop/products/comma-two-devkit). A [car harness](https://comma.ai/shop/products/car-harness) is recommended to connect the EON or comma two to the car. In the future, we'd like to support other platforms as well, like gaming PCs.
Supported Cars Supported Cars
------ ------
@ -159,6 +159,8 @@ Limitations of openpilot ALC and LDW
openpilot ALC and openpilot LDW do not automatically drive the vehicle or reduce the amount of attention that must be paid to operate your vehicle. The driver must always keep control of the steering wheel and be ready to correct the openpilot ALC action at all times. openpilot ALC and openpilot LDW do not automatically drive the vehicle or reduce the amount of attention that must be paid to operate your vehicle. The driver must always keep control of the steering wheel and be ready to correct the openpilot ALC action at all times.
While changing lanes, openpilot is not capable of looking next to you or checking your blind spot. Only nudge the wheel to initiate a lane change after you have confirmed it's safe to do so.
Many factors can impact the performance of openpilot ALC and openpilot LDW, causing them to be unable to function as intended. These include, but are not limited to: Many factors can impact the performance of openpilot ALC and openpilot LDW, causing them to be unable to function as intended. These include, but are not limited to:
* Poor visibility (heavy rain, snow, fog, etc.) or weather conditions that may interfere with sensor operation. * Poor visibility (heavy rain, snow, fog, etc.) or weather conditions that may interfere with sensor operation.

@ -1,3 +1,12 @@
Version 0.7.1 (2020-01-20)
========================
* comma two support!
* Lane Change Assist above 45 mph!
* Replace zmq with custom messaging library, msgq!
* Supercombo model: calibration and driving models are combined for better lead estimate
* More robust updater thanks to jyoung8607! Requires NEOS update
* Improve low speed ACC tuning
Version 0.7 (2019-12-13) Version 0.7 (2019-12-13)
======================== ========================
* Move to SCons build system! * Move to SCons build system!

@ -46,6 +46,7 @@ else:
"#phonelibs/capnp-cpp/include", "#phonelibs/capnp-cpp/include",
"#phonelibs/capnp-c/include", "#phonelibs/capnp-c/include",
"#phonelibs/zmq/x64/include", "#phonelibs/zmq/x64/include",
"#external/tensorflow/include",
] ]
libpath = [ libpath = [
"#phonelibs/capnp-cpp/x64/lib", "#phonelibs/capnp-cpp/x64/lib",
@ -55,6 +56,7 @@ else:
"#phonelibs/zmq/x64/lib", "#phonelibs/zmq/x64/lib",
"#phonelibs/libyuv/x64/lib", "#phonelibs/libyuv/x64/lib",
"#external/zmq/lib", "#external/zmq/lib",
"#external/tensorflow/lib",
"#cereal", "#cereal",
"#selfdrive/common", "#selfdrive/common",
"/usr/lib", "/usr/lib",
@ -62,6 +64,7 @@ else:
] ]
rpath = ["phonelibs/capnp-cpp/x64/lib", rpath = ["phonelibs/capnp-cpp/x64/lib",
"external/tensorflow/lib",
"cereal", "cereal",
"selfdrive/common"] "selfdrive/common"]
@ -201,11 +204,13 @@ SConscript(['selfdrive/controls/lib/longitudinal_mpc/SConscript'])
SConscript(['selfdrive/boardd/SConscript']) SConscript(['selfdrive/boardd/SConscript'])
SConscript(['selfdrive/proclogd/SConscript']) SConscript(['selfdrive/proclogd/SConscript'])
SConscript(['selfdrive/ui/SConscript'])
SConscript(['selfdrive/loggerd/SConscript'])
if arch == "aarch64": if arch == "aarch64":
SConscript(['selfdrive/logcatd/SConscript']) SConscript(['selfdrive/logcatd/SConscript'])
SConscript(['selfdrive/ui/SConscript'])
SConscript(['selfdrive/sensord/SConscript']) SConscript(['selfdrive/sensord/SConscript'])
SConscript(['selfdrive/loggerd/SConscript']) SConscript(['selfdrive/clocksd/SConscript'])
SConscript(['selfdrive/locationd/SConscript']) SConscript(['selfdrive/locationd/SConscript'])

Binary file not shown.

Binary file not shown.

2
cereal/.gitignore vendored

@ -10,5 +10,5 @@ libmessaging.*
libmessaging_shared.* libmessaging_shared.*
services.h services.h
.sconsign.dblite .sconsign.dblite
libcereal_shared.so libcereal_shared.*

@ -0,0 +1,42 @@
What is cereal?
----
cereal is both a messaging spec for robotics systems as well as generic high performance IPC pub sub messaging with a single publisher and multiple subscribers.
Imagine this use case:
* A sensor process reads gyro measurements directly from an IMU and publishes a sensorEvents packet
* A calibration process subscribes to the sensorEvents packet to use the IMU
* A localization process subscribes to the sensorEvents packet to use the IMU also
Messaging Spec
----
You'll find the message types in [log.capnp](log.capnp). It uses [Cap'n proto](https://capnproto.org/capnp-tool.html) and defines one struct called Event.
All Events have a logMonoTime and a valid. Then a big union defines the packet type.
Pub Sub Backends
----
cereal supports two backends, one based on [zmq](https://zeromq.org/), the other called msgq, a custom pub sub based on shared memory that doesn't require the bytes to pass through the kernel.
Example
---
```python
import cereal.messaging as messaging
# in subscriber
sm = messaging.SubMaster(['sensorEvents'])
while 1:
sm.update()
print(sm['sensorEvents'])
# in publisher
pm = messaging.PubMaster(['sensorEvents'])
dat = messaging.new_message()
dat.init('sensorEvents', 1)
dat.sensorEvents[0] = {"gyro": {"v": [0.1, -0.1, 0.1]}}
pm.send('sensorEvents', dat)
```

@ -29,7 +29,7 @@ cereal_objects = env.SharedObject([
]) ])
env.Library('cereal', cereal_objects) env.Library('cereal', cereal_objects)
env.SharedLibrary('cereal_shared', cereal_objects) env.SharedLibrary('cereal_shared', cereal_objects, LIBS=["capnp_c"])
cereal_dir = Dir('.') cereal_dir = Dir('.')
services_h = env.Command( services_h = env.Command(
@ -49,7 +49,7 @@ Depends('messaging/impl_zmq.cc', services_h)
# note, this rebuilds the deps shared, zmq is statically linked to make APK happy # note, this rebuilds the deps shared, zmq is statically linked to make APK happy
# TODO: get APK to load system zmq to remove the static link # TODO: get APK to load system zmq to remove the static link
shared_lib_shared_lib = [zmq, 'm', 'stdc++'] + ["gnustl_shared"] if arch == "aarch64" else [] shared_lib_shared_lib = [zmq, 'm', 'stdc++'] + ["gnustl_shared"] if arch == "aarch64" else [zmq]
env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib) env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib)
env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq']) env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq'])

@ -88,6 +88,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
lowMemory @63; lowMemory @63;
stockAeb @64; stockAeb @64;
ldw @65; ldw @65;
carUnrecognized @66;
radarCommIssue @67;
} }
} }
@ -410,11 +412,11 @@ struct CarParams {
enum SafetyModel { enum SafetyModel {
silent @0; silent @0;
honda @1; hondaNidec @1;
toyota @2; toyota @2;
elm327 @3; elm327 @3;
gm @4; gm @4;
hondaBosch @5; hondaBoschGiraffe @5;
ford @6; ford @6;
cadillac @7; cadillac @7;
hyundai @8; hyundai @8;
@ -428,7 +430,9 @@ struct CarParams {
toyotaIpas @16; toyotaIpas @16;
allOutput @17; allOutput @17;
gmAscm @18; gmAscm @18;
noOutput @19; # like silent but with silent CAN TXs noOutput @19; # like silent but without silent CAN TXs
hondaBoschHarness @20;
volkswagenPq @21;
} }
enum SteerControlType { enum SteerControlType {
@ -444,7 +448,9 @@ struct CarParams {
struct CarFw { struct CarFw {
ecu @0 :Ecu; ecu @0 :Ecu;
fwVersion @1 :Text; fwVersion @1 :Data;
address @2: UInt32;
subAddress @3: UInt8;
} }
enum Ecu { enum Ecu {
@ -452,5 +458,11 @@ struct CarParams {
esp @1; esp @1;
fwdRadar @2; fwdRadar @2;
fwdCamera @3; fwdCamera @3;
engine @4;
unknown @5;
# Toyota only
dsu @6;
apgs @7;
} }
} }

@ -310,6 +310,7 @@ struct HealthData {
hasGps @6 :Bool; hasGps @6 :Bool;
canSendErrs @7 :UInt32; canSendErrs @7 :UInt32;
canFwdErrs @8 :UInt32; canFwdErrs @8 :UInt32;
canRxErrs @19 :UInt32;
gmlanSendErrs @9 :UInt32; gmlanSendErrs @9 :UInt32;
hwType @10 :HwType; hwType @10 :HwType;
fanSpeedRpm @11 :UInt16; fanSpeedRpm @11 :UInt16;
@ -484,6 +485,7 @@ struct ControlsState @0x97ff69c53601abf1 {
decelForTurn @47 :Bool; decelForTurn @47 :Bool;
decelForModel @54 :Bool; decelForModel @54 :Bool;
canErrorCounter @57 :UInt32;
lateralControlState :union { lateralControlState :union {
indiState @52 :LateralINDIState; indiState @52 :LateralINDIState;
@ -575,6 +577,7 @@ struct ModelData {
leadFuture @7 :LeadData; leadFuture @7 :LeadData;
speed @8 :List(Float32); speed @8 :List(Float32);
meta @10 :MetaData; meta @10 :MetaData;
longitudinal @11 :LongitudinalData;
struct PathData { struct PathData {
points @0 :List(Float32); points @0 :List(Float32);
@ -605,6 +608,7 @@ struct ModelData {
yuvCorrection @5 :List(Float32); yuvCorrection @5 :List(Float32);
inputTransform @6 :List(Float32); inputTransform @6 :List(Float32);
} }
struct MetaData { struct MetaData {
engagedProb @0 :Float32; engagedProb @0 :Float32;
desirePrediction @1 :List(Float32); desirePrediction @1 :List(Float32);
@ -612,6 +616,11 @@ struct ModelData {
gasDisengageProb @3 :Float32; gasDisengageProb @3 :Float32;
steerOverrideProb @4 :Float32; steerOverrideProb @4 :Float32;
} }
struct LongitudinalData {
speeds @0 :List(Float32);
accelerations @1 :List(Float32);
}
} }
struct CalibrationFeatures { struct CalibrationFeatures {
@ -1757,6 +1766,8 @@ struct DriverMonitoring {
leftBlinkProb @8 :Float32; leftBlinkProb @8 :Float32;
rightBlinkProb @9 :Float32; rightBlinkProb @9 :Float32;
irPwrDEPRECATED @10 :Float32; irPwrDEPRECATED @10 :Float32;
faceOrientationStd @11 :List(Float32);
facePositionStd @12 :List(Float32);
} }
struct Boot { struct Boot {

@ -1,6 +1,7 @@
# must be build with scons # must be build with scons
from .messaging_pyx import Context, Poller, SubSocket, PubSocket # pylint: disable=no-name-in-module, import-error from .messaging_pyx import Context, Poller, SubSocket, PubSocket # pylint: disable=no-name-in-module, import-error
from .messaging_pyx import MultiplePublishersError, MessagingError # pylint: disable=no-name-in-module, import-error from .messaging_pyx import MultiplePublishersError, MessagingError # pylint: disable=no-name-in-module, import-error
import capnp
assert MultiplePublishersError assert MultiplePublishersError
assert MessagingError assert MessagingError
@ -116,6 +117,7 @@ def recv_one_retry(sock):
if dat is not None: if dat is not None:
return log.Event.from_bytes(dat) return log.Event.from_bytes(dat)
# TODO: This does not belong in messaging
def get_one_can(logcan): def get_one_can(logcan):
while True: while True:
can = recv_one_retry(logcan) can = recv_one_retry(logcan)
@ -147,12 +149,12 @@ class SubMaster():
self.freq[s] = service_list[s].frequency self.freq[s] = service_list[s].frequency
data = new_message() data = new_message()
if s in ['can', 'sensorEvents', 'liveTracks', 'sendCan', try:
'ethernetData', 'cellInfo', 'wifiScan',
'trafficEvents', 'orbObservation', 'carEvents']:
data.init(s, 0)
else:
data.init(s) data.init(s)
except capnp.lib.capnp.KjException:
# lists
data.init(s, 0)
self.data[s] = getattr(data, s) self.data[s] = getattr(data, s)
self.logMonoTime[s] = 0 self.logMonoTime[s] = 0
self.valid[s] = data.valid self.valid[s] = data.valid

@ -4,6 +4,8 @@
#include <csignal> #include <csignal>
#include <map> #include <map>
typedef void (*sighandler_t)(int sig);
#include "services.h" #include "services.h"
#include "impl_msgq.hpp" #include "impl_msgq.hpp"

@ -85,7 +85,6 @@ Message * MSGQSubSocket::receive(bool non_blocking){
msgq_msg_t msg; msgq_msg_t msg;
MSGQMessage *r = NULL; MSGQMessage *r = NULL;
r = NULL;
int rc = msgq_msg_recv(&msg, q); int rc = msgq_msg_recv(&msg, q);
@ -109,17 +108,23 @@ Message * MSGQSubSocket::receive(bool non_blocking){
} }
} }
if (rc > 0){
r = new MSGQMessage;
r->takeOwnership(msg.data, msg.size);
}
errno = msgq_do_exit ? EINTR : 0;
if (!non_blocking){ if (!non_blocking){
std::signal(SIGINT, prev_handler_sigint); std::signal(SIGINT, prev_handler_sigint);
std::signal(SIGTERM, prev_handler_sigterm); std::signal(SIGTERM, prev_handler_sigterm);
} }
errno = msgq_do_exit ? EINTR : 0;
if (rc > 0){
if (msgq_do_exit){
msgq_msg_close(&msg); // Free unused message on exit
} else {
r = new MSGQMessage;
r->takeOwnership(msg.data, msg.size);
}
}
return (Message*)r; return (Message*)r;
} }

@ -4,20 +4,20 @@
Context * Context::create(){ Context * Context::create(){
Context * c; Context * c;
if (std::getenv("MSGQ")){ if (std::getenv("ZMQ")){
c = new MSGQContext();
} else {
c = new ZMQContext(); c = new ZMQContext();
} else {
c = new MSGQContext();
} }
return c; return c;
} }
SubSocket * SubSocket::create(){ SubSocket * SubSocket::create(){
SubSocket * s; SubSocket * s;
if (std::getenv("MSGQ")){ if (std::getenv("ZMQ")){
s = new MSGQSubSocket();
} else {
s = new ZMQSubSocket(); s = new ZMQSubSocket();
} else {
s = new MSGQSubSocket();
} }
return s; return s;
} }
@ -60,10 +60,10 @@ SubSocket * SubSocket::create(Context * context, std::string endpoint, std::stri
PubSocket * PubSocket::create(){ PubSocket * PubSocket::create(){
PubSocket * s; PubSocket * s;
if (std::getenv("MSGQ")){ if (std::getenv("ZMQ")){
s = new MSGQPubSocket();
} else {
s = new ZMQPubSocket(); s = new ZMQPubSocket();
} else {
s = new MSGQPubSocket();
} }
return s; return s;
} }
@ -82,10 +82,10 @@ PubSocket * PubSocket::create(Context * context, std::string endpoint){
Poller * Poller::create(){ Poller * Poller::create(){
Poller * p; Poller * p;
if (std::getenv("MSGQ")){ if (std::getenv("ZMQ")){
p = new MSGQPoller();
} else {
p = new ZMQPoller(); p = new ZMQPoller();
} else {
p = new MSGQPoller();
} }
return p; return p;
} }

@ -23,8 +23,8 @@
#include "msgq.hpp" #include "msgq.hpp"
void sigusr1_handler(int signal) { void sigusr2_handler(int signal) {
assert(signal == SIGUSR1); assert(signal == SIGUSR2);
} }
uint64_t msgq_get_uid(void){ uint64_t msgq_get_uid(void){
@ -80,7 +80,7 @@ void msgq_wait_for_subscriber(msgq_queue_t *q){
int msgq_new_queue(msgq_queue_t * q, const char * path, size_t size){ int msgq_new_queue(msgq_queue_t * q, const char * path, size_t size){
assert(size < 0xFFFFFFFF); // Buffer must be smaller than 2^32 bytes assert(size < 0xFFFFFFFF); // Buffer must be smaller than 2^32 bytes
std::signal(SIGUSR1, sigusr1_handler); std::signal(SIGUSR2, sigusr2_handler);
const char * prefix = "/dev/shm/"; const char * prefix = "/dev/shm/";
char * full_path = new char[strlen(path) + strlen(prefix) + 1]; char * full_path = new char[strlen(path) + strlen(prefix) + 1];
@ -136,7 +136,7 @@ void msgq_close_queue(msgq_queue_t *q){
void msgq_init_publisher(msgq_queue_t * q) { void msgq_init_publisher(msgq_queue_t * q) {
std::cout << "Starting publisher" << std::endl; //std::cout << "Starting publisher" << std::endl;
uint64_t uid = msgq_get_uid(); uint64_t uid = msgq_get_uid();
*q->write_uid = uid; *q->write_uid = uid;
@ -150,6 +150,15 @@ void msgq_init_publisher(msgq_queue_t * q) {
q->write_uid_local = uid; q->write_uid_local = uid;
} }
static void thread_signal(uint32_t tid) {
#ifndef SYS_tkill
// TODO: this won't work for multithreaded programs
kill(tid, SIGUSR2);
#else
syscall(SYS_tkill, tid, SIGUSR2);
#endif
}
void msgq_init_subscriber(msgq_queue_t * q) { void msgq_init_subscriber(msgq_queue_t * q) {
assert(q != NULL); assert(q != NULL);
assert(q->num_readers != NULL); assert(q->num_readers != NULL);
@ -173,7 +182,7 @@ void msgq_init_subscriber(msgq_queue_t * q) {
*q->read_uids[i] = 0; *q->read_uids[i] = 0;
// Wake up reader in case they are in a poll // Wake up reader in case they are in a poll
syscall(SYS_tkill, old_uid & 0xFFFFFFFF, SIGUSR1); thread_signal(old_uid & 0xFFFFFFFF);
} }
continue; continue;
@ -196,7 +205,7 @@ void msgq_init_subscriber(msgq_queue_t * q) {
} }
} }
std::cout << "New subscriber id: " << q->reader_id << " uid: " << q->read_uid_local << " " << q->endpoint << std::endl; //std::cout << "New subscriber id: " << q->reader_id << " uid: " << q->read_uid_local << " " << q->endpoint << std::endl;
msgq_reset_reader(q); msgq_reset_reader(q);
} }
@ -278,8 +287,7 @@ int msgq_msg_send(msgq_msg_t * msg, msgq_queue_t *q){
// Notify readers // Notify readers
for (uint64_t i = 0; i < num_readers; i++){ for (uint64_t i = 0; i < num_readers; i++){
uint64_t reader_uid = *q->read_uids[i]; uint64_t reader_uid = *q->read_uids[i];
thread_signal(reader_uid & 0xFFFFFFFF);
syscall(SYS_tkill, reader_uid & 0xFFFFFFFF, SIGUSR1);
} }
return msg->size; return msg->size;

@ -25,7 +25,7 @@ encodeIdx: [8015, true, 20.]
liveTracks: [8016, true, 20.] liveTracks: [8016, true, 20.]
sendcan: [8017, true, 100.] sendcan: [8017, true, 100.]
logMessage: [8018, true, 0.] logMessage: [8018, true, 0.]
liveCalibration: [8019, true, 5.] liveCalibration: [8019, true, 4., 4]
androidLog: [8020, true, 0.] androidLog: [8020, true, 0.]
carState: [8021, true, 100., 10] carState: [8021, true, 100., 10]
# 8022 is reserved for sshd # 8022 is reserved for sshd
@ -68,7 +68,7 @@ orbFeaturesSummary: [8062, true, 0.]
driverMonitoring: [8063, true, 5., 1] driverMonitoring: [8063, true, 5., 1]
liveParameters: [8064, true, 10.] liveParameters: [8064, true, 10.]
liveMapData: [8065, true, 0.] liveMapData: [8065, true, 0.]
cameraOdometry: [8066, true, 5.] cameraOdometry: [8066, true, 20.]
pathPlan: [8067, true, 20.] pathPlan: [8067, true, 20.]
kalmanOdometry: [8068, true, 0.] kalmanOdometry: [8068, true, 0.]
thumbnail: [8069, true, 0.2, 1] thumbnail: [8069, true, 0.2, 1]

@ -1,20 +1,32 @@
import os
import binascii import binascii
import itertools import itertools
import re import re
import struct import struct
import subprocess import subprocess
ANDROID = os.path.isfile('/EON')
def getprop(key): def getprop(key):
if not ANDROID:
return ""
return subprocess.check_output(["getprop", key], encoding='utf8').strip() return subprocess.check_output(["getprop", key], encoding='utf8').strip()
def get_imei(): def get_imei(slot):
ret = getprop("oem.device.imeicache") slot = str(slot)
if ret == "": if slot not in ("0", "1"):
raise ValueError("SIM slot must be 0 or 1")
ret = parse_service_call_string(["iphonesubinfo", "3" ,"i32", str(slot)])
if not ret:
ret = "000000000000000" ret = "000000000000000"
return ret return ret
def get_serial(): def get_serial():
return getprop("ro.serialno") ret = getprop("ro.serialno")
if ret == "":
ret = "cccccccc"
return ret
def get_subscriber_info(): def get_subscriber_info():
ret = parse_service_call_string(["iphonesubinfo", "7"]) ret = parse_service_call_string(["iphonesubinfo", "7"])
@ -60,6 +72,8 @@ def parse_service_call_string(call):
return None return None
def parse_service_call_bytes(call): def parse_service_call_bytes(call):
if not ANDROID:
return None
ret = subprocess.check_output(["service", "call", *call], encoding='utf8').strip() ret = subprocess.check_output(["service", "call", *call], encoding='utf8').strip()
if 'Parcel' not in ret: if 'Parcel' not in ret:
return None return None

@ -78,28 +78,6 @@ class SwagLogger(logging.Logger):
self.log_local = local() self.log_local = local()
self.log_local.ctx = {} self.log_local.ctx = {}
def findCaller(self, stack_info=None):
"""
Find the stack frame of the caller so that we can note the source
file name, line number and function name.
"""
# f = currentframe()
f = sys._getframe(3)
#On some versions of IronPython, currentframe() returns None if
#IronPython isn't run with -X:Frames.
if f is not None:
f = f.f_back
rv = "(unknown file)", 0, "(unknown function)"
while hasattr(f, "f_code"):
co = f.f_code
filename = os.path.normcase(co.co_filename)
if filename in (logging._srcfile, _srcfile):
f = f.f_back
continue
rv = (co.co_filename, f.f_lineno, co.co_name)
break
return rv
def local_ctx(self): def local_ctx(self):
try: try:
return self.log_local.ctx return self.log_local.ctx

@ -69,9 +69,10 @@ keys = {
"IsLdwEnabled": [TxType.PERSISTENT], "IsLdwEnabled": [TxType.PERSISTENT],
"IsGeofenceEnabled": [TxType.PERSISTENT], "IsGeofenceEnabled": [TxType.PERSISTENT],
"IsMetric": [TxType.PERSISTENT], "IsMetric": [TxType.PERSISTENT],
"IsOffroad": [TxType.CLEAR_ON_MANAGER_START],
"IsRHD": [TxType.PERSISTENT], "IsRHD": [TxType.PERSISTENT],
"IsTakingSnapshot": [TxType.CLEAR_ON_MANAGER_START], "IsTakingSnapshot": [TxType.CLEAR_ON_MANAGER_START],
"IsUpdateAvailable": [TxType.PERSISTENT], "IsUpdateAvailable": [TxType.CLEAR_ON_MANAGER_START],
"IsUploadRawEnabled": [TxType.PERSISTENT], "IsUploadRawEnabled": [TxType.PERSISTENT],
"LastUpdateTime": [TxType.PERSISTENT], "LastUpdateTime": [TxType.PERSISTENT],
"LimitSetSpeed": [TxType.PERSISTENT], "LimitSetSpeed": [TxType.PERSISTENT],
@ -80,6 +81,7 @@ keys = {
"LongitudinalControl": [TxType.PERSISTENT], "LongitudinalControl": [TxType.PERSISTENT],
"OpenpilotEnabledToggle": [TxType.PERSISTENT], "OpenpilotEnabledToggle": [TxType.PERSISTENT],
"PandaFirmware": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT], "PandaFirmware": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
"PandaFirmwareHex": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
"PandaDongleId": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT], "PandaDongleId": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
"Passive": [TxType.PERSISTENT], "Passive": [TxType.PERSISTENT],
"RecordFront": [TxType.PERSISTENT], "RecordFront": [TxType.PERSISTENT],

@ -5,21 +5,31 @@ from common.basedir import BASEDIR
class Spinner(): class Spinner():
def __init__(self): def __init__(self):
self.spinner_proc = subprocess.Popen(["./spinner"], try:
stdin=subprocess.PIPE, self.spinner_proc = subprocess.Popen(["./spinner"],
cwd=os.path.join(BASEDIR, "selfdrive", "ui", "spinner"), stdin=subprocess.PIPE,
close_fds=True) cwd=os.path.join(BASEDIR, "selfdrive", "ui", "spinner"),
close_fds=True)
except OSError:
self.spinner_proc = None
def __enter__(self): def __enter__(self):
return self return self
def update(self, spinner_text): def update(self, spinner_text):
self.spinner_proc.stdin.write(spinner_text.encode('utf8') + b"\n") if self.spinner_proc is not None:
self.spinner_proc.stdin.flush() self.spinner_proc.stdin.write(spinner_text.encode('utf8') + b"\n")
try:
self.spinner_proc.stdin.flush()
except BrokenPipeError:
pass
def close(self): def close(self):
if self.spinner_proc is not None: if self.spinner_proc is not None:
self.spinner_proc.stdin.close() try:
self.spinner_proc.stdin.close()
except BrokenPipeError:
pass
self.spinner_proc.terminate() self.spinner_proc.terminate()
self.spinner_proc = None self.spinner_proc = None

@ -44,6 +44,7 @@ def get_calib_from_vp(vp):
roll_calib = 0 roll_calib = 0
return roll_calib, pitch_calib, yaw_calib return roll_calib, pitch_calib, yaw_calib
# aka 'extrinsic_matrix' # aka 'extrinsic_matrix'
# road : x->forward, y -> left, z->up # road : x->forward, y -> left, z->up
def get_view_frame_from_road_frame(roll, pitch, yaw, height): def get_view_frame_from_road_frame(roll, pitch, yaw, height):
@ -61,6 +62,13 @@ def vp_from_ke(m):
""" """
return (m[0, 0]/m[2,0], m[1,0]/m[2,0]) return (m[0, 0]/m[2,0], m[1,0]/m[2,0])
def vp_from_rpy(rpy):
e = get_view_frame_from_road_frame(rpy[0], rpy[1], rpy[2], 1.22)
ke = np.dot(eon_intrinsics, e)
return vp_from_ke(ke)
def roll_from_ke(m): def roll_from_ke(m):
# note: different from calibration.h/RollAnglefromKE: i think that one's just wrong # note: different from calibration.h/RollAnglefromKE: i think that one's just wrong
return np.arctan2(-(m[1, 0] - m[1, 1] * m[2, 0] / m[2, 1]), return np.arctan2(-(m[1, 0] - m[1, 1] * m[2, 0] / m[2, 1]),

@ -1,7 +1,7 @@
{ {
"ota_url": "https://commadist.azureedge.net/neosupdate/ota-signed-07df505453684371b6c22583ffbb74ee414fcd389a46ff369ffd1b6bac75414e.zip", "ota_url": "https://commadist.azureedge.net/neosupdate/ota-signed-efdf7de63b1aef63d68301e6175930991bf9a5927d16ec6fcc69287e2ee7ca4a.zip",
"ota_hash": "07df505453684371b6c22583ffbb74ee414fcd389a46ff369ffd1b6bac75414e", "ota_hash": "efdf7de63b1aef63d68301e6175930991bf9a5927d16ec6fcc69287e2ee7ca4a",
"recovery_url": "https://commadist.azureedge.net/neosupdate/recovery-3a6f973295ded6e4ff5cfff3b12e19c80d3bf45e2e8dd8699da3fc25b23ed7c6.img", "recovery_url": "https://commadist.azureedge.net/neosupdate/recovery-97c27e6ed04ed6bb0608b845a2d4100912093f9380c3f2ba6b56bccd608e5f6e.img",
"recovery_len": 15848748, "recovery_len": 15861036,
"recovery_hash": "3a6f973295ded6e4ff5cfff3b12e19c80d3bf45e2e8dd8699da3fc25b23ed7c6" "recovery_hash": "97c27e6ed04ed6bb0608b845a2d4100912093f9380c3f2ba6b56bccd608e5f6e"
} }

@ -6,20 +6,53 @@ export NUMEXPR_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1 export OPENBLAS_NUM_THREADS=1
export VECLIB_MAXIMUM_THREADS=1 export VECLIB_MAXIMUM_THREADS=1
if [ -z "$BASEDIR" ]; then
BASEDIR="/data/openpilot"
fi
if [ -z "$PASSIVE" ]; then if [ -z "$PASSIVE" ]; then
export PASSIVE="1" export PASSIVE="1"
fi fi
STAGING_ROOT="/data/safe_staging"
function launch { function launch {
# Wifi scan # Wifi scan
wpa_cli IFNAME=wlan0 SCAN wpa_cli IFNAME=wlan0 SCAN
# apply update # Check to see if there's a valid overlay-based update available. Conditions
if [ "$(git rev-parse HEAD)" != "$(git rev-parse @{u})" ]; then # are as follows:
git reset --hard @{u} && #
git clean -xdf && # 1. The BASEDIR init file has to exist, with a newer modtime than anything in
# the BASEDIR Git repo. This checks for local development work or the user
# switching branches/forks, which should not be overwritten.
# 2. The FINALIZED consistent file has to exist, indicating there's an update
# that completed successfully and synced to disk.
if [ -f "${BASEDIR}/.overlay_init" ]; then
find ${BASEDIR}/.git -newer ${BASEDIR}/.overlay_init | grep -q '.' 2> /dev/null
if [ $? -eq 0 ]; then
echo "${BASEDIR} has been modified, skipping overlay update installation"
else
if [ -f "${STAGING_ROOT}/finalized/.overlay_consistent" ]; then
if [ ! -d /data/safe_staging/old_openpilot ]; then
echo "Valid overlay update found, installing"
LAUNCHER_LOCATION="${BASH_SOURCE[0]}"
exec "${BASH_SOURCE[0]}" mv $BASEDIR /data/safe_staging/old_openpilot
mv "${STAGING_ROOT}/finalized" $BASEDIR
# The mv changed our working directory to /data/safe_staging/old_openpilot
cd "${BASEDIR}"
echo "Restarting launch script ${LAUNCHER_LOCATION}"
exec "${LAUNCHER_LOCATION}"
else
echo "openpilot backup found, not updating"
# TODO: restore backup? This means the updater didn't start after swapping
fi
fi
fi
fi fi
# no cpu rationing for now # no cpu rationing for now
@ -32,17 +65,17 @@ function launch {
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# Remove old NEOS update file # Remove old NEOS update file
# TODO: move this code to the updater
if [ -d /data/neoupdate ]; then if [ -d /data/neoupdate ]; then
rm -rf /data/neoupdate rm -rf /data/neoupdate
fi fi
# Check for NEOS update # Check for NEOS update
if [ $(< /VERSION) != "13" ]; then if [ $(< /VERSION) != "14" ]; then
if [ -f "$DIR/scripts/continue.sh" ]; then if [ -f "$DIR/scripts/continue.sh" ]; then
cp "$DIR/scripts/continue.sh" "/data/data/com.termux/files/continue.sh" cp "$DIR/scripts/continue.sh" "/data/data/com.termux/files/continue.sh"
fi fi
git clean -xdf
"$DIR/installer/updater/updater" "file://$DIR/installer/updater/update.json" "$DIR/installer/updater/updater" "file://$DIR/installer/updater/update.json"
fi fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,6 +1,7 @@
*.pyc *.pyc
*.os *.os
*.tmp *.tmp
*.dylib
.*.swp .*.swp
can/*.so can/*.so
can/build/ can/build/

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -274,9 +281,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -262,7 +269,7 @@ BO_ 392 GEARBOX: 6 XXX
BO_ 399 STEER_STATUS: 6 EPS BO_ 399 STEER_STATUS: 6 EPS
SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON

@ -14,3 +14,6 @@ steps:
docker run opendbc bash -c "cd opendbc/can/tests/linter_python; PYTHONPATH=/ ./flake8_opendbc.sh" docker run opendbc bash -c "cd opendbc/can/tests/linter_python; PYTHONPATH=/ ./flake8_opendbc.sh"
docker run opendbc bash -c "cd opendbc/can/tests/linter_python; PYTHONPATH=/ ./pylint_opendbc.sh" docker run opendbc bash -c "cd opendbc/can/tests/linter_python; PYTHONPATH=/ ./pylint_opendbc.sh"
displayName: 'Python linter' displayName: 'Python linter'
- script: |
docker run opendbc bash -c "cd opendbc/can/tests/; PYTHONPATH=/ ./test_generator.sh"
displayName: 'Generator test'

@ -1,6 +1,7 @@
import os import os
import sysconfig import sysconfig
import subprocess import subprocess
import platform
from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module
from Cython.Build import cythonize from Cython.Build import cythonize
@ -38,6 +39,10 @@ ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # pyl
if ARCH == "aarch64": if ARCH == "aarch64":
extra_compile_args += ["-Wno-deprecated-register"] extra_compile_args += ["-Wno-deprecated-register"]
if platform.system() == "Darwin":
libdbc = "libdbc.dylib"
else:
libdbc = "libdbc.so"
setup(name='CAN packer', setup(name='CAN packer',
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
@ -52,9 +57,13 @@ setup(name='CAN packer',
os.path.join(BASEDIR, 'phonelibs', 'capnp-cpp/include'), os.path.join(BASEDIR, 'phonelibs', 'capnp-cpp/include'),
], ],
extra_link_args=[ extra_link_args=[
os.path.join(BASEDIR, 'opendbc', 'can', 'libdbc.so'), os.path.join(BASEDIR, 'opendbc', 'can', libdbc),
], ],
) )
), ),
nthreads=4, nthreads=4,
) )
if platform.system() == "Darwin":
os.system("install_name_tool -change opendbc/can/libdbc.dylib "+BASEDIR+"/opendbc/can/libdbc.dylib packer_pyx.so")

@ -1,6 +1,7 @@
import os import os
import subprocess import subprocess
import sysconfig import sysconfig
import platform
from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module from distutils.core import Extension, setup # pylint: disable=import-error,no-name-in-module
from Cython.Build import cythonize from Cython.Build import cythonize
@ -38,6 +39,11 @@ ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # pyl
if ARCH == "aarch64": if ARCH == "aarch64":
extra_compile_args += ["-Wno-deprecated-register"] extra_compile_args += ["-Wno-deprecated-register"]
if platform.system() == "Darwin":
libdbc = "libdbc.dylib"
else:
libdbc = "libdbc.so"
setup(name='CAN parser', setup(name='CAN parser',
cmdclass={'build_ext': BuildExtWithoutPlatformSuffix}, cmdclass={'build_ext': BuildExtWithoutPlatformSuffix},
ext_modules=cythonize( ext_modules=cythonize(
@ -51,9 +57,13 @@ setup(name='CAN parser',
os.path.join(BASEDIR, 'phonelibs', 'capnp-cpp/include'), os.path.join(BASEDIR, 'phonelibs', 'capnp-cpp/include'),
], ],
extra_link_args=[ extra_link_args=[
os.path.join(BASEDIR, 'opendbc', 'can', 'libdbc.so'), os.path.join(BASEDIR, 'opendbc', 'can', libdbc),
], ],
) )
), ),
nthreads=4, nthreads=4,
) )
if platform.system() == "Darwin":
os.system("install_name_tool -change opendbc/can/libdbc.dylib "+BASEDIR+"/opendbc/can/libdbc.dylib parser_pyx.so")

@ -0,0 +1,13 @@
#!/bin/bash -e
cd ../../generator/
# run generator
./generator.py
if [ -n "$(git status --untracked-files=no --porcelain)" ]; then
echo "Unexpected changes after running generator.py";
exit 1
else
echo "Success";
fi

@ -64,7 +64,9 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
@ -92,9 +94,10 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
@ -106,6 +109,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 450 EPB_STATUS: 8 EPB BO_ 450 EPB_STATUS: 8 EPB
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON

@ -64,6 +64,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -142,7 +149,7 @@ BO_ 780 ACC_HUD: 8 ADAS
SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY
SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY
SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY
SG_ BOH_2 : 35|1@0+ (1,0) [0|1] "" BDY SG_ FCM_OFF_2 : 35|1@0+ (1,0) [0|1] "" BDY
SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY
SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY
SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY
@ -152,10 +159,12 @@ BO_ 780 ACC_HUD: 8 ADAS
SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY
SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY
SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY
SG_ HUD_DISTANCE_3 : 52|1@0+ (1,0) [0|1] "" BDY
SG_ IMPERIAL_UNIT : 54|1@0+ (1,0) [0|1] "" BDY
SG_ SET_ME_X01_2 : 55|1@0+ (1,0) [0|1] "" BDY SG_ SET_ME_X01_2 : 55|1@0+ (1,0) [0|1] "" BDY
SG_ IMPERIAL_UNIT : 54|1@0+ (1,0) [0|1] "" BDY
SG_ HUD_DISTANCE_3 : 52|1@0+ (1,0) [0|1] "" BDY
SG_ CHIME : 51|3@0+ (1,0) [0|1] "" BDY
SG_ SET_ME_X01 : 48|1@0+ (1,0) [0|1] "" BDY SG_ SET_ME_X01 : 48|1@0+ (1,0) [0|1] "" BDY
SG_ ICONS : 63|2@0+ (1,0) [0|1] "" BDY
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY

@ -27,9 +27,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -15,7 +15,7 @@ BO_ 392 GEARBOX: 6 XXX
BO_ 399 STEER_STATUS: 6 EPS BO_ 399 STEER_STATUS: 6 EPS
SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON

@ -25,16 +25,19 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -9,7 +9,7 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 6 EPS BO_ 399 STEER_STATUS: 6 EPS
SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON
SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON

@ -27,9 +27,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -27,9 +27,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -19,9 +19,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -12,11 +12,12 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-2985|2985] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-2985|2985] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ STEER_STATUS : 43|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 43|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
BO_ 401 GEARBOX: 8 PCM BO_ 401 GEARBOX: 8 PCM
SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON

@ -27,9 +27,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -22,9 +22,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -68,7 +68,9 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
@ -96,9 +98,10 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
@ -110,6 +113,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 450 EPB_STATUS: 8 EPB BO_ 450 EPB_STATUS: 8 EPB
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON

@ -68,7 +68,9 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
@ -96,9 +98,10 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
@ -110,6 +113,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 450 EPB_STATUS: 8 EPB BO_ 450 EPB_STATUS: 8 EPB
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON

@ -68,7 +68,9 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
@ -96,9 +98,10 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
@ -110,6 +113,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 450 EPB_STATUS: 8 EPB BO_ 450 EPB_STATUS: 8 EPB
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -272,16 +279,19 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -68,7 +68,9 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
@ -96,9 +98,10 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
@ -110,6 +113,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 450 EPB_STATUS: 8 EPB BO_ 450 EPB_STATUS: 8 EPB
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON

@ -68,7 +68,9 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
@ -96,9 +98,10 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
@ -110,6 +113,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 450 EPB_STATUS: 8 EPB BO_ 450 EPB_STATUS: 8 EPB
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -256,7 +263,7 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 6 EPS BO_ 399 STEER_STATUS: 6 EPS
SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|12@0- (-1,0) [-2047.5|2047.5] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 36|1@0+ (1,0) [0|1] "" EON
SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 35|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -274,9 +281,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -266,9 +266,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -68,7 +68,9 @@ BO_ 304 GAS_PEDAL_2: 8 PCM
BO_ 330 STEERING_SENSORS: 8 EPS BO_ 330 STEERING_SENSORS: 8 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON
SG_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON
SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON
SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
@ -96,9 +98,10 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
@ -110,6 +113,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 450 EPB_STATUS: 8 EPB BO_ 450 EPB_STATUS: 8 EPB
SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON
SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -266,9 +273,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -259,11 +266,12 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-2985|2985] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-2985|2985] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ STEER_STATUS : 43|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 43|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
BO_ 401 GEARBOX: 8 PCM BO_ 401 GEARBOX: 8 PCM
SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -274,9 +281,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -86,6 +86,13 @@ BO_ 420 VSA_STATUS: 8 VSA
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 427 STEER_MOTOR_TORQUE: 3 EPS
SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON
SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON
SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON
BO_ 432 STANDSTILL: 7 VSA BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
@ -269,9 +276,10 @@ BO_ 342 STEERING_SENSORS: 6 EPS
BO_ 399 STEER_STATUS: 7 EPS BO_ 399 STEER_STATUS: 7 EPS
SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON
SG_ STEER_TORQUE_MOTOR : 23|16@0- (-1,0) [-31000|31000] "tbd" EON SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON
SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON
SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON
SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON

@ -39,9 +39,11 @@ Find user made scripts on the [wiki](https://community.comma.ai/wiki/index.php/P
Note that you may have to setup [udev rules](https://community.comma.ai/wiki/index.php/Panda#Linux_udev_rules) for Linux, such as Note that you may have to setup [udev rules](https://community.comma.ai/wiki/index.php/Panda#Linux_udev_rules) for Linux, such as
``` ```
sudo -i sudo tee /etc/udev/rules.d/11-panda.rules <<EOF
echo 'SUBSYSTEMS=="usb", ATTR{idVendor}=="bbaa", ATTR{idProduct}=="ddcc", MODE:="0666"' > /etc/udev/rules.d/11-panda.rules SUBSYSTEM=="usb", ATTRS{idVendor}=="bbaa", ATTRS{idProduct}=="ddcc", MODE="0666"
exit SUBSYSTEM=="usb", ATTRS{idVendor}=="bbaa", ATTRS{idProduct}=="ddee", MODE="0666"
EOF
sudo udevadm control --reload-rules && sudo udevadm trigger
``` ```
Usage (JavaScript) Usage (JavaScript)

@ -1 +1 @@
v1.7.0 v1.7.3

@ -11,6 +11,28 @@ void grey_init(void) {
current_board->set_esp_gps_mode(ESP_GPS_ENABLED); current_board->set_esp_gps_mode(ESP_GPS_ENABLED);
} }
void grey_set_esp_gps_mode(uint8_t mode) {
switch (mode) {
case ESP_GPS_DISABLED:
// GPS OFF
set_gpio_output(GPIOC, 14, 0);
set_gpio_output(GPIOC, 5, 0);
break;
case ESP_GPS_ENABLED:
// GPS ON
set_gpio_output(GPIOC, 14, 1);
set_gpio_output(GPIOC, 5, 1);
break;
case ESP_GPS_BOOTMODE:
set_gpio_output(GPIOC, 14, 1);
set_gpio_output(GPIOC, 5, 0);
break;
default:
puts("Invalid ESP/GPS mode\n");
break;
}
}
const board board_grey = { const board board_grey = {
.board_type = "Grey", .board_type = "Grey",
.harness_config = &white_harness_config, .harness_config = &white_harness_config,
@ -19,7 +41,7 @@ const board board_grey = {
.enable_can_transcievers = white_enable_can_transcievers, .enable_can_transcievers = white_enable_can_transcievers,
.set_led = white_set_led, .set_led = white_set_led,
.set_usb_power_mode = white_set_usb_power_mode, .set_usb_power_mode = white_set_usb_power_mode,
.set_esp_gps_mode = white_set_esp_gps_mode, .set_esp_gps_mode = grey_set_esp_gps_mode,
.set_can_mode = white_set_can_mode, .set_can_mode = white_set_can_mode,
.usb_power_mode_tick = white_usb_power_mode_tick, .usb_power_mode_tick = white_usb_power_mode_tick,
.check_ignition = white_check_ignition, .check_ignition = white_check_ignition,

@ -14,6 +14,7 @@ typedef struct {
#define BUS_MAX 4U #define BUS_MAX 4U
uint32_t can_rx_errs = 0;
uint32_t can_send_errs = 0; uint32_t can_send_errs = 0;
uint32_t can_fwd_errs = 0; uint32_t can_fwd_errs = 0;
uint32_t gmlan_send_errs = 0; uint32_t gmlan_send_errs = 0;
@ -381,7 +382,7 @@ void can_rx(uint8_t can_number) {
can_send(&to_send, bus_fwd_num, true); can_send(&to_send, bus_fwd_num, true);
} }
safety_rx_hook(&to_push); can_rx_errs += safety_rx_hook(&to_push) ? 0U : 1U;
ignition_can_hook(&to_push); ignition_can_hook(&to_push);
current_board->set_led(LED_BLUE, true); current_board->set_led(LED_BLUE, true);

@ -45,6 +45,7 @@ struct __attribute__((packed)) health_t {
uint32_t uptime_pkt; uint32_t uptime_pkt;
uint32_t voltage_pkt; uint32_t voltage_pkt;
uint32_t current_pkt; uint32_t current_pkt;
uint32_t can_rx_errs_pkt;
uint32_t can_send_errs_pkt; uint32_t can_send_errs_pkt;
uint32_t can_fwd_errs_pkt; uint32_t can_fwd_errs_pkt;
uint32_t gmlan_send_errs_pkt; uint32_t gmlan_send_errs_pkt;
@ -170,6 +171,7 @@ int get_health_pkt(void *dat) {
health->controls_allowed_pkt = controls_allowed; health->controls_allowed_pkt = controls_allowed;
health->gas_interceptor_detected_pkt = gas_interceptor_detected; health->gas_interceptor_detected_pkt = gas_interceptor_detected;
health->can_rx_errs_pkt = can_rx_errs;
health->can_send_errs_pkt = can_send_errs; health->can_send_errs_pkt = can_send_errs;
health->can_fwd_errs_pkt = can_fwd_errs; health->can_fwd_errs_pkt = can_fwd_errs;
health->gmlan_send_errs_pkt = gmlan_send_errs; health->gmlan_send_errs_pkt = gmlan_send_errs;
@ -475,12 +477,6 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
can_init(CAN_NUM_FROM_BUS_NUM(setup->b.wValue.w)); can_init(CAN_NUM_FROM_BUS_NUM(setup->b.wValue.w));
} }
break; break;
// **** 0xdf: set long controls allowed
case 0xdf:
if (hardwired) {
long_controls_allowed = setup->b.wValue.w & 1U;
}
break;
// **** 0xe0: uart read // **** 0xe0: uart read
case 0xe0: case 0xe0:
ur = get_ring_by_number(setup->b.wValue.w); ur = get_ring_by_number(setup->b.wValue.w);
@ -671,7 +667,7 @@ void __attribute__ ((noinline)) enable_fpu(void) {
#define EON_HEARTBEAT_IGNITION_CNT_ON 5U #define EON_HEARTBEAT_IGNITION_CNT_ON 5U
#define EON_HEARTBEAT_IGNITION_CNT_OFF 2U #define EON_HEARTBEAT_IGNITION_CNT_OFF 2U
// called once per second // called at 1Hz
void TIM1_BRK_TIM9_IRQ_Handler(void) { void TIM1_BRK_TIM9_IRQ_Handler(void) {
if (TIM9->SR != 0) { if (TIM9->SR != 0) {
can_live = pending_can_live; can_live = pending_can_live;
@ -740,6 +736,9 @@ void TIM1_BRK_TIM9_IRQ_Handler(void) {
uptime_cnt += 1U; uptime_cnt += 1U;
safety_mode_cnt += 1U; safety_mode_cnt += 1U;
ignition_can_cnt += 1U; ignition_can_cnt += 1U;
// synchronous safety check
safety_tick(current_hooks);
} }
TIM9->SR = 0; TIM9->SR = 0;
} }

Binary file not shown.

@ -11,3 +11,9 @@ void get_provision_chunk(uint8_t *resp) {
} }
} }
uint8_t chunk[PROVISION_CHUNK_LEN];
bool is_provisioned(void) {
(void)memcpy(chunk, (uint8_t *)0x1fff79e0, PROVISION_CHUNK_LEN);
return (memcmp(chunk, "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", 0x20) != 0);
}

@ -19,11 +19,11 @@
// from cereal.car.CarParams.SafetyModel // from cereal.car.CarParams.SafetyModel
#define SAFETY_SILENT 0U #define SAFETY_SILENT 0U
#define SAFETY_HONDA 1U #define SAFETY_HONDA_NIDEC 1U
#define SAFETY_TOYOTA 2U #define SAFETY_TOYOTA 2U
#define SAFETY_ELM327 3U #define SAFETY_ELM327 3U
#define SAFETY_GM 4U #define SAFETY_GM 4U
#define SAFETY_HONDA_BOSCH 5U #define SAFETY_HONDA_BOSCH_GIRAFFE 5U
#define SAFETY_FORD 6U #define SAFETY_FORD 6U
#define SAFETY_CADILLAC 7U #define SAFETY_CADILLAC 7U
#define SAFETY_HYUNDAI 8U #define SAFETY_HYUNDAI 8U
@ -36,12 +36,13 @@
#define SAFETY_ALLOUTPUT 17U #define SAFETY_ALLOUTPUT 17U
#define SAFETY_GM_ASCM 18U #define SAFETY_GM_ASCM 18U
#define SAFETY_NOOUTPUT 19U #define SAFETY_NOOUTPUT 19U
#define SAFETY_HONDA_BOSCH_HARNESS 20U
uint16_t current_safety_mode = SAFETY_SILENT; uint16_t current_safety_mode = SAFETY_SILENT;
const safety_hooks *current_hooks = &nooutput_hooks; const safety_hooks *current_hooks = &nooutput_hooks;
void safety_rx_hook(CAN_FIFOMailBox_TypeDef *to_push){ int safety_rx_hook(CAN_FIFOMailBox_TypeDef *to_push){
current_hooks->rx(to_push); return current_hooks->rx(to_push);
} }
int safety_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { int safety_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
@ -56,7 +57,7 @@ int safety_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return current_hooks->fwd(bus_num, to_fwd); return current_hooks->fwd(bus_num, to_fwd);
} }
bool addr_allowed(int addr, int bus, const AddrBus addr_list[], int len) { bool msg_allowed(int addr, int bus, const AddrBus addr_list[], int len) {
bool allowed = false; bool allowed = false;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
if ((addr == addr_list[i].addr) && (bus == addr_list[i].bus)) { if ((addr == addr_list[i].addr) && (bus == addr_list[i].bus)) {
@ -67,6 +68,106 @@ bool addr_allowed(int addr, int bus, const AddrBus addr_list[], int len) {
return allowed; return allowed;
} }
// compute the time elapsed (in microseconds) from 2 counter samples
// case where ts < ts_last is ok: overflow is properly re-casted into uint32_t
uint32_t get_ts_elapsed(uint32_t ts, uint32_t ts_last) {
return ts - ts_last;
}
int get_addr_check_index(CAN_FIFOMailBox_TypeDef *to_push, AddrCheckStruct addr_list[], const int len) {
int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push);
int index = -1;
for (int i = 0; i < len; i++) {
for (uint8_t j = 0U; addr_list[i].addr[j] != 0; j++) {
if ((addr == addr_list[i].addr[j]) && (bus == addr_list[i].bus)) {
index = i;
goto Return;
}
}
}
Return:
return index;
}
// 1Hz safety function called by main. Now just a check for lagging safety messages
void safety_tick(const safety_hooks *hooks) {
uint32_t ts = TIM2->CNT;
if (hooks->addr_check != NULL) {
for (int i=0; i < hooks->addr_check_len; i++) {
uint32_t elapsed_time = get_ts_elapsed(ts, hooks->addr_check[i].last_timestamp);
// lag threshold is max of: 1s and MAX_MISSED_MSGS * expected timestep.
// Quite conservative to not risk false triggers.
// 2s of lag is worse case, since the function is called at 1Hz
bool lagging = elapsed_time > MAX(hooks->addr_check[i].expected_timestep * MAX_MISSED_MSGS, 1e6);
hooks->addr_check[i].lagging = lagging;
if (lagging) {
controls_allowed = 0;
}
}
}
}
void update_counter(AddrCheckStruct addr_list[], int index, uint8_t counter) {
if (index != -1) {
uint8_t expected_counter = (addr_list[index].last_counter + 1U) % (addr_list[index].max_counter + 1U);
addr_list[index].wrong_counters += (expected_counter == counter) ? -1 : 1;
addr_list[index].wrong_counters = MAX(MIN(addr_list[index].wrong_counters, MAX_WRONG_COUNTERS), 0);
addr_list[index].last_counter = counter;
}
}
bool is_msg_valid(AddrCheckStruct addr_list[], int index) {
bool valid = true;
if (index != -1) {
if ((!addr_list[index].valid_checksum) || (addr_list[index].wrong_counters >= MAX_WRONG_COUNTERS)) {
valid = false;
controls_allowed = 0;
}
}
return valid;
}
void update_addr_timestamp(AddrCheckStruct addr_list[], int index) {
if (index != -1) {
uint32_t ts = TIM2->CNT;
addr_list[index].last_timestamp = ts;
}
}
bool addr_safety_check(CAN_FIFOMailBox_TypeDef *to_push,
AddrCheckStruct *rx_checks,
const int rx_checks_len,
uint8_t (*get_checksum)(CAN_FIFOMailBox_TypeDef *to_push),
uint8_t (*compute_checksum)(CAN_FIFOMailBox_TypeDef *to_push),
uint8_t (*get_counter)(CAN_FIFOMailBox_TypeDef *to_push)) {
int index = get_addr_check_index(to_push, rx_checks, rx_checks_len);
update_addr_timestamp(rx_checks, index);
if (index != -1) {
// checksum check
if ((get_checksum != NULL) && (compute_checksum != NULL)) {
if (rx_checks[index].check_checksum) {
uint8_t checksum = get_checksum(to_push);
uint8_t checksum_comp = compute_checksum(to_push);
rx_checks[index].valid_checksum = checksum_comp == checksum;
}
}
// counter check
if (get_counter != NULL) {
if (rx_checks[index].max_counter > 0U) {
uint8_t counter = get_counter(to_push);
update_counter(rx_checks, index, counter);
}
}
}
return is_msg_valid(rx_checks, index);
}
typedef struct { typedef struct {
uint16_t id; uint16_t id;
const safety_hooks *hooks; const safety_hooks *hooks;
@ -74,11 +175,12 @@ typedef struct {
const safety_hook_config safety_hook_registry[] = { const safety_hook_config safety_hook_registry[] = {
{SAFETY_SILENT, &nooutput_hooks}, {SAFETY_SILENT, &nooutput_hooks},
{SAFETY_HONDA, &honda_hooks}, {SAFETY_HONDA_NIDEC, &honda_nidec_hooks},
{SAFETY_TOYOTA, &toyota_hooks}, {SAFETY_TOYOTA, &toyota_hooks},
{SAFETY_ELM327, &elm327_hooks}, {SAFETY_ELM327, &elm327_hooks},
{SAFETY_GM, &gm_hooks}, {SAFETY_GM, &gm_hooks},
{SAFETY_HONDA_BOSCH, &honda_bosch_hooks}, {SAFETY_HONDA_BOSCH_GIRAFFE, &honda_bosch_giraffe_hooks},
{SAFETY_HONDA_BOSCH_HARNESS, &honda_bosch_harness_hooks},
{SAFETY_HYUNDAI, &hyundai_hooks}, {SAFETY_HYUNDAI, &hyundai_hooks},
{SAFETY_CHRYSLER, &chrysler_hooks}, {SAFETY_CHRYSLER, &chrysler_hooks},
{SAFETY_SUBARU, &subaru_hooks}, {SAFETY_SUBARU, &subaru_hooks},
@ -113,12 +215,6 @@ int set_safety_hooks(uint16_t mode, int16_t param) {
return set_status; return set_status;
} }
// compute the time elapsed (in microseconds) from 2 counter samples
// case where ts < ts_last is ok: overflow is properly re-casted into uint32_t
uint32_t get_ts_elapsed(uint32_t ts, uint32_t ts_last) {
return ts - ts_last;
}
// convert a trimmed integer to signed 32 bit int // convert a trimmed integer to signed 32 bit int
int to_signed(int d, int bits) { int to_signed(int d, int bits) {
int d_signed = d; int d_signed = d;

@ -23,7 +23,7 @@ int cadillac_get_torque_idx(int addr, int array_size) {
return MIN(MAX(addr - 0x151, 0), array_size); // 0x151 is id 0, 0x152 is id 1 and so on... return MIN(MAX(addr - 0x151, 0), array_size); // 0x151 is id 0, 0x152 is id 1 and so on...
} }
static void cadillac_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int cadillac_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -51,6 +51,7 @@ static void cadillac_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
if ((addr == 0x152) || (addr == 0x154)) { if ((addr == 0x152) || (addr == 0x154)) {
cadillac_supercruise_on = (GET_BYTE(to_push, 4) & 0x10) != 0; cadillac_supercruise_on = (GET_BYTE(to_push, 4) & 0x10) != 0;
} }
return 1;
} }
static int cadillac_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { static int cadillac_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
@ -58,7 +59,7 @@ static int cadillac_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
if (!addr_allowed(addr, bus, CADILLAC_TX_MSGS, sizeof(CADILLAC_TX_MSGS) / sizeof(CADILLAC_TX_MSGS[0]))) { if (!msg_allowed(addr, bus, CADILLAC_TX_MSGS, sizeof(CADILLAC_TX_MSGS) / sizeof(CADILLAC_TX_MSGS[0]))) {
tx = 0; tx = 0;
} }

@ -6,13 +6,20 @@ const int CHRYSLER_MAX_RATE_DOWN = 3;
const int CHRYSLER_MAX_TORQUE_ERROR = 80; // max torque cmd in excess of torque motor const int CHRYSLER_MAX_TORQUE_ERROR = 80; // max torque cmd in excess of torque motor
const AddrBus CHRYSLER_TX_MSGS[] = {{571, 0}, {658, 0}, {678, 0}}; const AddrBus CHRYSLER_TX_MSGS[] = {{571, 0}, {658, 0}, {678, 0}};
// TODO: do checksum and counter checks
AddrCheckStruct chrysler_rx_checks[] = {
{.addr = {544}, .bus = 0, .expected_timestep = 10000U},
{.addr = {500}, .bus = 0, .expected_timestep = 20000U},
};
const int CHRYSLER_RX_CHECK_LEN = sizeof(chrysler_rx_checks) / sizeof(chrysler_rx_checks[0]);
int chrysler_rt_torque_last = 0; int chrysler_rt_torque_last = 0;
int chrysler_desired_torque_last = 0; int chrysler_desired_torque_last = 0;
int chrysler_cruise_engaged_last = 0; int chrysler_cruise_engaged_last = 0;
uint32_t chrysler_ts_last = 0; uint32_t chrysler_ts_last = 0;
struct sample_t chrysler_torque_meas; // last few torques measured struct sample_t chrysler_torque_meas; // last few torques measured
static void chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -36,10 +43,13 @@ static void chrysler_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
chrysler_cruise_engaged_last = cruise_engaged; chrysler_cruise_engaged_last = cruise_engaged;
} }
// TODO: add gas pressed check
// check if stock camera ECU is on bus 0 // check if stock camera ECU is on bus 0
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && (addr == 0x292)) { if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && (addr == 0x292)) {
relay_malfunction = true; relay_malfunction = true;
} }
return 1;
} }
static int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { static int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
@ -48,7 +58,7 @@ static int chrysler_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
if (!addr_allowed(addr, bus, CHRYSLER_TX_MSGS, sizeof(CHRYSLER_TX_MSGS) / sizeof(CHRYSLER_TX_MSGS[0]))) { if (!msg_allowed(addr, bus, CHRYSLER_TX_MSGS, sizeof(CHRYSLER_TX_MSGS) / sizeof(CHRYSLER_TX_MSGS[0]))) {
tx = 0; tx = 0;
} }
@ -137,4 +147,6 @@ const safety_hooks chrysler_hooks = {
.tx = chrysler_tx_hook, .tx = chrysler_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = chrysler_fwd_hook, .fwd = chrysler_fwd_hook,
.addr_check = chrysler_rx_checks,
.addr_check_len = sizeof(chrysler_rx_checks) / sizeof(chrysler_rx_checks[0]),
}; };

@ -1,5 +1,6 @@
void default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { int default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
UNUSED(to_push); UNUSED(to_push);
return true;
} }
// *** no output safety mode *** // *** no output safety mode ***

@ -12,7 +12,7 @@ static int elm327_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
//Check valid 29 bit send addresses for ISO 15765-4 //Check valid 29 bit send addresses for ISO 15765-4
//Check valid 11 bit send addresses for ISO 15765-4 //Check valid 11 bit send addresses for ISO 15765-4
if ((addr != 0x18DB33F1) && ((addr & 0x1FFF00FF) != 0x18DA00F1) && if ((addr != 0x18DB33F1) && ((addr & 0x1FFF00FF) != 0x18DA00F1) &&
((addr != 0x7DF) && ((addr & 0x1FFFFFF8) != 0x7E0))) { ((addr & 0x1FFFFF00) != 0x700)) {
tx = 0; tx = 0;
} }
return tx; return tx;

@ -11,7 +11,7 @@ int ford_brake_prev = 0;
int ford_gas_prev = 0; int ford_gas_prev = 0;
bool ford_moving = false; bool ford_moving = false;
static void ford_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int ford_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
@ -58,6 +58,7 @@ static void ford_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && (addr == 0x3CA)) { if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && (addr == 0x3CA)) {
relay_malfunction = true; relay_malfunction = true;
} }
return 1;
} }
// all commands: just steering // all commands: just steering

@ -23,6 +23,16 @@ const AddrBus GM_TX_MSGS[] = {{384, 0}, {1033, 0}, {1034, 0}, {715, 0}, {880, 0}
{789, 2}, // ch bus {789, 2}, // ch bus
{0x104c006c, 3}, {0x10400060, 3}}; // gmlan {0x104c006c, 3}, {0x10400060, 3}}; // gmlan
// TODO: do checksum and counter checks. Add correct timestep, 0.1s for now.
AddrCheckStruct gm_rx_checks[] = {
{.addr = {388}, .bus = 0, .expected_timestep = 100000U},
{.addr = {842}, .bus = 0, .expected_timestep = 100000U},
{.addr = {481}, .bus = 0, .expected_timestep = 100000U},
{.addr = {241}, .bus = 0, .expected_timestep = 100000U},
{.addr = {417}, .bus = 0, .expected_timestep = 100000U},
};
const int GM_RX_CHECK_LEN = sizeof(gm_rx_checks) / sizeof(gm_rx_checks[0]);
int gm_brake_prev = 0; int gm_brake_prev = 0;
int gm_gas_prev = 0; int gm_gas_prev = 0;
bool gm_moving = false; bool gm_moving = false;
@ -31,7 +41,7 @@ int gm_desired_torque_last = 0;
uint32_t gm_ts_last = 0; uint32_t gm_ts_last = 0;
struct sample_t gm_torque_driver; // last few driver torques measured struct sample_t gm_torque_driver; // last few driver torques measured
static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -82,7 +92,7 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// exit controls on rising edge of gas press // exit controls on rising edge of gas press
if (addr == 417) { if (addr == 417) {
int gas = GET_BYTE(to_push, 6); int gas = GET_BYTE(to_push, 6);
if (gas && !gm_gas_prev && long_controls_allowed) { if (gas && !gm_gas_prev) {
controls_allowed = 0; controls_allowed = 0;
} }
gm_gas_prev = gas; gm_gas_prev = gas;
@ -103,6 +113,7 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && ((addr == 384) || (addr == 715))) { if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && ((addr == 384) || (addr == 715))) {
relay_malfunction = true; relay_malfunction = true;
} }
return 1;
} }
// all commands: gas/regen, friction brake and steering // all commands: gas/regen, friction brake and steering
@ -117,7 +128,7 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
if (!addr_allowed(addr, bus, GM_TX_MSGS, sizeof(GM_TX_MSGS)/sizeof(GM_TX_MSGS[0]))) { if (!msg_allowed(addr, bus, GM_TX_MSGS, sizeof(GM_TX_MSGS)/sizeof(GM_TX_MSGS[0]))) {
tx = 0; tx = 0;
} }
@ -134,7 +145,7 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
if (addr == 789) { if (addr == 789) {
int brake = ((GET_BYTE(to_send, 0) & 0xFU) << 8) + GET_BYTE(to_send, 1); int brake = ((GET_BYTE(to_send, 0) & 0xFU) << 8) + GET_BYTE(to_send, 1);
brake = (0x1000 - brake) & 0xFFF; brake = (0x1000 - brake) & 0xFFF;
if (!current_controls_allowed || !long_controls_allowed) { if (!current_controls_allowed) {
if (brake != 0) { if (brake != 0) {
tx = 0; tx = 0;
} }
@ -197,7 +208,7 @@ static int gm_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int gas_regen = ((GET_BYTE(to_send, 2) & 0x7FU) << 5) + ((GET_BYTE(to_send, 3) & 0xF8U) >> 3); int gas_regen = ((GET_BYTE(to_send, 2) & 0x7FU) << 5) + ((GET_BYTE(to_send, 3) & 0xF8U) >> 3);
// Disabled message is !engaged with gas // Disabled message is !engaged with gas
// value that corresponds to max regen. // value that corresponds to max regen.
if (!current_controls_allowed || !long_controls_allowed) { if (!current_controls_allowed) {
bool apply = GET_BYTE(to_send, 0) & 1U; bool apply = GET_BYTE(to_send, 0) & 1U;
if (apply || (gas_regen != GM_MAX_REGEN)) { if (apply || (gas_regen != GM_MAX_REGEN)) {
tx = 0; tx = 0;
@ -219,4 +230,6 @@ const safety_hooks gm_hooks = {
.tx = gm_tx_hook, .tx = gm_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = default_fwd_hook, .fwd = default_fwd_hook,
.addr_check = gm_rx_checks,
.addr_check_len = sizeof(gm_rx_checks) / sizeof(gm_rx_checks[0]),
}; };

@ -41,4 +41,3 @@ const safety_hooks gm_ascm_hooks = {
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = gm_ascm_fwd_hook, .fwd = gm_ascm_fwd_hook,
}; };

@ -7,109 +7,165 @@
// brake rising edge // brake rising edge
// brake > 0mph // brake > 0mph
const AddrBus HONDA_N_TX_MSGS[] = {{0xE4, 0}, {0x194, 0}, {0x1FA, 0}, {0x200, 0}, {0x30C, 0}, {0x33D, 0}}; const AddrBus HONDA_N_TX_MSGS[] = {{0xE4, 0}, {0x194, 0}, {0x1FA, 0}, {0x200, 0}, {0x30C, 0}, {0x33D, 0}};
const AddrBus HONDA_BH_TX_MSGS[] = {{0xE4, 0}, {0x296, 1}, {0x33D, 0}}; // Bosch Harness
const AddrBus HONDA_BG_TX_MSGS[] = {{0xE4, 2}, {0x296, 0}, {0x33D, 2}}; // Bosch Giraffe const AddrBus HONDA_BG_TX_MSGS[] = {{0xE4, 2}, {0x296, 0}, {0x33D, 2}}; // Bosch Giraffe
const AddrBus HONDA_BH_TX_MSGS[] = {{0xE4, 0}, {0x296, 1}, {0x33D, 0}}; // Bosch Harness
const int HONDA_GAS_INTERCEPTOR_THRESHOLD = 328; // ratio between offset and gain from dbc file const int HONDA_GAS_INTERCEPTOR_THRESHOLD = 328; // ratio between offset and gain from dbc file
// Nidec and Bosch giraffe have pt on bus 0
AddrCheckStruct honda_rx_checks[] = {
{.addr = {0x1A6, 0x296}, .bus = 0, .check_checksum = true, .max_counter = 3U, .expected_timestep = 40000U},
{.addr = { 0x158}, .bus = 0, .check_checksum = true, .max_counter = 3U, .expected_timestep = 10000U},
{.addr = { 0x17C}, .bus = 0, .check_checksum = true, .max_counter = 3U, .expected_timestep = 10000U},
};
const int HONDA_RX_CHECKS_LEN = sizeof(honda_rx_checks) / sizeof(honda_rx_checks[0]);
// Bosch harness has pt on bus 1
AddrCheckStruct honda_bh_rx_checks[] = {
{.addr = {0x296}, .bus = 1, .check_checksum = true, .max_counter = 3U, .expected_timestep = 40000U},
{.addr = {0x158}, .bus = 1, .check_checksum = true, .max_counter = 3U, .expected_timestep = 10000U},
{.addr = {0x17C}, .bus = 1, .check_checksum = true, .max_counter = 3U, .expected_timestep = 10000U},
};
const int HONDA_BH_RX_CHECKS_LEN = sizeof(honda_bh_rx_checks) / sizeof(honda_bh_rx_checks[0]);
int honda_brake = 0; int honda_brake = 0;
int honda_gas_prev = 0; int honda_gas_prev = 0;
bool honda_brake_pressed_prev = false; bool honda_brake_pressed_prev = false;
bool honda_moving = false; bool honda_moving = false;
bool honda_bosch_hardware = false;
bool honda_alt_brake_msg = false; bool honda_alt_brake_msg = false;
bool honda_fwd_brake = false; bool honda_fwd_brake = false;
enum {HONDA_N_HW, HONDA_BG_HW, HONDA_BH_HW} honda_hw = HONDA_N_HW;
static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int addr = GET_ADDR(to_push); static uint8_t honda_get_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
int checksum_byte = GET_LEN(to_push) - 1;
return (uint8_t)(GET_BYTE(to_push, checksum_byte)) & 0xFU;
}
static uint8_t honda_compute_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
int len = GET_LEN(to_push); int len = GET_LEN(to_push);
int bus = GET_BUS(to_push); uint8_t checksum = 0U;
unsigned int addr = GET_ADDR(to_push);
while (addr > 0U) {
checksum += (addr & 0xFU); addr >>= 4;
}
for (int j = 0; (j < len); j++) {
uint8_t byte = GET_BYTE(to_push, j);
checksum += (byte & 0xFU) + (byte >> 4U);
if (j == (len - 1)) {
checksum -= (byte & 0xFU); // remove checksum in message
}
}
return (8U - checksum) & 0xFU;
}
// sample speed static uint8_t honda_get_counter(CAN_FIFOMailBox_TypeDef *to_push) {
if (addr == 0x158) { int counter_byte = GET_LEN(to_push) - 1;
// first 2 bytes return ((uint8_t)(GET_BYTE(to_push, counter_byte)) >> 4U) & 0x3U;
honda_moving = GET_BYTE(to_push, 0) | GET_BYTE(to_push, 1); }
static int honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
bool valid;
if (honda_hw == HONDA_BH_HW) {
valid = addr_safety_check(to_push, honda_bh_rx_checks, HONDA_BH_RX_CHECKS_LEN,
honda_get_checksum, honda_compute_checksum, honda_get_counter);
} else {
valid = addr_safety_check(to_push, honda_rx_checks, HONDA_RX_CHECKS_LEN,
honda_get_checksum, honda_compute_checksum, honda_get_counter);
} }
// state machine to enter and exit controls if (valid) {
// 0x1A6 for the ILX, 0x296 for the Civic Touring int addr = GET_ADDR(to_push);
if ((addr == 0x1A6) || (addr == 0x296)) { int len = GET_LEN(to_push);
int button = (GET_BYTE(to_push, 0) & 0xE0) >> 5; int bus = GET_BUS(to_push);
switch (button) {
case 2: // cancel // sample speed
controls_allowed = 0; if (addr == 0x158) {
break; // first 2 bytes
case 3: // set honda_moving = GET_BYTE(to_push, 0) | GET_BYTE(to_push, 1);
case 4: // resume
controls_allowed = 1;
break;
default:
break; // any other button is irrelevant
} }
}
// user brake signal on 0x17C reports applied brake from computer brake on accord // state machine to enter and exit controls
// and crv, which prevents the usual brake safety from working correctly. these // 0x1A6 for the ILX, 0x296 for the Civic Touring
// cars have a signal on 0x1BE which only detects user's brake being applied so if ((addr == 0x1A6) || (addr == 0x296)) {
// in these cases, this is used instead. int button = (GET_BYTE(to_push, 0) & 0xE0) >> 5;
// most hondas: 0x17C bit 53 switch (button) {
// accord, crv: 0x1BE bit 4 case 2: // cancel
// exit controls on rising edge of brake press or on brake press when speed > 0 controls_allowed = 0;
bool is_user_brake_msg = honda_alt_brake_msg ? ((addr) == 0x1BE) : ((addr) == 0x17C); break;
if (is_user_brake_msg) { case 3: // set
bool brake_pressed = honda_alt_brake_msg ? (GET_BYTE((to_push), 0) & 0x10) : (GET_BYTE((to_push), 6) & 0x20); case 4: // resume
if (brake_pressed && (!(honda_brake_pressed_prev) || honda_moving)) { controls_allowed = 1;
controls_allowed = 0; break;
default:
break; // any other button is irrelevant
}
} }
honda_brake_pressed_prev = brake_pressed;
}
// exit controls on rising edge of gas press if interceptor (0x201 w/ len = 6) // user brake signal on 0x17C reports applied brake from computer brake on accord
// length check because bosch hardware also uses this id (0x201 w/ len = 8) // and crv, which prevents the usual brake safety from working correctly. these
if ((addr == 0x201) && (len == 6)) { // cars have a signal on 0x1BE which only detects user's brake being applied so
gas_interceptor_detected = 1; // in these cases, this is used instead.
int gas_interceptor = GET_INTERCEPTOR(to_push); // most hondas: 0x17C bit 53
if ((gas_interceptor > HONDA_GAS_INTERCEPTOR_THRESHOLD) && // accord, crv: 0x1BE bit 4
(gas_interceptor_prev <= HONDA_GAS_INTERCEPTOR_THRESHOLD) && // exit controls on rising edge of brake press or on brake press when speed > 0
long_controls_allowed) { bool is_user_brake_msg = honda_alt_brake_msg ? ((addr) == 0x1BE) : ((addr) == 0x17C);
controls_allowed = 0; if (is_user_brake_msg) {
bool brake_pressed = honda_alt_brake_msg ? (GET_BYTE((to_push), 0) & 0x10) : (GET_BYTE((to_push), 6) & 0x20);
if (brake_pressed && (!(honda_brake_pressed_prev) || honda_moving)) {
controls_allowed = 0;
}
honda_brake_pressed_prev = brake_pressed;
} }
gas_interceptor_prev = gas_interceptor;
}
// exit controls on rising edge of gas press if no interceptor // exit controls on rising edge of gas press if interceptor (0x201 w/ len = 6)
if (!gas_interceptor_detected) { // length check because bosch hardware also uses this id (0x201 w/ len = 8)
if (addr == 0x17C) { if ((addr == 0x201) && (len == 6)) {
int gas = GET_BYTE(to_push, 0); gas_interceptor_detected = 1;
if (gas && !(honda_gas_prev) && long_controls_allowed) { int gas_interceptor = GET_INTERCEPTOR(to_push);
if ((gas_interceptor > HONDA_GAS_INTERCEPTOR_THRESHOLD) &&
(gas_interceptor_prev <= HONDA_GAS_INTERCEPTOR_THRESHOLD)) {
controls_allowed = 0; controls_allowed = 0;
} }
honda_gas_prev = gas; gas_interceptor_prev = gas_interceptor;
} }
}
if ((bus == 2) && (addr == 0x1FA)) { // exit controls on rising edge of gas press if no interceptor
bool honda_stock_aeb = GET_BYTE(to_push, 3) & 0x20; if (!gas_interceptor_detected) {
int honda_stock_brake = (GET_BYTE(to_push, 0) << 2) + ((GET_BYTE(to_push, 1) >> 6) & 0x3); if (addr == 0x17C) {
int gas = GET_BYTE(to_push, 0);
// Forward AEB when stock braking is higher than openpilot braking if (gas && !honda_gas_prev) {
// only stop forwarding when AEB event is over controls_allowed = 0;
if (!honda_stock_aeb) { }
honda_fwd_brake = false; honda_gas_prev = gas;
} else if (honda_stock_brake >= honda_brake) { }
honda_fwd_brake = true;
} else {
// Leave Honda forward brake as is
} }
} if ((bus == 2) && (addr == 0x1FA)) {
bool honda_stock_aeb = GET_BYTE(to_push, 3) & 0x20;
int honda_stock_brake = (GET_BYTE(to_push, 0) << 2) + ((GET_BYTE(to_push, 1) >> 6) & 0x3);
// if steering controls messages are received on the destination bus, it's an indication // Forward AEB when stock braking is higher than openpilot braking
// that the relay might be malfunctioning // only stop forwarding when AEB event is over
int bus_rdr_car = (board_has_relay()) ? 0 : 2; // radar bus, car side if (!honda_stock_aeb) {
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && ((addr == 0xE4) || (addr == 0x194))) { honda_fwd_brake = false;
if ((honda_bosch_hardware && (bus == bus_rdr_car)) || } else if (honda_stock_brake >= honda_brake) {
(!honda_bosch_hardware && (bus == 0))) { honda_fwd_brake = true;
relay_malfunction = true; } else {
// Leave Honda forward brake as is
}
}
// if steering controls messages are received on the destination bus, it's an indication
// that the relay might be malfunctioning
int bus_rdr_car = (honda_hw == HONDA_BH_HW) ? 0 : 2; // radar bus, car side
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && ((addr == 0xE4) || (addr == 0x194))) {
if (((honda_hw != HONDA_N_HW) && (bus == bus_rdr_car)) ||
((honda_hw == HONDA_N_HW) && (bus == 0))) {
relay_malfunction = true;
}
} }
} }
return valid;
} }
// all commands: gas, brake and steering // all commands: gas, brake and steering
@ -124,16 +180,12 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
if (honda_bosch_hardware) { if (honda_hw == HONDA_BG_HW) {
if (board_has_relay() && !addr_allowed(addr, bus, HONDA_BH_TX_MSGS, sizeof(HONDA_BH_TX_MSGS)/sizeof(HONDA_BH_TX_MSGS[0]))) { tx = msg_allowed(addr, bus, HONDA_BG_TX_MSGS, sizeof(HONDA_BG_TX_MSGS)/sizeof(HONDA_BG_TX_MSGS[0]));
tx = 0; } else if (honda_hw == HONDA_BH_HW) {
} tx = msg_allowed(addr, bus, HONDA_BH_TX_MSGS, sizeof(HONDA_BH_TX_MSGS)/sizeof(HONDA_BH_TX_MSGS[0]));
if (!board_has_relay() && !addr_allowed(addr, bus, HONDA_BG_TX_MSGS, sizeof(HONDA_BG_TX_MSGS)/sizeof(HONDA_BG_TX_MSGS[0]))) { } else {
tx = 0; tx = msg_allowed(addr, bus, HONDA_N_TX_MSGS, sizeof(HONDA_N_TX_MSGS)/sizeof(HONDA_N_TX_MSGS[0]));
}
}
if (!honda_bosch_hardware && !addr_allowed(addr, bus, HONDA_N_TX_MSGS, sizeof(HONDA_N_TX_MSGS)/sizeof(HONDA_N_TX_MSGS[0]))) {
tx = 0;
} }
if (relay_malfunction) { if (relay_malfunction) {
@ -149,7 +201,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
// BRAKE: safety check // BRAKE: safety check
if ((addr == 0x1FA) && (bus == 0)) { if ((addr == 0x1FA) && (bus == 0)) {
honda_brake = (GET_BYTE(to_send, 0) << 2) + ((GET_BYTE(to_send, 1) >> 6) & 0x3); honda_brake = (GET_BYTE(to_send, 0) << 2) + ((GET_BYTE(to_send, 1) >> 6) & 0x3);
if (!current_controls_allowed || !long_controls_allowed) { if (!current_controls_allowed) {
if (honda_brake != 0) { if (honda_brake != 0) {
tx = 0; tx = 0;
} }
@ -174,7 +226,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
// GAS: safety check // GAS: safety check
if (addr == 0x200) { if (addr == 0x200) {
if (!current_controls_allowed || !long_controls_allowed) { if (!current_controls_allowed) {
if (GET_BYTE(to_send, 0) || GET_BYTE(to_send, 1)) { if (GET_BYTE(to_send, 0) || GET_BYTE(to_send, 1)) {
tx = 0; tx = 0;
} }
@ -184,9 +236,8 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
// FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW // FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW
// ensuring that only the cancel button press is sent (VAL 2) when controls are off. // ensuring that only the cancel button press is sent (VAL 2) when controls are off.
// This avoids unintended engagements while still allowing resume spam // This avoids unintended engagements while still allowing resume spam
int bus_pt = ((board_has_relay()) && honda_bosch_hardware)? 1 : 0; int bus_pt = (honda_hw == HONDA_BH_HW)? 1 : 0;
if ((addr == 0x296) && honda_bosch_hardware && if ((addr == 0x296) && !current_controls_allowed && (bus == bus_pt)) {
!current_controls_allowed && (bus == bus_pt)) {
if (((GET_BYTE(to_send, 0) >> 5) & 0x7) != 2) { if (((GET_BYTE(to_send, 0) >> 5) & 0x7) != 2) {
tx = 0; tx = 0;
} }
@ -196,23 +247,31 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
return tx; return tx;
} }
static void honda_init(int16_t param) { static void honda_nidec_init(int16_t param) {
UNUSED(param); UNUSED(param);
controls_allowed = false; controls_allowed = false;
relay_malfunction = false; relay_malfunction = false;
honda_bosch_hardware = false; honda_hw = HONDA_N_HW;
honda_alt_brake_msg = false; honda_alt_brake_msg = false;
} }
static void honda_bosch_init(int16_t param) { static void honda_bosch_giraffe_init(int16_t param) {
controls_allowed = false;
relay_malfunction = false;
honda_hw = HONDA_BG_HW;
// Checking for alternate brake override from safety parameter
honda_alt_brake_msg = (param == 1) ? true : false;
}
static void honda_bosch_harness_init(int16_t param) {
controls_allowed = false; controls_allowed = false;
relay_malfunction = false; relay_malfunction = false;
honda_bosch_hardware = true; honda_hw = HONDA_BH_HW;
// Checking for alternate brake override from safety parameter // Checking for alternate brake override from safety parameter
honda_alt_brake_msg = (param == 1) ? true : false; honda_alt_brake_msg = (param == 1) ? true : false;
} }
static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { static int honda_nidec_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
// fwd from car to camera. also fwd certain msgs from camera to car // fwd from car to camera. also fwd certain msgs from camera to car
// 0xE4 is steering on all cars except CRV and RDX, 0x194 for CRV and RDX, // 0xE4 is steering on all cars except CRV and RDX, 0x194 for CRV and RDX,
// 0x1FA is brake control, 0x30C is acc hud, 0x33D is lkas hud, // 0x1FA is brake control, 0x30C is acc hud, 0x33D is lkas hud,
@ -228,9 +287,7 @@ static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
bool is_lkas_msg = (addr == 0xE4) || (addr == 0x194) || (addr == 0x33D); bool is_lkas_msg = (addr == 0xE4) || (addr == 0x194) || (addr == 0x33D);
bool is_acc_hud_msg = addr == 0x30C; bool is_acc_hud_msg = addr == 0x30C;
bool is_brake_msg = addr == 0x1FA; bool is_brake_msg = addr == 0x1FA;
bool block_fwd = is_lkas_msg || bool block_fwd = is_lkas_msg || is_acc_hud_msg || (is_brake_msg && !honda_fwd_brake);
(is_acc_hud_msg && long_controls_allowed) ||
(is_brake_msg && long_controls_allowed && !honda_fwd_brake);
if (!block_fwd) { if (!block_fwd) {
bus_fwd = 0; bus_fwd = 0;
} }
@ -241,8 +298,8 @@ static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
int bus_fwd = -1; int bus_fwd = -1;
int bus_rdr_cam = (board_has_relay()) ? 2 : 1; // radar bus, camera side int bus_rdr_cam = (honda_hw == HONDA_BH_HW) ? 2 : 1; // radar bus, camera side
int bus_rdr_car = (board_has_relay()) ? 0 : 2; // radar bus, car side int bus_rdr_car = (honda_hw == HONDA_BH_HW) ? 0 : 2; // radar bus, car side
if (!relay_malfunction) { if (!relay_malfunction) {
if (bus_num == bus_rdr_car) { if (bus_num == bus_rdr_car) {
@ -259,18 +316,32 @@ static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return bus_fwd; return bus_fwd;
} }
const safety_hooks honda_hooks = { const safety_hooks honda_nidec_hooks = {
.init = honda_init, .init = honda_nidec_init,
.rx = honda_rx_hook, .rx = honda_rx_hook,
.tx = honda_tx_hook, .tx = honda_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = honda_fwd_hook, .fwd = honda_nidec_fwd_hook,
.addr_check = honda_rx_checks,
.addr_check_len = sizeof(honda_rx_checks) / sizeof(honda_rx_checks[0]),
};
const safety_hooks honda_bosch_giraffe_hooks = {
.init = honda_bosch_giraffe_init,
.rx = honda_rx_hook,
.tx = honda_tx_hook,
.tx_lin = nooutput_tx_lin_hook,
.fwd = honda_bosch_fwd_hook,
.addr_check = honda_rx_checks,
.addr_check_len = sizeof(honda_rx_checks) / sizeof(honda_rx_checks[0]),
}; };
const safety_hooks honda_bosch_hooks = { const safety_hooks honda_bosch_harness_hooks = {
.init = honda_bosch_init, .init = honda_bosch_harness_init,
.rx = honda_rx_hook, .rx = honda_rx_hook,
.tx = honda_tx_hook, .tx = honda_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = honda_bosch_fwd_hook, .fwd = honda_bosch_fwd_hook,
.addr_check = honda_bh_rx_checks,
.addr_check_len = sizeof(honda_bh_rx_checks) / sizeof(honda_bh_rx_checks[0]),
}; };

@ -5,16 +5,22 @@ const int HYUNDAI_MAX_RATE_UP = 3;
const int HYUNDAI_MAX_RATE_DOWN = 7; const int HYUNDAI_MAX_RATE_DOWN = 7;
const int HYUNDAI_DRIVER_TORQUE_ALLOWANCE = 50; const int HYUNDAI_DRIVER_TORQUE_ALLOWANCE = 50;
const int HYUNDAI_DRIVER_TORQUE_FACTOR = 2; const int HYUNDAI_DRIVER_TORQUE_FACTOR = 2;
const AddrBus HYUNDAI_TX_MSGS[] = {{832, 0}, {1265, 0}}; const AddrBus HYUNDAI_TX_MSGS[] = {{832, 0}, {1265, 0}};
// TODO: do checksum and counter checks
AddrCheckStruct hyundai_rx_checks[] = {
{.addr = {897}, .bus = 0, .expected_timestep = 10000U},
{.addr = {1057}, .bus = 0, .expected_timestep = 20000U},
};
const int HYUNDAI_RX_CHECK_LEN = sizeof(hyundai_rx_checks) / sizeof(hyundai_rx_checks[0]);
int hyundai_rt_torque_last = 0; int hyundai_rt_torque_last = 0;
int hyundai_desired_torque_last = 0; int hyundai_desired_torque_last = 0;
int hyundai_cruise_engaged_last = 0; int hyundai_cruise_engaged_last = 0;
uint32_t hyundai_ts_last = 0; uint32_t hyundai_ts_last = 0;
struct sample_t hyundai_torque_driver; // last few driver torques measured struct sample_t hyundai_torque_driver; // last few driver torques measured
static void hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -24,11 +30,6 @@ static void hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
update_sample(&hyundai_torque_driver, torque_driver_new); update_sample(&hyundai_torque_driver, torque_driver_new);
} }
// check if stock camera ECU is on bus 0
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && (addr == 832)) {
relay_malfunction = true;
}
// enter controls on rising edge of ACC, exit controls on ACC off // enter controls on rising edge of ACC, exit controls on ACC off
if (addr == 1057) { if (addr == 1057) {
// 2 bits: 13-14 // 2 bits: 13-14
@ -41,6 +42,14 @@ static void hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
} }
hyundai_cruise_engaged_last = cruise_engaged; hyundai_cruise_engaged_last = cruise_engaged;
} }
// TODO: check gas pressed
// check if stock camera ECU is on bus 0
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && (addr == 832)) {
relay_malfunction = true;
}
return 1;
} }
static int hyundai_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { static int hyundai_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
@ -49,7 +58,7 @@ static int hyundai_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
if (!addr_allowed(addr, bus, HYUNDAI_TX_MSGS, sizeof(HYUNDAI_TX_MSGS)/sizeof(HYUNDAI_TX_MSGS[0]))) { if (!msg_allowed(addr, bus, HYUNDAI_TX_MSGS, sizeof(HYUNDAI_TX_MSGS)/sizeof(HYUNDAI_TX_MSGS[0]))) {
tx = 0; tx = 0;
} }
@ -140,4 +149,6 @@ const safety_hooks hyundai_hooks = {
.tx = hyundai_tx_hook, .tx = hyundai_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = hyundai_fwd_hook, .fwd = hyundai_fwd_hook,
.addr_check = hyundai_rx_checks,
.addr_check_len = sizeof(hyundai_rx_checks) / sizeof(hyundai_rx_checks[0]),
}; };

@ -22,7 +22,6 @@
#define MAZDA_DRIVER_TORQUE_ALLOWANCE 15 #define MAZDA_DRIVER_TORQUE_ALLOWANCE 15
#define MAZDA_DRIVER_TORQUE_FACTOR 1 #define MAZDA_DRIVER_TORQUE_FACTOR 1
int mazda_cruise_engaged_last = 0; int mazda_cruise_engaged_last = 0;
int mazda_rt_torque_last = 0; int mazda_rt_torque_last = 0;
int mazda_desired_torque_last = 0; int mazda_desired_torque_last = 0;
@ -30,7 +29,7 @@ uint32_t mazda_ts_last = 0;
struct sample_t mazda_torque_driver; // last few driver torques measured struct sample_t mazda_torque_driver; // last few driver torques measured
// track msgs coming from OP so that we know what CAM msgs to drop and what to forward // track msgs coming from OP so that we know what CAM msgs to drop and what to forward
void mazda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int mazda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -58,6 +57,7 @@ void mazda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == MAZDA_CAM) && (addr == MAZDA_WHEEL_SPEED)) { if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == MAZDA_CAM) && (addr == MAZDA_WHEEL_SPEED)) {
relay_malfunction = true; relay_malfunction = true;
} }
return 1;
} }
static int mazda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { static int mazda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
@ -146,4 +146,5 @@ const safety_hooks mazda_hooks = {
.tx = mazda_tx_hook, .tx = mazda_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = mazda_fwd_hook, .fwd = mazda_fwd_hook,
// TODO: add addr safety checks
}; };

@ -10,13 +10,20 @@ const int SUBARU_DRIVER_TORQUE_FACTOR = 10;
const AddrBus SUBARU_TX_MSGS[] = {{0x122, 0}, {0x164, 0}, {0x221, 0}, {0x322, 0}}; const AddrBus SUBARU_TX_MSGS[] = {{0x122, 0}, {0x164, 0}, {0x221, 0}, {0x322, 0}};
// TODO: do checksum and counter checks after adding the signals to the outback dbc file
AddrCheckStruct subaru_rx_checks[] = {
{.addr = {0x119, 0x371}, .bus = 0, .expected_timestep = 20000U},
{.addr = {0x240, 0x144}, .bus = 0, .expected_timestep = 50000U},
};
const int SUBARU_RX_CHECK_LEN = sizeof(subaru_rx_checks) / sizeof(subaru_rx_checks[0]);
int subaru_cruise_engaged_last = 0; int subaru_cruise_engaged_last = 0;
int subaru_rt_torque_last = 0; int subaru_rt_torque_last = 0;
int subaru_desired_torque_last = 0; int subaru_desired_torque_last = 0;
uint32_t subaru_ts_last = 0; uint32_t subaru_ts_last = 0;
struct sample_t subaru_torque_driver; // last few driver torques measured struct sample_t subaru_torque_driver; // last few driver torques measured
static void subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -41,9 +48,12 @@ static void subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
subaru_cruise_engaged_last = cruise_engaged; subaru_cruise_engaged_last = cruise_engaged;
} }
// TODO: enforce cancellation on gas pressed
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && ((addr == 0x122) || (addr == 0x164))) { if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && ((addr == 0x122) || (addr == 0x164))) {
relay_malfunction = true; relay_malfunction = true;
} }
return 1;
} }
static int subaru_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { static int subaru_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
@ -51,7 +61,7 @@ static int subaru_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
if (!addr_allowed(addr, bus, SUBARU_TX_MSGS, sizeof(SUBARU_TX_MSGS) / sizeof(SUBARU_TX_MSGS[0]))) { if (!msg_allowed(addr, bus, SUBARU_TX_MSGS, sizeof(SUBARU_TX_MSGS) / sizeof(SUBARU_TX_MSGS[0]))) {
tx = 0; tx = 0;
} }
@ -141,4 +151,6 @@ const safety_hooks subaru_hooks = {
.tx = subaru_tx_hook, .tx = subaru_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = subaru_fwd_hook, .fwd = subaru_fwd_hook,
.addr_check = subaru_rx_checks,
.addr_check_len = sizeof(subaru_rx_checks) / sizeof(subaru_rx_checks[0]),
}; };

@ -44,7 +44,7 @@ void reset_gmlan_switch_timeout(void);
void gmlan_switch_init(int timeout_enable); void gmlan_switch_init(int timeout_enable);
static void tesla_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int tesla_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
set_gmlan_digital_output(0); // #define GMLAN_HIGH 0 set_gmlan_digital_output(0); // #define GMLAN_HIGH 0
reset_gmlan_switch_timeout(); //we're still in tesla safety mode, reset the timeout counter and make sure our output is enabled reset_gmlan_switch_timeout(); //we're still in tesla safety mode, reset the timeout counter and make sure our output is enabled
@ -120,6 +120,7 @@ static void tesla_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
tesla_controls_allowed_last = controls_allowed; tesla_controls_allowed_last = controls_allowed;
} }
return 1;
} }
// all commands: gas/regen, friction brake and steering // all commands: gas/regen, friction brake and steering

@ -18,11 +18,16 @@ const int TOYOTA_MIN_ACCEL = -3000; // 3.0 m/s2
const int TOYOTA_GAS_INTERCEPTOR_THRESHOLD = 475; // ratio between offset and gain from dbc file const int TOYOTA_GAS_INTERCEPTOR_THRESHOLD = 475; // ratio between offset and gain from dbc file
// allowed DSU messages on bus 0 and 1
const AddrBus TOYOTA_TX_MSGS[] = {{0x283, 0}, {0x2E6, 0}, {0x2E7, 0}, {0x33E, 0}, {0x344, 0}, {0x365, 0}, {0x366, 0}, {0x4CB, 0}, // DSU bus 0 const AddrBus TOYOTA_TX_MSGS[] = {{0x283, 0}, {0x2E6, 0}, {0x2E7, 0}, {0x33E, 0}, {0x344, 0}, {0x365, 0}, {0x366, 0}, {0x4CB, 0}, // DSU bus 0
{0x128, 1}, {0x141, 1}, {0x160, 1}, {0x161, 1}, {0x470, 1}, // DSU bus 1 {0x128, 1}, {0x141, 1}, {0x160, 1}, {0x161, 1}, {0x470, 1}, // DSU bus 1
{0x2E4, 0}, {0x411, 0}, {0x412, 0}, {0x343, 0}, {0x1D2, 0}, // LKAS + ACC {0x2E4, 0}, {0x411, 0}, {0x412, 0}, {0x343, 0}, {0x1D2, 0}, // LKAS + ACC
{0x200, 0}}; // interceptor {0x200, 0}}; // interceptor
AddrCheckStruct toyota_rx_checks[] = {
{.addr = {0x260}, .bus = 0, .check_checksum = true, .max_counter = 0U, .expected_timestep = 20000U},
{.addr = {0x1D2}, .bus = 0, .check_checksum = true, .max_counter = 0U, .expected_timestep = 30000U},
};
const int TOYOTA_RX_CHECKS_LEN = sizeof(toyota_rx_checks) / sizeof(toyota_rx_checks[0]);
// global actuation limit states // global actuation limit states
int toyota_dbc_eps_torque_factor = 100; // conversion factor for STEER_TORQUE_EPS in %: see dbc file int toyota_dbc_eps_torque_factor = 100; // conversion factor for STEER_TORQUE_EPS in %: see dbc file
@ -36,65 +41,84 @@ int toyota_gas_prev = 0;
struct sample_t toyota_torque_meas; // last 3 motor torques produced by the eps struct sample_t toyota_torque_meas; // last 3 motor torques produced by the eps
static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static uint8_t toyota_compute_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
int len = GET_LEN(to_push);
uint8_t checksum = (uint8_t)(addr) + (uint8_t)((unsigned int)(addr) >> 8U) + (uint8_t)(len);
for (int i = 0; i < (len - 1); i++) {
checksum += (uint8_t)GET_BYTE(to_push, i);
}
return checksum;
}
// get eps motor torque (0.66 factor in dbc) static uint8_t toyota_get_checksum(CAN_FIFOMailBox_TypeDef *to_push) {
if (addr == 0x260) { int checksum_byte = GET_LEN(to_push) - 1;
int torque_meas_new = (GET_BYTE(to_push, 5) << 8) | GET_BYTE(to_push, 6); return (uint8_t)(GET_BYTE(to_push, checksum_byte));
torque_meas_new = to_signed(torque_meas_new, 16); }
// scale by dbc_factor static int toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
torque_meas_new = (torque_meas_new * toyota_dbc_eps_torque_factor) / 100;
// update array of sample bool valid = addr_safety_check(to_push, toyota_rx_checks, TOYOTA_RX_CHECKS_LEN,
update_sample(&toyota_torque_meas, torque_meas_new); toyota_get_checksum, toyota_compute_checksum, NULL);
if (valid) {
int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push);
// increase torque_meas by 1 to be conservative on rounding // get eps motor torque (0.66 factor in dbc)
toyota_torque_meas.min--; if (addr == 0x260) {
toyota_torque_meas.max++; int torque_meas_new = (GET_BYTE(to_push, 5) << 8) | GET_BYTE(to_push, 6);
} torque_meas_new = to_signed(torque_meas_new, 16);
// scale by dbc_factor
torque_meas_new = (torque_meas_new * toyota_dbc_eps_torque_factor) / 100;
// update array of sample
update_sample(&toyota_torque_meas, torque_meas_new);
// enter controls on rising edge of ACC, exit controls on ACC off // increase torque_meas by 1 to be conservative on rounding
if (addr == 0x1D2) { toyota_torque_meas.min--;
// 5th bit is CRUISE_ACTIVE toyota_torque_meas.max++;
int cruise_engaged = GET_BYTE(to_push, 0) & 0x20;
if (!cruise_engaged) {
controls_allowed = 0;
} }
if (cruise_engaged && !toyota_cruise_engaged_last) {
controls_allowed = 1; // enter controls on rising edge of ACC, exit controls on ACC off
if (addr == 0x1D2) {
// 5th bit is CRUISE_ACTIVE
int cruise_engaged = GET_BYTE(to_push, 0) & 0x20;
if (!cruise_engaged) {
controls_allowed = 0;
}
if (cruise_engaged && !toyota_cruise_engaged_last) {
controls_allowed = 1;
}
toyota_cruise_engaged_last = cruise_engaged;
} }
toyota_cruise_engaged_last = cruise_engaged;
}
// exit controls on rising edge of interceptor gas press // exit controls on rising edge of interceptor gas press
if (addr == 0x201) { if (addr == 0x201) {
gas_interceptor_detected = 1; gas_interceptor_detected = 1;
int gas_interceptor = GET_INTERCEPTOR(to_push); int gas_interceptor = GET_INTERCEPTOR(to_push);
if ((gas_interceptor > TOYOTA_GAS_INTERCEPTOR_THRESHOLD) && if ((gas_interceptor > TOYOTA_GAS_INTERCEPTOR_THRESHOLD) &&
(gas_interceptor_prev <= TOYOTA_GAS_INTERCEPTOR_THRESHOLD) && (gas_interceptor_prev <= TOYOTA_GAS_INTERCEPTOR_THRESHOLD)) {
long_controls_allowed) { controls_allowed = 0;
controls_allowed = 0; }
gas_interceptor_prev = gas_interceptor;
} }
gas_interceptor_prev = gas_interceptor;
}
// exit controls on rising edge of gas press // exit controls on rising edge of gas press
if (addr == 0x2C1) { if (addr == 0x2C1) {
int gas = GET_BYTE(to_push, 6) & 0xFF; int gas = GET_BYTE(to_push, 6) & 0xFF;
if ((gas > 0) && (toyota_gas_prev == 0) && !gas_interceptor_detected && long_controls_allowed) { if ((gas > 0) && (toyota_gas_prev == 0) && !gas_interceptor_detected) {
controls_allowed = 0; controls_allowed = 0;
}
toyota_gas_prev = gas;
} }
toyota_gas_prev = gas;
}
// 0x2E4 is lkas cmd. If it is on bus 0, then relay is unexpectedly closed // 0x2E4 is lkas cmd. If it is on bus 0, then relay is unexpectedly closed
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (addr == 0x2E4) && (bus == 0)) { if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (addr == 0x2E4) && (bus == 0)) {
relay_malfunction = true; relay_malfunction = true;
}
} }
return valid;
} }
static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
@ -103,7 +127,7 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
if (!addr_allowed(addr, bus, TOYOTA_TX_MSGS, sizeof(TOYOTA_TX_MSGS)/sizeof(TOYOTA_TX_MSGS[0]))) { if (!msg_allowed(addr, bus, TOYOTA_TX_MSGS, sizeof(TOYOTA_TX_MSGS)/sizeof(TOYOTA_TX_MSGS[0]))) {
tx = 0; tx = 0;
} }
@ -116,7 +140,7 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
// GAS PEDAL: safety check // GAS PEDAL: safety check
if (addr == 0x200) { if (addr == 0x200) {
if (!controls_allowed || !long_controls_allowed) { if (!controls_allowed) {
if (GET_BYTE(to_send, 0) || GET_BYTE(to_send, 1)) { if (GET_BYTE(to_send, 0) || GET_BYTE(to_send, 1)) {
tx = 0; tx = 0;
} }
@ -127,7 +151,7 @@ static int toyota_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
if (addr == 0x343) { if (addr == 0x343) {
int desired_accel = (GET_BYTE(to_send, 0) << 8) | GET_BYTE(to_send, 1); int desired_accel = (GET_BYTE(to_send, 0) << 8) | GET_BYTE(to_send, 1);
desired_accel = to_signed(desired_accel, 16); desired_accel = to_signed(desired_accel, 16);
if (!controls_allowed || !long_controls_allowed) { if (!controls_allowed) {
if (desired_accel != 0) { if (desired_accel != 0) {
tx = 0; tx = 0;
} }
@ -210,7 +234,7 @@ static int toyota_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
int is_lkas_msg = ((addr == 0x2E4) || (addr == 0x412) || (addr == 0x191)); int is_lkas_msg = ((addr == 0x2E4) || (addr == 0x412) || (addr == 0x191));
// in TSS2 the camera does ACC as well, so filter 0x343 // in TSS2 the camera does ACC as well, so filter 0x343
int is_acc_msg = (addr == 0x343); int is_acc_msg = (addr == 0x343);
int block_msg = is_lkas_msg || (is_acc_msg && long_controls_allowed); int block_msg = is_lkas_msg || is_acc_msg;
if (!block_msg) { if (!block_msg) {
bus_fwd = 0; bus_fwd = 0;
} }
@ -225,4 +249,6 @@ const safety_hooks toyota_hooks = {
.tx = toyota_tx_hook, .tx = toyota_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = toyota_fwd_hook, .fwd = toyota_fwd_hook,
.addr_check = toyota_rx_checks,
.addr_check_len = sizeof(toyota_rx_checks)/sizeof(toyota_rx_checks[0]),
}; };

@ -31,9 +31,9 @@ uint32_t ts_angle_last = 0;
int controls_allowed_last = 0; int controls_allowed_last = 0;
static void toyota_ipas_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int toyota_ipas_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// check standard toyota stuff as well // check standard toyota stuff as well
toyota_rx_hook(to_push); bool valid = toyota_rx_hook(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -95,6 +95,7 @@ static void toyota_ipas_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
(ipas_state==5))) { (ipas_state==5))) {
controls_allowed = 0; controls_allowed = 0;
} }
return valid;
} }
static int toyota_ipas_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { static int toyota_ipas_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {

@ -17,13 +17,22 @@ const int VOLKSWAGEN_DRIVER_TORQUE_FACTOR = 3;
// MSG_GRA_ACC_01 is allowed on bus 0 and 2 to keep compatibility with gateway and camera integration // MSG_GRA_ACC_01 is allowed on bus 0 and 2 to keep compatibility with gateway and camera integration
const AddrBus VOLKSWAGEN_TX_MSGS[] = {{MSG_HCA_01, 0}, {MSG_GRA_ACC_01, 0}, {MSG_GRA_ACC_01, 2}, {MSG_LDW_02, 0}}; const AddrBus VOLKSWAGEN_TX_MSGS[] = {{MSG_HCA_01, 0}, {MSG_GRA_ACC_01, 0}, {MSG_GRA_ACC_01, 2}, {MSG_LDW_02, 0}};
struct sample_t volkswagen_torque_driver; // last few driver torques measured // TODO: do checksum and counter checks
AddrCheckStruct volkswagen_rx_checks[] = {
{.addr = {MSG_EPS_01}, .bus = 0, .expected_timestep = 10000U},
{.addr = {MSG_ACC_06}, .bus = 0, .expected_timestep = 20000U},
{.addr = {MSG_MOTOR_20}, .bus = 0, .expected_timestep = 20000U},
};
const int VOLKSWAGEN_RX_CHECK_LEN = sizeof(volkswagen_rx_checks) / sizeof(volkswagen_rx_checks[0]);
struct sample_t volkswagen_torque_driver; // last few driver torques measured
int volkswagen_rt_torque_last = 0; int volkswagen_rt_torque_last = 0;
int volkswagen_desired_torque_last = 0; int volkswagen_desired_torque_last = 0;
uint32_t volkswagen_ts_last = 0; uint32_t volkswagen_ts_last = 0;
int volkswagen_gas_prev = 0; int volkswagen_gas_prev = 0;
static void volkswagen_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { static int volkswagen_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@ -50,7 +59,7 @@ static void volkswagen_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
// exit controls on rising edge of gas press. Bits [12-20) // exit controls on rising edge of gas press. Bits [12-20)
if (addr == MSG_MOTOR_20) { if (addr == MSG_MOTOR_20) {
int gas = (GET_BYTES_04(to_push) >> 12) & 0xFF; int gas = (GET_BYTES_04(to_push) >> 12) & 0xFF;
if ((gas > 0) && (volkswagen_gas_prev == 0) && long_controls_allowed) { if ((gas > 0) && (volkswagen_gas_prev == 0)) {
controls_allowed = 0; controls_allowed = 0;
} }
volkswagen_gas_prev = gas; volkswagen_gas_prev = gas;
@ -59,6 +68,7 @@ static void volkswagen_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && (addr == MSG_HCA_01)) { if ((safety_mode_cnt > RELAY_TRNS_TIMEOUT) && (bus == 0) && (addr == MSG_HCA_01)) {
relay_malfunction = true; relay_malfunction = true;
} }
return 1;
} }
static int volkswagen_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { static int volkswagen_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
@ -66,7 +76,7 @@ static int volkswagen_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
int tx = 1; int tx = 1;
if (!addr_allowed(addr, bus, VOLKSWAGEN_TX_MSGS, sizeof(VOLKSWAGEN_TX_MSGS)/sizeof(VOLKSWAGEN_TX_MSGS[0]))) { if (!msg_allowed(addr, bus, VOLKSWAGEN_TX_MSGS, sizeof(VOLKSWAGEN_TX_MSGS)/sizeof(VOLKSWAGEN_TX_MSGS[0]))) {
tx = 0; tx = 0;
} }
@ -174,4 +184,6 @@ const safety_hooks volkswagen_hooks = {
.tx = volkswagen_tx_hook, .tx = volkswagen_tx_hook,
.tx_lin = nooutput_tx_lin_hook, .tx_lin = nooutput_tx_lin_hook,
.fwd = volkswagen_fwd_hook, .fwd = volkswagen_fwd_hook,
.addr_check = volkswagen_rx_checks,
.addr_check_len = sizeof(volkswagen_rx_checks) / sizeof(volkswagen_rx_checks[0]),
}; };

@ -1,3 +1,6 @@
const int MAX_WRONG_COUNTERS = 5;
const uint8_t MAX_MISSED_MSGS = 10U;
// sample struct that keeps 3 samples in memory // sample struct that keeps 3 samples in memory
struct sample_t { struct sample_t {
int values[6]; int values[6];
@ -16,7 +19,23 @@ typedef struct {
int bus; int bus;
} AddrBus; } AddrBus;
void safety_rx_hook(CAN_FIFOMailBox_TypeDef *to_push); // params and flags about checksum, counter and frequency checks for each monitored address
typedef struct {
// const params
const int addr[3]; // check either messages (e.g. honda steer). Array MUST terminate with a zero to know its length.
const int bus; // bus where to expect the addr. Temp hack: -1 means skip the bus check
const bool check_checksum; // true is checksum check is performed
const uint8_t max_counter; // maximum value of the counter. 0 means that the counter check is skipped
const uint32_t expected_timestep; // expected time between message updates [us]
// dynamic flags
bool valid_checksum; // true if and only if checksum check is passed
int wrong_counters; // counter of wrong counters, saturated between 0 and MAX_WRONG_COUNTERS
uint8_t last_counter; // last counter value
uint32_t last_timestamp; // micro-s
bool lagging; // true if and only if the time between updates is excessive
} AddrCheckStruct;
int safety_rx_hook(CAN_FIFOMailBox_TypeDef *to_push);
int safety_tx_hook(CAN_FIFOMailBox_TypeDef *to_send); int safety_tx_hook(CAN_FIFOMailBox_TypeDef *to_send);
int safety_tx_lin_hook(int lin_num, uint8_t *data, int len); int safety_tx_lin_hook(int lin_num, uint8_t *data, int len);
uint32_t get_ts_elapsed(uint32_t ts, uint32_t ts_last); uint32_t get_ts_elapsed(uint32_t ts, uint32_t ts_last);
@ -30,10 +49,20 @@ bool driver_limit_check(int val, int val_last, struct sample_t *val_driver,
const int MAX_ALLOWANCE, const int DRIVER_FACTOR); const int MAX_ALLOWANCE, const int DRIVER_FACTOR);
bool rt_rate_limit_check(int val, int val_last, const int MAX_RT_DELTA); bool rt_rate_limit_check(int val, int val_last, const int MAX_RT_DELTA);
float interpolate(struct lookup_t xy, float x); float interpolate(struct lookup_t xy, float x);
bool addr_allowed(int addr, int bus, const AddrBus addr_list[], int len); bool msg_allowed(int addr, int bus, const AddrBus addr_list[], int len);
int get_addr_check_index(CAN_FIFOMailBox_TypeDef *to_push, AddrCheckStruct addr_list[], const int len);
void update_counter(AddrCheckStruct addr_list[], int index, uint8_t counter);
void update_addr_timestamp(AddrCheckStruct addr_list[], int index);
bool is_msg_valid(AddrCheckStruct addr_list[], int index);
bool addr_safety_check(CAN_FIFOMailBox_TypeDef *to_push,
AddrCheckStruct *addr_check,
const int addr_check_len,
uint8_t (*get_checksum)(CAN_FIFOMailBox_TypeDef *to_push),
uint8_t (*compute_checksum)(CAN_FIFOMailBox_TypeDef *to_push),
uint8_t (*get_counter)(CAN_FIFOMailBox_TypeDef *to_push));
typedef void (*safety_hook_init)(int16_t param); typedef void (*safety_hook_init)(int16_t param);
typedef void (*rx_hook)(CAN_FIFOMailBox_TypeDef *to_push); typedef int (*rx_hook)(CAN_FIFOMailBox_TypeDef *to_push);
typedef int (*tx_hook)(CAN_FIFOMailBox_TypeDef *to_send); typedef int (*tx_hook)(CAN_FIFOMailBox_TypeDef *to_send);
typedef int (*tx_lin_hook)(int lin_num, uint8_t *data, int len); typedef int (*tx_lin_hook)(int lin_num, uint8_t *data, int len);
typedef int (*fwd_hook)(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd); typedef int (*fwd_hook)(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd);
@ -44,17 +73,18 @@ typedef struct {
tx_hook tx; tx_hook tx;
tx_lin_hook tx_lin; tx_lin_hook tx_lin;
fwd_hook fwd; fwd_hook fwd;
AddrCheckStruct *addr_check;
const int addr_check_len;
} safety_hooks; } safety_hooks;
void safety_tick(const safety_hooks *hooks);
// This can be set by the safety hooks // This can be set by the safety hooks
bool controls_allowed = false; bool controls_allowed = false;
bool relay_malfunction = false; bool relay_malfunction = false;
bool gas_interceptor_detected = false; bool gas_interceptor_detected = false;
int gas_interceptor_prev = 0; int gas_interceptor_prev = 0;
// This is set by USB command 0xdf
bool long_controls_allowed = true;
// time since safety mode has been changed // time since safety mode has been changed
uint32_t safety_mode_cnt = 0U; uint32_t safety_mode_cnt = 0U;
// allow 1s of transition timeout after relay changes state before assessing malfunctioning // allow 1s of transition timeout after relay changes state before assessing malfunctioning

@ -65,11 +65,13 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
// so it's blocked over wifi // so it's blocked over wifi
switch (setup->b.wValue.w) { switch (setup->b.wValue.w) {
case 0: case 0:
#ifdef ALLOW_DEBUG // TODO: put this back when it's no longer a "devkit"
//#ifdef ALLOW_DEBUG
#if 1
if (hardwired) { if (hardwired) {
#else #else
// no more bootstub on UNO // no more bootstub on UNO once OTP block is flashed
if (hardwired && hw_type != HW_TYPE_UNO) { if (hardwired && ((hw_type != HW_TYPE_UNO) || (!is_provisioned()))) {
#endif #endif
puts("-> entering bootloader\n"); puts("-> entering bootloader\n");
enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC; enter_bootloader_mode = ENTER_BOOTLOADER_MAGIC;

@ -22,32 +22,32 @@
<ProjectGuid>{D99E2FCD-21A4-4065-949A-31E34E0E69D1}</ProjectGuid> <ProjectGuid>{D99E2FCD-21A4-4065-949A-31E34E0E69D1}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>ECUsimCLI</RootNamespace> <RootNamespace>ECUsimCLI</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

@ -22,32 +22,32 @@
<ProjectGuid>{96E0E646-EE76-444D-9A77-A0CD7F781DEB}</ProjectGuid> <ProjectGuid>{96E0E646-EE76-444D-9A77-A0CD7F781DEB}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>ECUsimDLL</RootNamespace> <RootNamespace>ECUsimDLL</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

@ -20,7 +20,7 @@ ______/\\\\\\\\\\\____/\\\\\\\\\_______/\\\\\\\\\\\\\\\______/\\\\\\\\\\________
# Installing J2534 driver: # Installing J2534 driver:
[Download](https://github.com/commaai/panda/files/1742802/panda.J2534.driver.install.zip) [Download](https://github.com/commaai/panda/files/4017364/panda.J2534.driver.install.zip)
Depending on what version of windows you are on, you may need to separately install the WinUSB driver (see next section). Depending on what version of windows you are on, you may need to separately install the WinUSB driver (see next section).

@ -22,32 +22,32 @@
<ProjectGuid>{5528AEFB-638D-49AF-B9D4-965154E7D531}</ProjectGuid> <ProjectGuid>{5528AEFB-638D-49AF-B9D4-965154E7D531}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>panda</RootNamespace> <RootNamespace>panda</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

@ -14,21 +14,21 @@
<ProjectGuid>{7912F978-B48C-4C5D-8BFD-5D1E22158E47}</ProjectGuid> <ProjectGuid>{7912F978-B48C-4C5D-8BFD-5D1E22158E47}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>pandaJ2534DLLTest</RootNamespace> <RootNamespace>pandaJ2534DLLTest</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>Tests</ProjectName> <ProjectName>Tests</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc> <UseOfMfc>false</UseOfMfc>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc> <UseOfMfc>false</UseOfMfc>

@ -21,7 +21,7 @@ public:
} }
this->next_part = (this->next_part + 1) % 0x10; this->next_part = (this->next_part + 1) % 0x10;
unsigned int payload_len = MIN(expected_size - msg.size(), max_packet_size); unsigned int payload_len = min(expected_size - msg.size(), max_packet_size);
if (piece.size() < payload_len) { if (piece.size() < payload_len) {
//A frame was received that could have held more data. //A frame was received that could have held more data.
//No examples of this protocol show that happening, so //No examples of this protocol show that happening, so

@ -170,7 +170,7 @@ DWORD PandaJ2534Device::msg_tx_thread() {
} else { //Ran out of things that need to be sent now. Sleep! } else { //Ran out of things that need to be sent now. Sleep!
auto time_diff = std::chrono::duration_cast<std::chrono::milliseconds> auto time_diff = std::chrono::duration_cast<std::chrono::milliseconds>
(this->task_queue.front()->expire - std::chrono::steady_clock::now()); (this->task_queue.front()->expire - std::chrono::steady_clock::now());
sleepDuration = MAX(1, time_diff.count()); sleepDuration = max(1, time_diff.count());
goto break_flow_ctrl_loop; goto break_flow_ctrl_loop;
} }
} }

@ -14,19 +14,19 @@
<ProjectGuid>{A2BB18A5-F26B-48D6-BBB5-B83D64473C77}</ProjectGuid> <ProjectGuid>{A2BB18A5-F26B-48D6-BBB5-B83D64473C77}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>pandaJ2534DLL</RootNamespace> <RootNamespace>pandaJ2534DLL</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

@ -22,32 +22,32 @@
<ProjectGuid>{691DB635-C272-4B98-897E-0505B970DCA9}</ProjectGuid> <ProjectGuid>{691DB635-C272-4B98-897E-0505B970DCA9}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>panda_playground</RootNamespace> <RootNamespace>panda_playground</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

@ -39,7 +39,7 @@
namespace panda { namespace panda {
typedef enum _PANDA_SAFETY_MODE : uint16_t { typedef enum _PANDA_SAFETY_MODE : uint16_t {
SAFETY_SILENT = 0, SAFETY_SILENT = 0,
SAFETY_HONDA = 1, SAFETY_HONDA_NIDEC = 1,
SAFETY_ALLOUTPUT = 17, SAFETY_ALLOUTPUT = 17,
} PANDA_SAFETY_MODE; } PANDA_SAFETY_MODE;
@ -78,13 +78,23 @@ namespace panda {
#pragma pack(1) #pragma pack(1)
typedef struct _PANDA_HEALTH { typedef struct _PANDA_HEALTH {
uint32_t uptime;
uint32_t voltage; uint32_t voltage;
uint32_t current; uint32_t current;
uint8_t started; uint32_t can_rx_errs;
uint32_t can_send_errs;
uint32_t can_fwd_errs;
uint32_t gmlan_send_errs;
uint32_t faults;
uint8_t ignition_line;
uint8_t ignition_can;
uint8_t controls_allowed; uint8_t controls_allowed;
uint8_t gas_interceptor_detected; uint8_t gas_interceptor_detected;
uint8_t started_signal_detected; uint8_t car_harness_status;
uint8_t started_alt; uint8_t usb_power_mode;
uint8_t safety_mode;
uint8_t fault_status;
uint8_t power_save_enabled;
} PANDA_HEALTH, *PPANDA_HEALTH; } PANDA_HEALTH, *PPANDA_HEALTH;
typedef struct _PANDA_CAN_MSG { typedef struct _PANDA_CAN_MSG {

@ -7,7 +7,7 @@
;An list of the registry keys has been maintained here: https://stackoverflow.com/a/34209692/627525 ;An list of the registry keys has been maintained here: https://stackoverflow.com/a/34209692/627525
;Microsoft Visual C++ 2015 Redistributable (x86) - 14.0.24123 ;Microsoft Visual C++ 2015-2019 Redistributable (x86) - 14.24.28127
!define VCRuntimeRegKey "SOFTWARE\Classes\Installer\Dependencies\{206898cc-4b41-4d98-ac28-9f9ae57f91fe}" !define VCRuntimeRegKey "Installer\Dependencies\VC,redist.x86,x86,14.24,bundle"
!define VCRuntimeSetupPath "redist\" !define VCRuntimeSetupPath "redist\"
!define VCRuntimeSetupFile "vc_redist.x86.exe" !define VCRuntimeSetupFile "vc_redist.x86.exe"

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save