wip
This commit is contained in:
@@ -21,12 +21,14 @@ const SteeringLimits HYUNDAI_CANFD_STEERING_LIMITS = {
|
|||||||
const CanMsg HYUNDAI_CANFD_HDA2_TX_MSGS[] = {
|
const CanMsg HYUNDAI_CANFD_HDA2_TX_MSGS[] = {
|
||||||
{0x50, 0, 16}, // LKAS
|
{0x50, 0, 16}, // LKAS
|
||||||
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
||||||
|
{426, 1, 16}, // CRUISE_BUTTON_ALT (clearpilot)
|
||||||
{0x2A4, 0, 24}, // CAM_0x2A4
|
{0x2A4, 0, 24}, // CAM_0x2A4
|
||||||
};
|
};
|
||||||
|
|
||||||
const CanMsg HYUNDAI_CANFD_HDA2_ALT_STEERING_TX_MSGS[] = {
|
const CanMsg HYUNDAI_CANFD_HDA2_ALT_STEERING_TX_MSGS[] = {
|
||||||
{0x110, 0, 32}, // LKAS_ALT
|
{0x110, 0, 32}, // LKAS_ALT
|
||||||
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
||||||
|
{426, 1, 16}, // CRUISE_BUTTONS_ALT (clearpilot)
|
||||||
{0x362, 0, 32}, // CAM_0x362
|
{0x362, 0, 32}, // CAM_0x362
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -249,7 +251,7 @@ static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) {
|
|||||||
int button = GET_BYTE(to_send, 2) & 0x7U;
|
int button = GET_BYTE(to_send, 2) & 0x7U;
|
||||||
bool is_cancel = (button == HYUNDAI_BTN_CANCEL);
|
bool is_cancel = (button == HYUNDAI_BTN_CANCEL);
|
||||||
bool is_resume = (button == HYUNDAI_BTN_RESUME);
|
bool is_resume = (button == HYUNDAI_BTN_RESUME);
|
||||||
bool is_set_decel = (button == 2);
|
bool is_set_decel = (button == HYUNDAI_BTN_SET);
|
||||||
|
|
||||||
// bool allowed = (is_cancel && cruise_engaged_prev)
|
// bool allowed = (is_cancel && cruise_engaged_prev)
|
||||||
// Todo: allow is_cancel anytime speed > 0 on cruiseState
|
// Todo: allow is_cancel anytime speed > 0 on cruiseState
|
||||||
@@ -262,6 +264,25 @@ static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CRUISE_BUTTONS_ALT
|
||||||
|
// if (addr == 426) {
|
||||||
|
// // this gets bit 16 we want bit 36
|
||||||
|
// int button = GET_BYTE(to_send, 2) & 0x7byteU;
|
||||||
|
// bool is_cancel = (button == HYUNDAI_BTN_CANCEL);
|
||||||
|
// bool is_resume = (button == HYUNDAI_BTN_RESUME);
|
||||||
|
// bool is_set_decel = (button == HYUNDAI_BTN_SET);
|
||||||
|
// // Canfd doc says there is a value 4 button allowed for canfd too, which one is it?
|
||||||
|
// // bool allowed = (is_cancel && cruise_engaged_prev)
|
||||||
|
// // Todo: allow is_cancel anytime speed > 0 on cruiseState
|
||||||
|
// bool allowed = (is_cancel)
|
||||||
|
// || (is_resume && controls_allowed)
|
||||||
|
// || (is_set_decel && controls_allowed);
|
||||||
|
|
||||||
|
// if (!allowed) {
|
||||||
|
// tx = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// CLEARPILOT - Allow DRIVE_MODE2
|
// CLEARPILOT - Allow DRIVE_MODE2
|
||||||
// if (addr == 1144) {
|
// if (addr == 1144) {
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ class CarController(CarControllerBase):
|
|||||||
if (self.frame - self.last_button_frame) * DT_CTRL > 0.25:
|
if (self.frame - self.last_button_frame) * DT_CTRL > 0.25:
|
||||||
# cruise cancel
|
# cruise cancel
|
||||||
if CC.cruiseControl.cancel:
|
if CC.cruiseControl.cancel:
|
||||||
if False and self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
|
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
|
||||||
can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info))
|
can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info))
|
||||||
self.last_button_frame = self.frame
|
self.last_button_frame = self.frame
|
||||||
CS.lkas_trigger_result = 1
|
CS.lkas_trigger_result = 1
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ def create_buttons(packer, CP, CAN, cnt, btn):
|
|||||||
bus = CAN.ECAN if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM
|
bus = CAN.ECAN if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM
|
||||||
return packer.make_can_msg("CRUISE_BUTTONS", bus, values)
|
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,
|
||||||
|
# "CRUISE_BUTTONS": btn,
|
||||||
|
# }
|
||||||
|
|
||||||
|
# bus = CAN.ECAN if CP.flags & HyundaiFlags.CANFD_HDA2 else CAN.CAM
|
||||||
|
# return packer.make_can_msg("CRUISE_BUTTONS_ALT", bus, values)
|
||||||
|
|
||||||
def create_acc_cancel(packer, CP, CAN, cruise_info_copy):
|
def create_acc_cancel(packer, CP, CAN, cruise_info_copy):
|
||||||
# TODO: why do we copy different values here?
|
# TODO: why do we copy different values here?
|
||||||
if CP.flags & HyundaiFlags.CANFD_CAMERA_SCC.value:
|
if CP.flags & HyundaiFlags.CANFD_CAMERA_SCC.value:
|
||||||
|
|||||||
Reference in New Issue
Block a user