Replace double with float, optimize calculation

This commit is contained in:
etagle
2018-07-01 17:20:28 -03:00
committed by Scott Lahteine
parent d960d448fa
commit 1367df2875
38 changed files with 263 additions and 267 deletions

View File

@ -40,7 +40,7 @@
// setting any extruder filament size disables volumetric on the assumption that
// slicers either generate in extruder values as cubic mm or as as filament feeds
// for all extruders
if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0.0)) )
if ( (parser.volumetric_enabled = (parser.value_linear_units() != 0)) )
planner.set_filament_size(target_extruder, parser.value_linear_units());
}
planner.calculate_volumetric_multipliers();
@ -134,7 +134,7 @@ void GcodeSuite::M205() {
#if ENABLED(JUNCTION_DEVIATION)
if (parser.seen('J')) {
const float junc_dev = parser.value_linear_units();
if (WITHIN(junc_dev, 0.01, 0.3)) {
if (WITHIN(junc_dev, 0.01f, 0.3f)) {
planner.junction_deviation_mm = junc_dev;
planner.recalculate_max_e_jerk();
}
@ -149,7 +149,7 @@ void GcodeSuite::M205() {
if (parser.seen('Z')) {
planner.max_jerk[Z_AXIS] = parser.value_linear_units();
#if HAS_MESH
if (planner.max_jerk[Z_AXIS] <= 0.1)
if (planner.max_jerk[Z_AXIS] <= 0.1f)
SERIAL_ECHOLNPGM("WARNING! Low Z Jerk may lead to unwanted pauses.");
#endif
}

View File

@ -37,7 +37,7 @@ void GcodeSuite::M92() {
if (parser.seen(axis_codes[i])) {
if (i == E_AXIS) {
const float value = parser.value_per_axis_unit((AxisEnum)(E_AXIS + TARGET_EXTRUDER));
if (value < 20.0) {
if (value < 20) {
float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
#if DISABLED(JUNCTION_DEVIATION)
planner.max_jerk[E_AXIS] *= factor;