GM: add checksum to button message (#26014)
* Add GM button msg checksum * checksum that works for both, fix missing bit * bump opendbc * update comment Co-authored-by: Shane Smiskol <shane@smiskol.com> old-commit-hash: 2f83b9872fe991d21e07a95cc518f91f140a856a
This commit is contained in:
2
opendbc
2
opendbc
Submodule opendbc updated: 1f8aa057bc...bb71829028
@@ -6,7 +6,16 @@ def create_buttons(packer, bus, idx, button):
|
||||
values = {
|
||||
"ACCButtons": button,
|
||||
"RollingCounter": idx,
|
||||
"ACCAlwaysOne": 1,
|
||||
"DistanceButton": 0,
|
||||
}
|
||||
|
||||
checksum = 240 + int(values["ACCAlwaysOne"] * 0xf)
|
||||
checksum += values["RollingCounter"] * (0x4ef if values["ACCAlwaysOne"] != 0 else 0x3f0)
|
||||
checksum -= int(values["ACCButtons"] - 1) << 4 # not correct if value is 0
|
||||
checksum -= 2 * values["DistanceButton"]
|
||||
|
||||
values["SteeringButtonChecksum"] = checksum
|
||||
return packer.make_can_msg("ASCMSteeringButton", bus, values)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user