From b879b6790fb11ddad1cc8346d24d269830d941f9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 20 May 2024 23:52:07 -0500 Subject: [PATCH] wip --- selfdrive/car/hyundai/hyundaicanfd.py | 87 ++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 14 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaicanfd.py b/selfdrive/car/hyundai/hyundaicanfd.py index 5a4f931..ea47bed 100755 --- a/selfdrive/car/hyundai/hyundaicanfd.py +++ b/selfdrive/car/hyundai/hyundaicanfd.py @@ -88,25 +88,84 @@ def create_buttons(packer, CP, CAN, cnt, btn): bus = CAN.ECAN if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM return packer.make_can_msg("CRUISE_BUTTONS", bus, values) -# def create_buttons_alt(packer, CP, CAN, cnt, btn): -# values = { -# "COUNTER": cnt, -# "SET_ME_1": 1, -# "SET_ME_2": 2, -# "CRUISE_BUTTONS": btn, -# } +# null +# {'CHECKSUM': [], 'COUNTER': [], 'NEW_SIGNAL_1': [], 'SET_ME_1': [], 'DISTANCE_UNIT': [], +# 'NEW_SIGNAL_2': [], 'ADAPT +# IVE_CRUISE_MAIN_BTN': [], 'NEW_SIGNAL_3': [], 'LFA_BTN': [], 'CRUISE_BUTTONS': [], +# 'NEW_SIGNAL_4': [], 'NORMAL_CRUI +# SE_MAIN_BTN': [], 'NEW_SIGNAL_5': [], 'SET_ME_2': [], 'NEW_SIGNAL_6': [], 'BYTE6': [], +# 'BYTE7': [], 'BYTE8': [], 'B +# YTE9': [], 'BYTE10': [], 'BYTE11': [], 'BYTE12': [], 'BYTE13': [], 'BYTE14': [], +# 'BYTE15': []} -# bus = CAN.ECAN # if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM -# return packer.make_can_msg("CRUISE_BUTTONS_ALT", bus, values) +# holding down up button +# {'CHECKSUM': [5774.0], 'COUNTER': [63.0], 'NEW_SIGNAL_1': [0.0], 'SET_ME_1': +# [0.0], 'DISTANCE_UNIT': [1.0], 'NEW_SIGNAL_2': [4.0], 'ADAPTIVE_CRUISE_MAIN_BTN': +# [0.0], 'NEW_SIGNAL_3': [0.0], 'LFA_BTN': [0.0], 'CRUISE_BUTTONS': [1.0], +# 'NEW_SIGNAL_4': [0.0], 'NORMAL_CRUISE_MAIN_BTN': [0.0], 'NEW_SIGNAL_5': [0.0], +# 'SET_ME_2': [2.0], 'NEW_SIGNAL_6': [1.0], 'BYTE6': [32.0], 'BYTE7': [0.0], +# 'BYTE8': [26.0], 'BYTE9': [0.0], 'BYTE10': [0.0], 'BYTE11': [0.0], 'BYTE12': +# [0.0], 'BYTE13': [0.0], 'BYTE14': [0.0], 'BYTE15': [0.0]} + +# {'CHECKSUM': [14783.0], 'COUNTER': [150.0], 'NEW_SIGNAL_1': [0.0], +# 'SET_ME_1': [0.0], 'DISTANCE_UNIT': [1.0], 'NEW_ +# SIGNAL_2': [6.0], 'ADAPTIVE_CRUISE_MAIN_BTN': [0.0], 'NEW_SIGNAL_3': [0.0], +# 'LFA_BTN': [0.0], 'CRUISE_BUTTONS': [1. +# 0], 'NEW_SIGNAL_4': [0.0], 'NORMAL_CRUISE_MAIN_BTN': [0.0], 'NEW_SIGNAL_5': +# [0.0], 'SET_ME_2': [2.0], 'NEW_SIGNAL_6 +# ': [1.0], 'BYTE6': [37.0], 'BYTE7': [0.0], 'BYTE8': [30.0], 'BYTE9': [0.0], +# 'BYTE10': [0.0], 'BYTE11': [0.0], 'BYTE +# 12': [0.0], 'BYTE13': [0.0], 'BYTE14': [0.0], 'BYTE15': [0.0]} + +# {'CHECKSUM': [61602.0], 'COUNTER': [153.0], 'NEW_SIGNAL_1': [0.0], 'SET_ME_1': +# [0.0], 'DISTANCE_UNIT': [1.0], 'NEW_ +# SIGNAL_2': [0.0], 'ADAPTIVE_CRUISE_MAIN_BTN': [0.0], 'NEW_SIGNAL_3': [0.0], +# 'LFA_BTN': [1.0], 'CRUISE_BUTTONS': [1. +# 0], 'NEW_SIGNAL_4': [0.0], 'NORMAL_CRUISE_MAIN_BTN': [0.0], 'NEW_SIGNAL_5': +# [0.0], 'SET_ME_2': [2.0], 'NEW_SIGNAL_6 +# ': [1.0], 'BYTE6': [38.0], 'BYTE7': [0.0], 'BYTE8': [31.0], 'BYTE9': [0.0], +# 'BYTE10': [0.0], 'BYTE11': [0.0], 'BYTE +# 12': [0.0], 'BYTE13': [0.0], 'BYTE14': [0.0], 'BYTE15': [0.0]} -def create_buttons_alt(packer, CP, CAN, cnt, btn, template): - template.update({ - "CRUISE_BUTTONS": btn - }) +def create_buttons_alt(packer, CP, CAN, cnt, btn): + values = { + "COUNTER": cnt, + "NEW_SIGNAL_1": 0.0, + "DISTANCE_UNIT": 1.0, + "SET_ME_1": 0.0, + "NEW_SIGNAL_2": 0.0, + "ADAPTIVE_CRUISE_MAIN_BTN": 0.0, + "NEW_SIGNAL_3": 0.0, + "CRUISE_BUTTONS": btn * 1.0, + "NEW_SIGNAL_4": 0.0, + "NORMAL_CRUISE_MAIN_BTN": 0.0, + "NEW_SIGNAL_5": 0.0, + "SET_ME_2": 2.0, + "NEW_SIGNAL_5": 1.0, + "BYTE_6": 38.0, # Target speed? + "BYTE_7": 0.0, + "BYTE_8": 31.0, # Current spedometer speed? + "BYTE_9": 0.0, + "BYTE_10": 0.0, + "BYTE_11": 0.0, + "BYTE_12": 0.0, + "BYTE_13": 0.0, + "BYTE_14": 0.0, + "BYTE_15": 0.0, + } bus = CAN.ECAN # if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM - return packer.make_can_msg("CRUISE_BUTTONS_ALT", bus, template) + return packer.make_can_msg("CRUISE_BUTTONS_ALT", bus, values) + + +# def create_buttons_alt(packer, CP, CAN, cnt, btn, template): +# template.update({ +# "CRUISE_BUTTONS": btn +# }) + +# bus = CAN.ECAN # if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM +# return packer.make_can_msg("CRUISE_BUTTONS_ALT", bus, template) def create_acc_set_speed(packer, CP, CAN, cruise_info_copy, speed):