diff --git a/motion_control.c b/motion_control.c index 3529c3c..17f2b9f 100644 --- a/motion_control.c +++ b/motion_control.c @@ -26,7 +26,7 @@ #include #include "nuts_bolts.h" #include "stepper.h" - +#include "stepper_plan.h" #include "wiring_serial.h" int32_t position[3]; // The current position of the tool in absolute steps @@ -42,6 +42,14 @@ void mc_dwell(uint32_t milliseconds) _delay_ms(milliseconds); } +void mc_set_acceleration_manager_enabled(uint8_t enabled) { + if (enabled) { + plan_enable_acceleration_management(); + } else { + plan_disable_acceleration_management(); + } +} + // Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second // unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in // 1/feed_rate minutes. diff --git a/motion_control.h b/motion_control.h index b9104c5..ae45247 100644 --- a/motion_control.h +++ b/motion_control.h @@ -23,9 +23,13 @@ #include + // Initializes the motion_control subsystem resources void mc_init(); +// Enables or disables the look ahead acceleration manager. (Default: on) +void mc_set_acceleration_manager_enabled(uint8_t enabled); + // Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second // unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in // (1 minute)/feed_rate time. diff --git a/stepper_plan.c b/stepper_plan.c index 3d0f996..2cbec52 100644 --- a/stepper_plan.c +++ b/stepper_plan.c @@ -303,7 +303,6 @@ void plan_disable_acceleration_management() { } } - // Add a new linear movement to the buffer. steps_x, _y and _z is the signed, relative motion in // steps. Microseconds specify how many microseconds the move should take to perform. To aid acceleration // calculation the caller must also provide the physical length of the line in millimeters.