Replace some float division with multiplication

This commit is contained in:
Scott Lahteine
2016-07-24 11:50:54 -07:00
parent ddde785b37
commit d8f2876753
5 changed files with 20 additions and 18 deletions

View File

@ -814,7 +814,7 @@ void Planner::check_axes_activity() {
delta_mm[Z_AXIS] = dz * steps_to_mm[Z_AXIS];
#endif
#endif
delta_mm[E_AXIS] = (de * steps_to_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder] / 100.0;
delta_mm[E_AXIS] = 0.01 * (de * steps_to_mm[E_AXIS]) * volumetric_multiplier[extruder] * extruder_multiplier[extruder];
if (block->steps[X_AXIS] <= dropsegments && block->steps[Y_AXIS] <= dropsegments && block->steps[Z_AXIS] <= dropsegments) {
block->millimeters = fabs(delta_mm[E_AXIS]);
@ -888,7 +888,7 @@ void Planner::check_axes_activity() {
while (filwidth_delay_dist >= MMD_MM) filwidth_delay_dist -= MMD_MM;
// Convert into an index into the measurement array
filwidth_delay_index1 = (int)(filwidth_delay_dist / 10.0 + 0.0001);
filwidth_delay_index1 = (int)(filwidth_delay_dist * 0.1 + 0.0001);
// If the index has changed (must have gone forward)...
if (filwidth_delay_index1 != filwidth_delay_index2) {
@ -975,7 +975,7 @@ void Planner::check_axes_activity() {
block->acceleration_steps_per_s2 = (max_acceleration_steps_per_s2[E_AXIS] * block->step_event_count) / block->steps[E_AXIS];
}
block->acceleration = block->acceleration_steps_per_s2 / steps_per_mm;
block->acceleration_rate = (long)(block->acceleration_steps_per_s2 * 16777216.0 / ((F_CPU) / 8.0));
block->acceleration_rate = (long)(block->acceleration_steps_per_s2 * 16777216.0 / ((F_CPU) * 0.125));
#if 0 // Use old jerk for now
@ -1021,10 +1021,12 @@ void Planner::check_axes_activity() {
#endif
// Start with a safe speed
float vmax_junction = max_xy_jerk / 2;
float vmax_junction_factor = 1.0;
float mz2 = max_z_jerk / 2, me2 = max_e_jerk / 2;
float csz = current_speed[Z_AXIS], cse = current_speed[E_AXIS];
float vmax_junction = max_xy_jerk * 0.5,
vmax_junction_factor = 1.0,
mz2 = max_z_jerk * 0.5,
me2 = max_e_jerk * 0.5,
csz = current_speed[Z_AXIS],
cse = current_speed[E_AXIS];
if (fabs(csz) > mz2) vmax_junction = min(vmax_junction, mz2);
if (fabs(cse) > me2) vmax_junction = min(vmax_junction, me2);
vmax_junction = min(vmax_junction, block->nominal_speed);