Clean up planner modifier methods

This commit is contained in:
Scott Lahteine 2020-05-05 03:09:40 -05:00
parent 852a8d6685
commit 7a2cc782b4
3 changed files with 10 additions and 27 deletions

View File

@ -221,11 +221,7 @@ void report_real_position() {
npos.e = planner.get_axis_position_mm(E_AXIS);
#if HAS_POSITION_MODIFIERS
planner.unapply_modifiers(npos
#if HAS_LEVELING
, true
#endif
);
planner.unapply_modifiers(npos, true);
#endif
report_logical_position(npos);
@ -304,11 +300,7 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
pos.e = planner.get_axis_position_mm(E_AXIS);
#if HAS_POSITION_MODIFIERS
planner.unapply_modifiers(pos
#if HAS_LEVELING
, true
#endif
);
planner.unapply_modifiers(pos, true);
#endif
if (axis == ALL_AXES)

View File

@ -2742,11 +2742,7 @@ void Planner::set_machine_position_mm(const float &a, const float &b, const floa
void Planner::set_position_mm(const float &rx, const float &ry, const float &rz, const float &e) {
xyze_pos_t machine = { rx, ry, rz, e };
#if HAS_POSITION_MODIFIERS
apply_modifiers(machine
#if HAS_LEVELING
, true
#endif
);
apply_modifiers(machine, true);
#endif
#if IS_KINEMATIC
position_cart.set(rx, ry, rz, e);

View File

@ -547,6 +547,9 @@ class Planner {
unapply_leveling(raw);
leveling_active = false;
}
#else
FORCE_INLINE static void apply_leveling(xyz_pos_t&) {}
FORCE_INLINE static void unapply_leveling(xyz_pos_t&) {}
#endif
#if ENABLED(FWRETRACT)
@ -557,23 +560,15 @@ class Planner {
#endif
#if HAS_POSITION_MODIFIERS
FORCE_INLINE static void apply_modifiers(xyze_pos_t &pos
#if HAS_LEVELING
, bool leveling = ENABLED(PLANNER_LEVELING)
#endif
) {
FORCE_INLINE static void apply_modifiers(xyze_pos_t &pos, bool leveling=ENABLED(PLANNER_LEVELING)) {
TERN_(SKEW_CORRECTION, skew(pos));
TERN_(HAS_LEVELING, if (leveling) apply_leveling(pos));
if (leveling) apply_leveling(pos);
TERN_(FWRETRACT, apply_retract(pos));
}
FORCE_INLINE static void unapply_modifiers(xyze_pos_t &pos
#if HAS_LEVELING
, bool leveling = ENABLED(PLANNER_LEVELING)
#endif
) {
FORCE_INLINE static void unapply_modifiers(xyze_pos_t &pos, bool leveling=ENABLED(PLANNER_LEVELING)) {
TERN_(FWRETRACT, unapply_retract(pos));
TERN_(HAS_LEVELING, if (leveling) unapply_leveling(pos));
if (leveling) unapply_leveling(pos);
TERN_(SKEW_CORRECTION, unskew(pos));
}
#endif // HAS_POSITION_MODIFIERS