Tweaks to core motion code

This commit is contained in:
Scott Lahteine 2017-11-08 19:49:51 -06:00
parent 8805e24cc7
commit b0b4a20930

View File

@ -489,7 +489,8 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
#endif
#if IS_KINEMATIC && !UBL_DELTA
#if !UBL_DELTA
#if IS_KINEMATIC
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
#if ENABLED(DELTA)
@ -512,6 +513,9 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
*
* This calls planner.buffer_line several times, adding
* small incremental moves for DELTA or SCARA.
*
* For Unified Bed Leveling (Delta or Segmented Cartesian)
* the ubl.prepare_segmented_line_to method replaces this.
*/
inline bool prepare_kinematic_move_to(float rtarget[XYZE]) {
@ -630,47 +634,45 @@ float soft_endstop_min[XYZ] = { X_MIN_BED, Y_MIN_BED, Z_MIN_POS },
return false;
}
#else // !IS_KINEMATIC || UBL_DELTA
#else // !IS_KINEMATIC
/**
* Prepare a linear move in a Cartesian setup.
* Bed Leveling will be applied to the move if enabled.
*
* When a mesh-based leveling system is active, moves are segmented
* according to the configuration of the leveling system.
*
* Returns true if current_position[] was set to destination[]
*/
inline bool prepare_move_to_destination_cartesian() {
const float fr_scaled = MMS_SCALED(feedrate_mm_s);
#if HAS_MESH
if (!planner.leveling_active) {
line_to_destination(fr_scaled);
return false;
}
#if HAS_MESH
if (planner.leveling_active) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.line_to_destination_cartesian(fr_scaled, active_extruder); // UBL's motion routine needs to know about all moves,
return true; // even purely Z-Axis moves
ubl.line_to_destination_cartesian(MMS_SCALED(feedrate_mm_s), active_extruder); // UBL's motion routine needs to know about
return true; // all moves, including Z-only moves.
#else
/**
* For MBL and ABL-BILINEAR only segment moves when X or Y are involved.
* Otherwise fall through to do a direct single move.
*/
if (current_position[X_AXIS] != destination[X_AXIS] || current_position[Y_AXIS] != destination[Y_AXIS]) {
#if ENABLED(MESH_BED_LEVELING)
mesh_line_to_destination(fr_scaled);
mesh_line_to_destination(MMS_SCALED(feedrate_mm_s));
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
bilinear_line_to_destination(fr_scaled);
bilinear_line_to_destination(MMS_SCALED(feedrate_mm_s));
#endif
return true;
}
else {
line_to_destination();
return false;
}
#endif
#else
line_to_destination();
#endif // HAS_MESH
}
#endif // HAS_MESH
line_to_destination(MMS_SCALED(feedrate_mm_s));
return false;
}
#endif // !IS_KINEMATIC || UBL_DELTA
#endif // !IS_KINEMATIC
#endif // !UBL_DELTA
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
bool extruder_duplication_enabled = false; // Used in Dual X mode 2