Fixed some small planner bugs
This commit is contained in:
parent
5fd41ae872
commit
805d37f77b
@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
// Frequency limit
|
// Frequency limit
|
||||||
// See nophead's blog for more info
|
// See nophead's blog for more info
|
||||||
#define XY_FREQUENCY_LIMIT 15
|
// Not working OK
|
||||||
|
//#define XY_FREQUENCY_LIMIT 15
|
||||||
|
|
||||||
// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
|
// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
|
||||||
// of the buffer and all stops. This should not be much greater than zero and should only be changed
|
// of the buffer and all stops. This should not be much greater than zero and should only be changed
|
||||||
@ -201,7 +202,7 @@ const bool ENDSTOPS_INVERTING = true; // set to true to invert the logic of the
|
|||||||
|
|
||||||
#define AXIS_RELATIVE_MODES {false, false, false, false}
|
#define AXIS_RELATIVE_MODES {false, false, false, false}
|
||||||
|
|
||||||
#define MAX_STEP_FREQUENCY 40000L // Max step frequency for Ultimaker (5000 pps / half step)
|
#define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
|
||||||
|
|
||||||
// default settings
|
// default settings
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
unsigned long minsegmenttime;
|
unsigned long minsegmenttime;
|
||||||
float max_feedrate[4]; // set the max speeds
|
float max_feedrate[4]; // set the max speeds
|
||||||
float axis_steps_per_unit[4];
|
float axis_steps_per_unit[4];
|
||||||
long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software
|
unsigned long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software
|
||||||
float minimumfeedrate;
|
float minimumfeedrate;
|
||||||
float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
|
float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
|
||||||
float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
|
float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
|
||||||
@ -153,8 +153,8 @@ inline float intersection_distance(float initial_rate, float final_rate, float a
|
|||||||
// Calculates trapezoid parameters so that the entry- and exit-speed is compensated by the provided factors.
|
// Calculates trapezoid parameters so that the entry- and exit-speed is compensated by the provided factors.
|
||||||
|
|
||||||
void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exit_factor) {
|
void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exit_factor) {
|
||||||
long initial_rate = ceil(block->nominal_rate*entry_factor); // (step/min)
|
unsigned long initial_rate = ceil(block->nominal_rate*entry_factor); // (step/min)
|
||||||
long final_rate = ceil(block->nominal_rate*exit_factor); // (step/min)
|
unsigned long final_rate = ceil(block->nominal_rate*exit_factor); // (step/min)
|
||||||
|
|
||||||
// Limit minimal step rate (Otherwise the timer will overflow.)
|
// Limit minimal step rate (Otherwise the timer will overflow.)
|
||||||
if(initial_rate <120) {initial_rate=120; }
|
if(initial_rate <120) {initial_rate=120; }
|
||||||
@ -570,7 +570,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
|
|||||||
long max_x_segment_time = max(x_segment_time[0], max(x_segment_time[1], x_segment_time[2]));
|
long max_x_segment_time = max(x_segment_time[0], max(x_segment_time[1], x_segment_time[2]));
|
||||||
long max_y_segment_time = max(y_segment_time[0], max(y_segment_time[1], y_segment_time[2]));
|
long max_y_segment_time = max(y_segment_time[0], max(y_segment_time[1], y_segment_time[2]));
|
||||||
long min_xy_segment_time =min(max_x_segment_time, max_y_segment_time);
|
long min_xy_segment_time =min(max_x_segment_time, max_y_segment_time);
|
||||||
if(min_xy_segment_time < MAX_FREQ_TIME) speed_factor = min(speed_factor, (float)min_xy_segment_time / (float)MAX_FREQ_TIME);
|
if(min_xy_segment_time < MAX_FREQ_TIME) speed_factor = min(speed_factor, speed_factor * (float)min_xy_segment_time / (float)MAX_FREQ_TIME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Correct the speed
|
// Correct the speed
|
||||||
@ -579,7 +579,12 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
|
|||||||
for(int i=0; i < 4; i++) {
|
for(int i=0; i < 4; i++) {
|
||||||
if(abs(current_speed[i]) > max_feedrate[i])
|
if(abs(current_speed[i]) > max_feedrate[i])
|
||||||
speed_factor = min(speed_factor, max_feedrate[i] / abs(current_speed[i]));
|
speed_factor = min(speed_factor, max_feedrate[i] / abs(current_speed[i]));
|
||||||
// Serial.print("current_speed"); Serial.print(i); Serial.print(" : "); Serial.println(current_speed[i]);
|
/*
|
||||||
|
if(speed_factor < 0.1) {
|
||||||
|
Serial.print("speed factor : "); Serial.println(speed_factor);
|
||||||
|
Serial.print("current_speed"); Serial.print(i); Serial.print(" : "); Serial.println(current_speed[i]);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
for(unsigned char i=0; i < 4; i++) {
|
for(unsigned char i=0; i < 4; i++) {
|
||||||
current_speed[i] *= speed_factor;
|
current_speed[i] *= speed_factor;
|
||||||
|
@ -32,9 +32,9 @@ typedef struct {
|
|||||||
// Fields used by the bresenham algorithm for tracing the line
|
// Fields used by the bresenham algorithm for tracing the line
|
||||||
long steps_x, steps_y, steps_z, steps_e; // Step count along each axis
|
long steps_x, steps_y, steps_z, steps_e; // Step count along each axis
|
||||||
long step_event_count; // The number of step events required to complete this block
|
long step_event_count; // The number of step events required to complete this block
|
||||||
volatile long accelerate_until; // The index of the step event on which to stop acceleration
|
long accelerate_until; // The index of the step event on which to stop acceleration
|
||||||
volatile long decelerate_after; // The index of the step event on which to start decelerating
|
long decelerate_after; // The index of the step event on which to start decelerating
|
||||||
volatile long acceleration_rate; // The acceleration rate used for acceleration calculation
|
long acceleration_rate; // The acceleration rate used for acceleration calculation
|
||||||
unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
|
unsigned char direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
|
||||||
#ifdef ADVANCE
|
#ifdef ADVANCE
|
||||||
// long advance_rate;
|
// long advance_rate;
|
||||||
@ -54,10 +54,10 @@ typedef struct {
|
|||||||
unsigned char nominal_length_flag; // Planner flag for nominal speed always reached
|
unsigned char nominal_length_flag; // Planner flag for nominal speed always reached
|
||||||
|
|
||||||
// Settings for the trapezoid generator
|
// Settings for the trapezoid generator
|
||||||
long nominal_rate; // The nominal step rate for this block in step_events/sec
|
unsigned long nominal_rate; // The nominal step rate for this block in step_events/sec
|
||||||
volatile long initial_rate; // The jerk-adjusted step rate at start of block
|
unsigned long initial_rate; // The jerk-adjusted step rate at start of block
|
||||||
volatile long final_rate; // The minimal rate at exit
|
unsigned long final_rate; // The minimal rate at exit
|
||||||
long acceleration_st; // acceleration steps/sec^2
|
unsigned long acceleration_st; // acceleration steps/sec^2
|
||||||
volatile char busy;
|
volatile char busy;
|
||||||
} block_t;
|
} block_t;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ void check_axes_activity();
|
|||||||
extern unsigned long minsegmenttime;
|
extern unsigned long minsegmenttime;
|
||||||
extern float max_feedrate[4]; // set the max speeds
|
extern float max_feedrate[4]; // set the max speeds
|
||||||
extern float axis_steps_per_unit[4];
|
extern float axis_steps_per_unit[4];
|
||||||
extern long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software
|
extern unsigned long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software
|
||||||
extern float minimumfeedrate;
|
extern float minimumfeedrate;
|
||||||
extern float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
|
extern float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
|
||||||
extern float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
|
extern float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
|
||||||
|
@ -253,7 +253,7 @@ inline unsigned short calc_timer(unsigned short step_rate) {
|
|||||||
timer = (unsigned short)pgm_read_word_near(table_address);
|
timer = (unsigned short)pgm_read_word_near(table_address);
|
||||||
timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
|
timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
|
||||||
}
|
}
|
||||||
if(timer < 100) timer = 100; //(20kHz this should never happen)
|
if(timer < 100) { timer = 100; Serial.print("Steprate to high : "); Serial.println(step_rate); }//(20kHz this should never happen)
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user