From c8b53b9d0a341e978d6faa02359e409159f4a388 Mon Sep 17 00:00:00 2001 From: Sonny Jeon Date: Sun, 16 Dec 2012 16:58:44 -0700 Subject: [PATCH] Slow trailing steps fix. Added more defaults. - Fixed an issue (hopefully) with slow trailing steps after a triangular velocity profile move. Sets the trapezoid tick cycle counter to the correct value for an accurate reproduction of the deceleration curve. Keeps it from arriving too early to the target position, which causes the slow trailing steps. - Added Zen Toolworks 7x7 to default settings. - Updated readme with new edge build. --- .gitignore | 1 + README.md | 5 +++-- defaults.h | 46 +++++++++++++++++++++++++++++++++++++++------- stepper.c | 9 +++++++-- 4 files changed, 50 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 859370783..844cd7a67 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.hex *.o *.elf *.DS_Store diff --git a/README.md b/README.md index 44ddcda8a..e4ec6f998 100755 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ _**Master Branch:**_ * [Grbl v0.8c Atmega328p 16mhz 9600baud](http://bit.ly/SSdCJE) _**Edge/Development Branch:**_ -* [Grbl v0.9a Build 2012-12-10](http://bit.ly/UDBwpZ) +* [Grbl v0.9a Build 2012-12-16](http://bit.ly/UUTOD4) : Axes acceleration and maximum velocity independence installed. Lowered 20kHz step rate max. Bugs still exist. For testing only. Settings WILL be over-written. +* [Grbl v0.9a Build 2012-12-10](http://bit.ly/UDBwpZ) : New experimental stepper algorithm. Smoother. 30kHz max. Bugs exist (Homing). For testing only. Settings WILL be over-written. _**Archives:**_ * [Grbl v0.8a Atmega328p 16mhz 9600baud](http://bit.ly/TVCTVv) @@ -51,4 +52,4 @@ _**Archives:**_ *Important note for Atmega 168 users:* Going forward, support for Atmega 168 will be dropped due to its limited memory and speed. However, legacy Grbl v0.51 "in the branch called 'v0_51' is still available for use. -_The project was initially inspired by the Arduino GCode Interpreter by Mike Ellery_ +_The project was initially inspired by the Arduino GCode Interpreter by Mike Ellery_ \ No newline at end of file diff --git a/defaults.h b/defaults.h index 279e4b9be..30e575dd8 100644 --- a/defaults.h +++ b/defaults.h @@ -55,14 +55,14 @@ #endif #ifdef DEFAULTS_SHERLINE_5400 - // Description: Sherline 5400 mill with three NEMA 23 185 oz-in stepper motors, driven by - // three Pololu A4988 stepper drivers with a 30V, 6A power supply at 1.5A per winding. - #define MICROSTEPS 4 + // Description: Sherline 5400 mill with three NEMA 23 Keling KL23H256-21-8B 185 oz-in stepper motors, + // driven by three Pololu A4988 stepper drivers with a 30V, 6A power supply at 1.5A per winding. + #define MICROSTEPS 2 #define STEPS_PER_REV 200.0 - #define MM_PER_REV (0.050*MM_PER_INCH)) // 0.050 inch/rev leadscrew - #define DEFAULT_X_STEPS_PER_MM (STEP_PER_REV*MICROSTEPS/MM_PER_REV) - #define DEFAULT_Y_STEPS_PER_MM (STEP_PER_REV*MICROSTEPS/MM_PER_REV) - #define DEFAULT_Z_STEPS_PER_MM (STEP_PER_REV*MICROSTEPS/MM_PER_REV) + #define MM_PER_REV (0.050*MM_PER_INCH) // 0.050 inch/rev leadscrew + #define DEFAULT_X_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV) + #define DEFAULT_Y_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV) + #define DEFAULT_Z_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV) #define DEFAULT_STEP_PULSE_MICROSECONDS 10 #define DEFAULT_MM_PER_ARC_SEGMENT 0.1 #define DEFAULT_RAPID_FEEDRATE 635.0 // mm/min (25ipm) @@ -119,4 +119,36 @@ #define DEFAULT_N_ARC_CORRECTION 25 #endif +#ifdef DEFAULTS_ZEN_TOOLWORKS_7x7 + // Description: Zen Toolworks 7x7 mill with three Shinano SST43D2121 65oz-in NEMA 17 stepper motors. + // Leadscrew is different from some ZTW kits, where most are 1.25mm/rev rather than 8.0mm/rev here. + // Driven by 30V, 6A power supply and TI DRV8811 stepper motor drivers. + #define MICROSTEPS 8 + #define STEPS_PER_REV 200.0 + #define MM_PER_REV 8.0 // 8 mm/rev leadscrew + #define DEFAULT_X_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV) + #define DEFAULT_Y_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV) + #define DEFAULT_Z_STEPS_PER_MM (STEPS_PER_REV*MICROSTEPS/MM_PER_REV) + #define DEFAULT_STEP_PULSE_MICROSECONDS 10 + #define DEFAULT_MM_PER_ARC_SEGMENT 0.1 + #define DEFAULT_RAPID_FEEDRATE 2500.0 // mm/min + #define DEFAULT_FEEDRATE 1000.0 // mm/min + #define DEFAULT_ACCELERATION 150.0*60*60 // 150 mm/min^2 + #define DEFAULT_JUNCTION_DEVIATION 0.05 // mm + #define DEFAULT_STEPPING_INVERT_MASK (1<= current_block->decelerate_after) { // Reset trapezoid tick cycle counter to make sure that the deceleration is performed the // same every time. Reset to CYCLES_PER_ACCELERATION_TICK/2 to follow the midpoint rule for - // an accurate approximation of the deceleration curve. + // an accurate approximation of the deceleration curve. For triangle profiles, down count + // from current cycle counter to ensure exact deceleration curve. if (st.step_events_completed == current_block-> decelerate_after) { - st.trapezoid_tick_cycle_counter = CYCLES_PER_ACCELERATION_TICK/2; + if (st.trapezoid_adjusted_rate == current_block->nominal_rate) { + st.trapezoid_tick_cycle_counter = CYCLES_PER_ACCELERATION_TICK/2; // Trapezoid profile + } else { + st.trapezoid_tick_cycle_counter = CYCLES_PER_ACCELERATION_TICK-st.trapezoid_tick_cycle_counter; // Triangle profile + } } else { // Iterate cycle counter and check if speeds need to be reduced. if ( iterate_trapezoid_cycle_counter() ) {