This commit is contained in:
Your Name
2024-05-02 01:07:51 -05:00
parent 95a98a8fe8
commit c55a879968
83 changed files with 3570 additions and 69 deletions

View File

@@ -234,6 +234,16 @@ static bool chrysler_tx_hook(const CANPacket_t *to_send) {
}
// FORCE CANCEL: only the cancel button press is allowed
// SG_ ACC_Cancel : 0|1@1+ (1,0) [0|0] "" XXX
// SG_ ACC_Distance_Dec : 1|1@1+ (1,0) [0|0] "" XXX
// SG_ ACC_Accel : 2|1@1+ (1,0) [0|0] "" XXX
// SG_ ACC_Decel : 3|1@1+ (1,0) [0|0] "" XXX
// SG_ ACC_Resume : 4|1@0+ (1,0) [0|1] "" XXX
// SG_ Cruise_OnOff : 6|1@1+ (1,0) [0|0] "" XXX
// SG_ ACC_OnOff : 7|1@1+ (1,0) [0|0] "" XXX
// SG_ ACC_Distance_Inc : 8|1@1+ (1,0) [0|0] "" XXX
// SG_ COUNTER : 15|4@0+ (1,0) [0|15] "" XXX
// SG_ CHECKSUM : 23|8@0+ (1,0) [0|255] "" XXX
if (addr == chrysler_addrs->CRUISE_BUTTONS) {
const bool is_cancel = GET_BYTE(to_send, 0) == 1U;
const bool is_resume = GET_BYTE(to_send, 0) == 0x10U;

View File

@@ -88,7 +88,7 @@ const uint16_t GM_PARAM_PEDAL_INTERCEPTOR = 256;
enum {
GM_BTN_UNPRESS = 1,
GM_BTN_RESUME = 2,
GM_BTN_SET = 3,
GM_BTN_SET = 3,
GM_BTN_CANCEL = 6,
};

View File

@@ -44,6 +44,7 @@ const CanMsg HYUNDAI_CANFD_HDA2_LONG_TX_MSGS[] = {
{0x200, 1, 8}, // ADRV_0x200
{0x345, 1, 8}, // ADRV_0x345
{0x1DA, 1, 32}, // ADRV_0x1da
};
const CanMsg HYUNDAI_CANFD_HDA1_TX_MSGS[] = {
@@ -243,18 +244,26 @@ static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) {
}
// cruise buttons check
// CLEARPILOT - TODO - Allow buttons 1 (accel), 2 (decel), 4 (pause/resume)
// CLEARPILOT - Allow buttons 1 (accel), 2 (decel), 4 (pause/resume)
if (addr == 0x1cf) {
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 allowed = (is_cancel && cruise_engaged_prev)
|| (is_resume && controls_allowed)
|| (is_resume && is_set_decel);
bool allowed = (is_cancel && cruise_engaged_prev) || (is_resume && controls_allowed);
if (!allowed) {
tx = false;
}
}
// CLEARPILOT - Allow DRIVE_MODE2
// if (addr == 1144) {
// }
// UDS: only tester present ("\x02\x3E\x80\x00\x00\x00\x00\x00") allowed on diagnostics address
if ((addr == 0x730) && hyundai_canfd_hda2) {
if ((GET_BYTES(to_send, 0, 4) != 0x00803E02U) || (GET_BYTES(to_send, 4, 4) != 0x0U)) {