Honda Clarity Port
Co-Authored-By: mike8643 <98910897+mike8643@users.noreply.github.com>
This commit is contained in:
@@ -90,6 +90,7 @@ const uint16_t HONDA_PARAM_BOSCH_LONG = 2;
|
||||
const uint16_t HONDA_PARAM_NIDEC_ALT = 4;
|
||||
const uint16_t HONDA_PARAM_RADARLESS = 8;
|
||||
const uint16_t HONDA_PARAM_GAS_INTERCEPTOR = 16;
|
||||
const uint16_t HONDA_PARAM_CLARITY = 32;
|
||||
|
||||
enum {
|
||||
HONDA_BTN_NONE = 0,
|
||||
@@ -105,6 +106,7 @@ bool honda_alt_brake_msg = false;
|
||||
bool honda_fwd_brake = false;
|
||||
bool honda_bosch_long = false;
|
||||
bool honda_bosch_radarless = false;
|
||||
bool honda_clarity_brake_msg = false;
|
||||
enum {HONDA_NIDEC, HONDA_BOSCH} honda_hw = HONDA_NIDEC;
|
||||
|
||||
|
||||
@@ -245,6 +247,9 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
|
||||
bool honda_stock_aeb = GET_BIT(to_push, 29U);
|
||||
int honda_stock_brake = (GET_BYTE(to_push, 0) << 2) | (GET_BYTE(to_push, 1) >> 6);
|
||||
|
||||
if (honda_clarity_brake_msg) {
|
||||
honda_stock_brake = (GET_BYTE(to_push, 6) << 2) + ((GET_BYTE(to_push, 7) >> 6) & 0x3U);
|
||||
}
|
||||
// Forward AEB when stock braking is higher than openpilot braking
|
||||
// only stop forwarding when AEB event is over
|
||||
if (!honda_stock_aeb) {
|
||||
@@ -303,6 +308,9 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
|
||||
// BRAKE: safety check (nidec)
|
||||
if ((addr == 0x1FA) && (bus == bus_pt)) {
|
||||
honda_brake = (GET_BYTE(to_send, 0) << 2) + ((GET_BYTE(to_send, 1) >> 6) & 0x3U);
|
||||
if (honda_clarity_brake_msg) {
|
||||
honda_brake = (GET_BYTE(to_send, 6) << 2) + ((GET_BYTE(to_send, 7) >> 6) & 0x3U);
|
||||
}
|
||||
if (longitudinal_brake_checks(honda_brake, HONDA_NIDEC_LONG_LIMITS)) {
|
||||
tx = false;
|
||||
}
|
||||
@@ -401,6 +409,7 @@ static safety_config honda_nidec_init(uint16_t param) {
|
||||
honda_bosch_long = false;
|
||||
honda_bosch_radarless = false;
|
||||
enable_gas_interceptor = GET_FLAG(param, HONDA_PARAM_GAS_INTERCEPTOR);
|
||||
honda_clarity_brake_msg = GET_FLAG(param, HONDA_PARAM_CLARITY);
|
||||
|
||||
safety_config ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user