UBL/planner patch tweaks

This commit is contained in:
Scott Lahteine 2018-08-11 22:48:44 -05:00
parent 0af22549a6
commit c93538e9f3

View file

@ -154,7 +154,7 @@ float Planner::e_factor[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0f); // The flow perc
#if DISABLED(NO_VOLUMETRICS) #if DISABLED(NO_VOLUMETRICS)
float Planner::filament_size[EXTRUDERS], // diameter of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder float Planner::filament_size[EXTRUDERS], // diameter of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder
Planner::volumetric_area_nominal = CIRCLE_AREA((float(DEFAULT_NOMINAL_FILAMENT_DIA)) * 0.5f), // Nominal cross-sectional area Planner::volumetric_area_nominal = CIRCLE_AREA(float(DEFAULT_NOMINAL_FILAMENT_DIA) * 0.5f), // Nominal cross-sectional area
Planner::volumetric_multiplier[EXTRUDERS]; // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner Planner::volumetric_multiplier[EXTRUDERS]; // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
#endif #endif
@ -2546,12 +2546,12 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
#endif #endif
position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_AXIS]); position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_AXIS]);
position[B_AXIS] = LROUND(b * axis_steps_per_mm[B_AXIS]); position[B_AXIS] = LROUND(b * axis_steps_per_mm[B_AXIS]);
position[C_AXIS] = LROUND(axis_steps_per_mm[C_AXIS] * (c +
#if !IS_KINEMATIC && ENABLED(AUTO_BED_LEVELING_UBL) #if !IS_KINEMATIC && ENABLED(AUTO_BED_LEVELING_UBL)
if (leveling_active) leveling_active ? ubl.get_z_correction(a, b) :
position[C_AXIS] = LROUND((c + ubl.get_z_correction(a, b)) * axis_steps_per_mm[Z_AXIS]);
else
#endif #endif
position[C_AXIS] = LROUND(c * axis_steps_per_mm[C_AXIS]); 0
));
position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]); position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
#if HAS_POSITION_FLOAT #if HAS_POSITION_FLOAT
position_float[A_AXIS] = a; position_float[A_AXIS] = a;
@ -2593,19 +2593,17 @@ void Planner::set_position_mm(const AxisEnum axis, const float &v) {
#else #else
const uint8_t axis_index = axis; const uint8_t axis_index = axis;
#endif #endif
position[axis] = LROUND(axis_steps_per_mm[axis_index] * (v +
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
if (axis == Z_AXIS && leveling_active) axis == Z_AXIS && leveling_active ? ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS]) :
position[axis] = LROUND((v + ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS])) * axis_steps_per_mm[axis_index]);
else
#endif #endif
position[axis] = LROUND(v * axis_steps_per_mm[axis_index]); 0
));
#if HAS_POSITION_FLOAT #if HAS_POSITION_FLOAT
position_float[axis] = v; position_float[axis] = v;
#endif #endif
if (has_blocks_queued()) { if (has_blocks_queued())
//previous_speed[axis] = 0.0;
buffer_sync_block(); buffer_sync_block();
}
else else
stepper.set_position(axis, position[axis]); stepper.set_position(axis, position[axis]);
} }