From ec2cd83f1fd4cc16dcc91ebd01d60746dabf0764 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 24 Aug 2019 23:48:16 -0400 Subject: [PATCH] Add compensation term for axis debounce during homing --- Firmware/MotorControl/axis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/MotorControl/axis.cpp b/Firmware/MotorControl/axis.cpp index 311b4886..51a66c18 100644 --- a/Firmware/MotorControl/axis.cpp +++ b/Firmware/MotorControl/axis.cpp @@ -320,7 +320,7 @@ bool Axis::run_closed_loop_control_loop() { controller_.vel_setpoint_ = 0.0f; // Change directions without decelerating // Set our current position in encoder counts to make control more logical - encoder_.set_linear_count(min_endstop_.config_.offset); + encoder_.set_linear_count(min_endstop_.config_.offset - static_cast(controller_.config_.homing_speed * min_endstop_.config_.debounce_ms / 1000.0f)); controller_.config_.control_mode = Controller::CTRL_MODE_POSITION_CONTROL; controller_.config_.input_mode = Controller::INPUT_MODE_TRAP_TRAJ;