ui/get_path_length_idx: line_x[i] shoud be less than or equal to path_height (#23336)

* start loop index from 1

* use  islessequal

* use build in <=
This commit is contained in:
Dean Lee
2022-01-04 19:04:52 +08:00
committed by GitHub
parent 960e0cf6a7
commit 9295066dac
+1 -1
View File
@@ -36,7 +36,7 @@ static bool calib_frame_to_full_frame(const UIState *s, float in_x, float in_y,
static int get_path_length_idx(const cereal::ModelDataV2::XYZTData::Reader &line, const float path_height) {
const auto line_x = line.getX();
int max_idx = 0;
for (int i = 0; i < TRAJECTORY_SIZE && line_x[i] < path_height; ++i) {
for (int i = 1; i < TRAJECTORY_SIZE && line_x[i] <= path_height; ++i) {
max_idx = i;
}
return max_idx;