mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-04 19:43:49 +08:00
Complete native safety type checks
This commit is contained in:
@@ -182,7 +182,6 @@ static bool hyundai_canfd_carnival_alt_resume = false;
|
||||
static bool hyundai_canfd_carnival_source_valid = false;
|
||||
static bool hyundai_canfd_carnival_previous_valid = false;
|
||||
static bool hyundai_canfd_carnival_counter_seen = false;
|
||||
static uint8_t hyundai_canfd_carnival_rx_counter = 0U;
|
||||
static bool hyundai_canfd_carnival_counter_consumed = false;
|
||||
static bool hyundai_canfd_angle_steering = false;
|
||||
static bool hyundai_canfd_angle_observed_adas = false;
|
||||
@@ -701,6 +700,7 @@ static void hyundai_canfd_rx_hook(const CANPacket_t *msg) {
|
||||
}
|
||||
}
|
||||
if (hyundai_canfd_carnival_alt_resume && (msg_matches(msg, 0x1aaU, pt_bus))) {
|
||||
static uint8_t hyundai_canfd_carnival_rx_counter = 0U;
|
||||
const bool source_fresh = !hyundai_canfd_carnival_counter_seen ||
|
||||
hyundai_canfd_button_counter_follows(hyundai_canfd_carnival_rx_counter, msg->data[2], 0xFFU);
|
||||
hyundai_canfd_carnival_counter_seen = true;
|
||||
|
||||
@@ -103,7 +103,8 @@ static void tesla_rx_hook(const CANPacket_t *msg) {
|
||||
const int angle_meas_new = (((msg->data[4] & 0x3FU) << 8) | msg->data[5]) - 8192U;
|
||||
update_sample(&angle_meas, angle_meas_new);
|
||||
|
||||
const int torsion_bar_torque = (int)(((msg->data[2] & 0x0FU) << 8) | msg->data[3]) - 2050;
|
||||
const unsigned int raw_torsion_bar_torque = ((msg->data[2] & 0x0FU) << 8) | msg->data[3];
|
||||
const int torsion_bar_torque = (int)raw_torsion_bar_torque - 2050;
|
||||
const int hands_on_level = msg->data[4] >> 6; // EPAS3S_handsOnLevel
|
||||
const int eac_status = msg->data[6] >> 5; // EPAS3S_eacStatus
|
||||
const int eac_error_code = msg->data[2] >> 4; // EPAS3S_eacErrorCode
|
||||
|
||||
Reference in New Issue
Block a user