safety replay: support Nissan (#1753)

* nissan safety replay

* hex
This commit is contained in:
Shane Smiskol 2023-11-30 01:07:25 -06:00 committed by GitHub
parent 2ee6e36e99
commit c57a3c2d15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,8 @@ def is_steering_msg(mode, param, addr):
ret = addr == 0x122
elif mode == Panda.SAFETY_FORD:
ret = addr == 0x3d3
elif mode == Panda.SAFETY_NISSAN:
ret = addr == 0x169
return ret
def get_steer_value(mode, param, to_send):
@ -49,6 +51,9 @@ def get_steer_value(mode, param, to_send):
torque = -to_signed(torque, 13)
elif mode == Panda.SAFETY_FORD:
angle = ((to_send.data[0] << 3) | (to_send.data[1] >> 5)) - 1000
elif mode == Panda.SAFETY_NISSAN:
angle = (to_send.data[0] << 10) | (to_send.data[1] << 2) | (to_send.data[2] >> 6)
angle = -angle + (1310 * 100)
return torque, angle
def package_can_msg(msg):