Subaru FPv2 support (#1878)

* Add Subaru FPv2 support

* Add Subaru Ascent and Impreza FPv2 values

* Remove 10 second delay, use UDS for Subaru FPv2

* before VW

* before hyundai

Co-authored-by: Willem Melching <willem.melching@gmail.com>
pull/23326/head
martinl 2022-01-04 12:06:29 +02:00 committed by GitHub
parent 1ca5e1c82b
commit 6b205347e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 0 deletions

View File

@ -84,8 +84,21 @@ NISSAN_VERSION_RESPONSE_STANDARD = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIF
NISSAN_RX_OFFSET = 0x20
SUBARU_VERSION_REQUEST = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER]) + \
p16(uds.DATA_IDENTIFIER_TYPE.APPLICATION_DATA_IDENTIFICATION)
SUBARU_VERSION_RESPONSE = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER + 0x40]) + \
p16(uds.DATA_IDENTIFIER_TYPE.APPLICATION_DATA_IDENTIFICATION)
# brand, request, response, response offset
REQUESTS = [
# Subaru
(
"subaru",
[TESTER_PRESENT_REQUEST, SUBARU_VERSION_REQUEST],
[TESTER_PRESENT_RESPONSE, SUBARU_VERSION_RESPONSE],
DEFAULT_RX_OFFSET,
),
# Hyundai
(
"hyundai",

View File

@ -81,6 +81,53 @@ FINGERPRINTS = {
}],
}
FW_VERSIONS = {
CAR.ASCENT: {
# 2019 Ascent UDM
# Ecu, addr, subaddr: ROM ID
(Ecu.esp, 0x7b0, None): [
b'\xa5 \x19\x02\x00',
],
(Ecu.eps, 0x746, None): [
b'\x85\xc0\xd0\x00',
],
(Ecu.fwdCamera, 0x787, None): [
b'\x00\x00d\xb9\x1f@ \x10',
],
(Ecu.engine, 0x7e0, None): [
b'\xbb,\xa0t\a',
],
(Ecu.transmission, 0x7e1, None): [
b'\x00\xfe\xf7\x00\x00',
],
},
CAR.IMPREZA: {
# 2018 Crosstrek EDM
# 2018 Impreza ADM
# Ecu, addr, subaddr: ROM ID
(Ecu.esp, 0x7b0, None): [
b'\x7a\x94\x3f\x90\x00',
b'\xa2 \x185\x00',
],
(Ecu.eps, 0x746, None): [
b'\x7a\xc0\x0c\x00',
b'z\xc0\b\x00',
],
(Ecu.fwdCamera, 0x787, None): [
b'\x00\x00\x64\xb5\x1f\x40\x20\x0e',
b'\x00\x00d\xdc\x1f@ \x0e',
],
(Ecu.engine, 0x7e0, None): [
b'\xaa\x61\x66\x73\x07',
b'\xbeacr\a',
],
(Ecu.transmission, 0x7e1, None): [
b'\xe3\xe5\x46\x31\x00',
b'\xe4\xe5\x061\x00',
],
},
}
STEER_THRESHOLD = {
CAR.ASCENT: 80,
CAR.IMPREZA: 80,