From c1e79333fb4f6eb58ded57b2f808641031caacc9 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 6 Jul 2023 17:06:31 -0700 Subject: [PATCH] angle safety: make angle conversion factor a float (#1498) * make this a float * no need to cast to float now --- board/safety/safety_ford.h | 2 +- board/safety_declarations.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/board/safety/safety_ford.h b/board/safety/safety_ford.h index b25262ca2..98cf204d9 100644 --- a/board/safety/safety_ford.h +++ b/board/safety/safety_ford.h @@ -219,7 +219,7 @@ static int ford_rx_hook(CANPacket_t *to_push) { float ford_yaw_rate = (((GET_BYTE(to_push, 2) << 8U) | GET_BYTE(to_push, 3)) * 0.0002) - 6.5; float current_curvature = ford_yaw_rate / MAX(vehicle_speed.values[0] / VEHICLE_SPEED_FACTOR, 0.1); // convert current curvature into units on CAN for comparison with desired curvature - update_sample(&angle_meas, ROUND(current_curvature * (float)FORD_STEERING_LIMITS.angle_deg_to_can)); + update_sample(&angle_meas, ROUND(current_curvature * FORD_STEERING_LIMITS.angle_deg_to_can)); } // Update gas pedal diff --git a/board/safety_declarations.h b/board/safety_declarations.h index 393e55467..b2f0ea985 100644 --- a/board/safety_declarations.h +++ b/board/safety_declarations.h @@ -67,7 +67,7 @@ typedef struct { const bool has_steer_req_tolerance; // angle cmd limits - const int angle_deg_to_can; + const float angle_deg_to_can; const struct lookup_t angle_rate_up_lookup; const struct lookup_t angle_rate_down_lookup; const int max_angle_error; // used to limit error between meas and cmd while enabled