diff --git a/Makefile b/Makefile index f27ad8a..6a10604 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ DEVICE = atmega328p CLOCK = 16000000 PROGRAMMER = -c avrisp2 -P usb OBJECTS = main.o motion_control.o gcode.o spindle_control.o wiring_serial.o serial_protocol.o stepper.o \ - eeprom.o settings.o stepper_plan.o + eeprom.o settings.o planner.o # FUSES = -U hfuse:w:0xd9:m -U lfuse:w:0x24:m FUSES = -U hfuse:w:0xd2:m -U lfuse:w:0xff:m # update that line with this when programmer is back up: diff --git a/main.c b/main.c index 8da3363..030ae77 100644 --- a/main.c +++ b/main.c @@ -21,7 +21,7 @@ #include #include #include -#include "stepper_plan.h" +#include "planner.h" #include "stepper.h" #include "spindle_control.h" #include "motion_control.h" diff --git a/motion_control.c b/motion_control.c index 9ddfb2d..3e4d47c 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 "planner.h" #include "wiring_serial.h" @@ -41,7 +41,7 @@ void mc_dwell(uint32_t milliseconds) // 1/feed_rate minutes. void mc_line(double x, double y, double z, double feed_rate, int invert_feed_rate) { - st_buffer_line(x, y, z, feed_rate, invert_feed_rate); + plan_buffer_line(x, y, z, feed_rate, invert_feed_rate); } // Execute an arc. theta == start angle, angular_travel == number of radians to go along the arc, diff --git a/stepper_plan.c b/planner.c similarity index 99% rename from stepper_plan.c rename to planner.c index 3046ab3..ed2c633 100644 --- a/stepper_plan.c +++ b/planner.c @@ -1,5 +1,5 @@ /* - stepper_plan.c - buffers movement commands and manages the acceleration profile plan + planner.c - buffers movement commands and manages the acceleration profile plan Part of Grbl Copyright (c) 2009-2011 Simen Svale Skogsrud @@ -54,7 +54,7 @@ #include #include -#include "stepper_plan.h" +#include "planner.h" #include "nuts_bolts.h" #include "stepper.h" #include "settings.h" @@ -404,5 +404,6 @@ void plan_buffer_line(double x, double y, double z, double feed_rate, int invert memcpy(position, target, sizeof(target)); // position[] = target[] if (acceleration_manager_enabled) { planner_recalculate(); } + st_wake_up(); } diff --git a/stepper_plan.h b/planner.h similarity index 84% rename from stepper_plan.h rename to planner.h index 5aebbbb..f6281a1 100644 --- a/stepper_plan.h +++ b/planner.h @@ -1,5 +1,5 @@ /* - stepper_plan.h - buffers movement commands and manages the acceleration profile plan + planner.h - buffers movement commands and manages the acceleration profile plan Part of Grbl Copyright (c) 2009-2011 Simen Svale Skogsrud @@ -21,8 +21,8 @@ // This module is to be considered a sub-module of stepper.c. Please don't include // this file from any other module. -#ifndef stepper_plan_h -#define stepper_plan_h +#ifndef planner_h +#define planner_h #include @@ -59,11 +59,9 @@ extern int32_t position[3]; // Initialize the motion plan subsystem void plan_init(); -// Do not call directly unless you are writing a motor driver. In current iteration this is called by -// st_buffer_line which also wakes up the stepper subsystem. -// 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. +// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in +// millimaters. Feed rate specifies the speed of the motion. If feed rate is inverted, the feed +// rate is taken to mean "frequency" and would complete the operation in 1/feed_rate minutes. void plan_buffer_line(double x, double y, double z, double feed_rate, int invert_feed_rate); // Call when the current block is no longer needed. Discards the block and makes the memory diff --git a/stepper.c b/stepper.c index ddfd547..a75f4e1 100644 --- a/stepper.c +++ b/stepper.c @@ -30,7 +30,7 @@ #include #include "nuts_bolts.h" #include -#include "stepper_plan.h" +#include "planner.h" #include "wiring_serial.h" @@ -40,13 +40,14 @@ #define STEPPING_MASK (STEP_MASK | DIRECTION_MASK) // All stepping-related bits (step/direction) #define LIMIT_MASK ((1<