|
|
|
|
742
|
}
|
742
|
}
|
743
|
float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
|
743
|
float inverse_millimeters = 1.0 / block->millimeters; // Inverse millimeters to remove multiple divides
|
744
|
|
744
|
|
745
|
- // Calculate speed in mm/second for each axis. No divide by zero due to previous checks.
|
|
|
|
|
745
|
+ // Calculate moves/second for this move. No divide by zero due to previous checks.
|
746
|
float inverse_second = feed_rate * inverse_millimeters;
|
746
|
float inverse_second = feed_rate * inverse_millimeters;
|
747
|
|
747
|
|
748
|
int moves_queued = movesplanned();
|
748
|
int moves_queued = movesplanned();
|
|
|
|
|
853
|
|
853
|
|
854
|
// Compute and limit the acceleration rate for the trapezoid generator.
|
854
|
// Compute and limit the acceleration rate for the trapezoid generator.
|
855
|
float steps_per_mm = block->step_event_count / block->millimeters;
|
855
|
float steps_per_mm = block->step_event_count / block->millimeters;
|
856
|
- long bsx = block->steps[X_AXIS], bsy = block->steps[Y_AXIS], bsz = block->steps[Z_AXIS], bse = block->steps[E_AXIS];
|
|
|
|
|
856
|
+ unsigned long bsx = block->steps[X_AXIS], bsy = block->steps[Y_AXIS], bsz = block->steps[Z_AXIS], bse = block->steps[E_AXIS];
|
857
|
if (bsx == 0 && bsy == 0 && bsz == 0) {
|
857
|
if (bsx == 0 && bsy == 0 && bsz == 0) {
|
858
|
block->acceleration_st = ceil(retract_acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
|
858
|
block->acceleration_st = ceil(retract_acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
|
859
|
}
|
859
|
}
|
|
|
|
|
868
|
xsteps = axis_steps_per_sqr_second[X_AXIS],
|
868
|
xsteps = axis_steps_per_sqr_second[X_AXIS],
|
869
|
ysteps = axis_steps_per_sqr_second[Y_AXIS],
|
869
|
ysteps = axis_steps_per_sqr_second[Y_AXIS],
|
870
|
zsteps = axis_steps_per_sqr_second[Z_AXIS],
|
870
|
zsteps = axis_steps_per_sqr_second[Z_AXIS],
|
871
|
- esteps = axis_steps_per_sqr_second[E_AXIS];
|
|
|
872
|
- if ((float)acc_st * bsx / block->step_event_count > xsteps) acc_st = xsteps;
|
|
|
873
|
- if ((float)acc_st * bsy / block->step_event_count > ysteps) acc_st = ysteps;
|
|
|
874
|
- if ((float)acc_st * bsz / block->step_event_count > zsteps) acc_st = zsteps;
|
|
|
875
|
- if ((float)acc_st * bse / block->step_event_count > esteps) acc_st = esteps;
|
|
|
|
|
871
|
+ esteps = axis_steps_per_sqr_second[E_AXIS],
|
|
|
872
|
+ allsteps = block->step_event_count;
|
|
|
873
|
+ if (xsteps < (acc_st * bsx) / allsteps) acc_st = (xsteps * allsteps) / bsx;
|
|
|
874
|
+ if (ysteps < (acc_st * bsy) / allsteps) acc_st = (ysteps * allsteps) / bsy;
|
|
|
875
|
+ if (zsteps < (acc_st * bsz) / allsteps) acc_st = (zsteps * allsteps) / bsz;
|
|
|
876
|
+ if (esteps < (acc_st * bse) / allsteps) acc_st = (esteps * allsteps) / bse;
|
876
|
|
877
|
|
877
|
block->acceleration_st = acc_st;
|
878
|
block->acceleration_st = acc_st;
|
878
|
block->acceleration = acc_st / steps_per_mm;
|
879
|
block->acceleration = acc_st / steps_per_mm;
|