diff --git a/src/hal/tmc2130.cpp b/src/hal/tmc2130.cpp index 597b512..eb00727 100644 --- a/src/hal/tmc2130.cpp +++ b/src/hal/tmc2130.cpp @@ -104,11 +104,11 @@ void TMC2130::SetEnabled(const MotorParams ¶ms, bool enabled) { bool TMC2130::CheckForErrors(const MotorParams ¶ms) { uint32_t GSTAT = ReadRegister(params, Registers::GSTAT); uint32_t DRV_STATUS = ReadRegister(params, Registers::DRV_STATUS); - errorFlags.reset_flag |= GSTAT & (1U << 0U); - errorFlags.uv_cp = GSTAT & (1U << 2U); - errorFlags.s2g = DRV_STATUS & (3UL << 27U); - errorFlags.otpw = DRV_STATUS & (1UL << 26U); - errorFlags.ot = DRV_STATUS & (1UL << 25U); + errorFlags.reset_flag |= !!(GSTAT & (1U << 0U)); + errorFlags.uv_cp = !!(GSTAT & (1U << 2U)); + errorFlags.s2g = !!(DRV_STATUS & (3UL << 27U)); + errorFlags.otpw = !!(DRV_STATUS & (1UL << 26U)); + errorFlags.ot = !!(DRV_STATUS & (1UL << 25U)); return GSTAT || errorFlags.reset_flag; //any bit in gstat is an error }