From 411494c7f02707f551a4f7f071f14c962d7b475f Mon Sep 17 00:00:00 2001 From: PAJohnson Date: Mon, 12 Apr 2021 20:28:40 -0400 Subject: [PATCH] Revert "Fixed the encoder offset calibration to work correctly when calib_scan_distance is not a multiple of 4pi" This reverts commit b52cd87fa2de122b0d4a611ff4472d9900838aea. Reverted fix - see `bug_fixes` branch instead --- CHANGELOG.md | 3 --- Firmware/MotorControl/encoder.cpp | 7 ++----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31aec573..25943d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,6 @@ # Unreleased Features Please add a note of your changes below this heading if you make a Pull Request. -### Changed -Fixed the encoder offset calibration to work correctly when calib_scan_distance is not a multiple of 4pi - # Releases ## [0.5.1] - 2020-09-27 ### Added diff --git a/Firmware/MotorControl/encoder.cpp b/Firmware/MotorControl/encoder.cpp index de9986c5..2c465988 100644 --- a/Firmware/MotorControl/encoder.cpp +++ b/Firmware/MotorControl/encoder.cpp @@ -202,13 +202,10 @@ bool Encoder::run_offset_calibration() { else return false; - // go to start position of forward scan for start_lock_duration to get ready to scan + // go to motor zero phase for start_lock_duration to get ready to scan int i = 0; axis_->run_control_loop([&](){ - float phase = wrap_pm_pi(0 - config_.calib_scan_distance / 2.0f); - float v_alpha = voltage_magnitude * our_arm_cos_f32(phase); - float v_beta = voltage_magnitude * our_arm_sin_f32(phase); - if (!axis_->motor_.enqueue_voltage_timings(v_alpha, v_beta)) + if (!axis_->motor_.enqueue_voltage_timings(voltage_magnitude, 0.0f)) return false; // error set inside enqueue_voltage_timings axis_->motor_.log_timing(TIMING_LOG_ENC_CALIB); return ++i < start_lock_duration * current_meas_hz;