Skip to content

Commit

Permalink
🐛Fixed Imu::is_calibrating function for PROS 3 #626 (#628)
Browse files Browse the repository at this point in the history
* Updated Imu::is_calibrating function

* Update main.cpp

* Updated enum for imu_status_e

Update to properly reflect what get_status returns

* Added comments to imu.h

Elaborating on imu_status_e value types

* Reverted main.cpp
  • Loading branch information
Gracelu128 authored Mar 12, 2024
1 parent 1e7513d commit dbb4599
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/pros/imu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ namespace c {
#endif

typedef enum imu_status_e {
E_IMU_STATUS_CALIBRATING = 0x01,
E_IMU_STATUS_READY = 0, // IMU is connected but not currently calibrating
E_IMU_STATUS_CALIBRATING = 19, // IMU is calibrating
E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is
// necessarily in an error state
} imu_status_e_t;
Expand Down
2 changes: 1 addition & 1 deletion src/devices/vdml_imu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pros::c::imu_status_e_t Imu::get_status() const {
}

bool Imu::is_calibrating() const {
return get_status() & pros::c::E_IMU_STATUS_CALIBRATING;
return get_status() == pros::c::E_IMU_STATUS_CALIBRATING;
}

std::int32_t Imu::tare_heading() const {
Expand Down

0 comments on commit dbb4599

Please sign in to comment.