|
@@ -1003,8 +1003,19 @@ Having the real displacement of the head, we can calculate the total movement le
|
|
|
current_speed[i] = delta_mm[i] * inverse_second;
|
|
|
#ifdef TMC2130
|
|
|
float max_fr = max_feedrate[i];
|
|
|
- if ((tmc2130_mode == TMC2130_MODE_SILENT) && (i < 2))
|
|
|
- max_fr = SILENT_MAX_FEEDRATE;
|
|
|
+ if (i < 2) // X, Y
|
|
|
+ {
|
|
|
+ if (tmc2130_mode == TMC2130_MODE_SILENT)
|
|
|
+ {
|
|
|
+ if (max_fr > SILENT_MAX_FEEDRATE)
|
|
|
+ max_fr = SILENT_MAX_FEEDRATE;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (max_fr > NORMAL_MAX_FEEDRATE)
|
|
|
+ max_fr = NORMAL_MAX_FEEDRATE;
|
|
|
+ }
|
|
|
+ }
|
|
|
if(fabs(current_speed[i]) > max_fr)
|
|
|
speed_factor = min(speed_factor, max_fr / fabs(current_speed[i]));
|
|
|
#else //TMC2130
|
|
@@ -1036,21 +1047,41 @@ Having the real displacement of the head, we can calculate the total movement le
|
|
|
{
|
|
|
block->acceleration_st = ceil(acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
|
|
|
#ifdef TMC2130
|
|
|
+#ifdef SIMPLE_ACCEL_LIMIT // in some cases can be acceleration limited inproperly
|
|
|
if (tmc2130_mode == TMC2130_MODE_SILENT)
|
|
|
{
|
|
|
- if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > SILENT_MAX_ACCEL_X_ST)
|
|
|
- block->acceleration_st = SILENT_MAX_ACCEL_X_ST;
|
|
|
- if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > SILENT_MAX_ACCEL_Y_ST)
|
|
|
- block->acceleration_st = SILENT_MAX_ACCEL_Y_ST;
|
|
|
+ if (block->steps_x || block->steps_y)
|
|
|
+ if (block->acceleration_st > SILENT_MAX_ACCEL_ST) block->acceleration_st = SILENT_MAX_ACCEL_ST;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (block->steps_x || block->steps_y)
|
|
|
+ if (block->acceleration_st > NORMAL_MAX_ACCEL_ST) block->acceleration_st = NORMAL_MAX_ACCEL_ST;
|
|
|
+ }
|
|
|
+ if (block->steps_x && (block->acceleration_st > axis_steps_per_sqr_second[X_AXIS])) block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
|
|
|
+ if (block->steps_y && (block->acceleration_st > axis_steps_per_sqr_second[Y_AXIS])) block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
|
|
|
+ if (block->steps_z && (block->acceleration_st > axis_steps_per_sqr_second[Z_AXIS])) block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
|
|
|
+ if (block->steps_e && (block->acceleration_st > axis_steps_per_sqr_second[E_AXIS])) block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
|
|
|
+#else // SIMPLE_ACCEL_LIMIT
|
|
|
+ if (tmc2130_mode == TMC2130_MODE_SILENT)
|
|
|
+ {
|
|
|
+ if ((block->steps_x > block->step_event_count / 2) || (block->steps_y > block->step_event_count / 2))
|
|
|
+ if (block->acceleration_st > SILENT_MAX_ACCEL_ST) block->acceleration_st = SILENT_MAX_ACCEL_ST;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if ((block->steps_x > block->step_event_count / 2) || (block->steps_y > block->step_event_count / 2))
|
|
|
+ if (block->acceleration_st > NORMAL_MAX_ACCEL_ST) block->acceleration_st = NORMAL_MAX_ACCEL_ST;
|
|
|
}
|
|
|
- if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > axis_steps_per_sqr_second[X_AXIS])
|
|
|
- block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
|
|
|
- if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > axis_steps_per_sqr_second[Y_AXIS])
|
|
|
- block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
|
|
|
- if(((float)block->acceleration_st * (float)block->steps_e / (float)block->step_event_count) > axis_steps_per_sqr_second[E_AXIS])
|
|
|
- block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
|
|
|
- if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS])
|
|
|
- block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
|
|
|
+ if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > axis_steps_per_sqr_second[X_AXIS])
|
|
|
+ block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
|
|
|
+ if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > axis_steps_per_sqr_second[Y_AXIS])
|
|
|
+ block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
|
|
|
+ if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS])
|
|
|
+ block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
|
|
|
+ if(((float)block->acceleration_st * (float)block->steps_e / (float)block->step_event_count) > axis_steps_per_sqr_second[E_AXIS])
|
|
|
+ block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
|
|
|
+#endif // SIMPLE_ACCEL_LIMIT
|
|
|
#else //TMC2130
|
|
|
// Limit acceleration per axis
|
|
|
//FIXME Vojtech: One shall rather limit a projection of the acceleration vector instead of using the limit.
|