Skip to content

Commit

Permalink
Fixed typo and simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
ssejrog committed Jan 9, 2025
1 parent 9f5eac4 commit 3d65ff0
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/EZ-Template/drive/maintenance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,9 @@ void Drive::check_imu_task() {
// erase indices only if imu val equals previous one
good_imus.erase(std::remove_if(good_imus.begin(), good_imus.end(), [this](pros::Imu *n) { return n->get_status() == pros::ImuStatus::error || errno == PROS_ERR || get_this_imu(n) == prev_imu_values[n->get_port()]; }), good_imus.end());

for (size_t i = 0; i < good_imus.size(); i++) {
for (size_t i = 0; i < good_imus.size(); i++)
prev_imu_values[good_imus[i]->get_port()] = get_this_imu(good_imus[i]);
}

double imu_val = drive_imu_scaler_get();
if ((imu->get_status() == pros::ImuStatus::error || errno == PROS_ERR || prev_imu_value == imu_val) && !good_imus.empty()) // not sure if errno is needed yet. I think it is??
{
// switch due to an error
good_imus.pop_front();
if (!good_imus.empty()) {
imu = good_imus.front();
}
}
prev_imu_value = imu_val;
if (!good_imus.empty())
imu = good_imus.front();
}

0 comments on commit 3d65ff0

Please sign in to comment.