This commit is contained in:
Your Name
2024-05-04 02:27:40 -05:00
parent 0328d5737c
commit 28338468d3
3 changed files with 33 additions and 2 deletions

View File

@@ -21,12 +21,14 @@ const SteeringLimits HYUNDAI_CANFD_STEERING_LIMITS = {
const CanMsg HYUNDAI_CANFD_HDA2_TX_MSGS[] = {
{0x50, 0, 16}, // LKAS
{0x1CF, 1, 8}, // CRUISE_BUTTON
{426, 1, 16}, // CRUISE_BUTTON_ALT (clearpilot)
{0x2A4, 0, 24}, // CAM_0x2A4
};
const CanMsg HYUNDAI_CANFD_HDA2_ALT_STEERING_TX_MSGS[] = {
{0x110, 0, 32}, // LKAS_ALT
{0x1CF, 1, 8}, // CRUISE_BUTTON
{426, 1, 16}, // CRUISE_BUTTONS_ALT (clearpilot)
{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;
bool is_cancel = (button == HYUNDAI_BTN_CANCEL);
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)
// 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
// if (addr == 1144) {
// }