acceleration= NAN;
selected= true;
+ this->set_direction(false);
+
this->register_for_event(ON_HALT);
this->register_for_event(ON_ENABLE);
}
current_position_steps= last_milestone_steps;
}
-int StepperMotor::steps_to_target(float target)
+void StepperMotor::update_last_milestones(float mm, int32_t steps)
+{
+ last_milestone_steps += steps;
+ last_milestone_mm = mm;
+}
+
+int32_t StepperMotor::steps_to_target(float target)
{
int32_t target_steps = lroundf(target * steps_per_mm);
return target_steps - last_milestone_steps;
}
// Does a manual step pulse, used for direct encoder control of a stepper
+// NOTE this is experimental and may change and/or be reomved in the future, it is an unsupported feature.
+// use at your own risk
void StepperMotor::manual_step(bool dir)
{
if(!is_enabled()) enable(true);