Localize babystepping in the Temperature class

So that `ultralcd.cpp` doesn’t need to worry about the details.
2.0.x
Scott Lahteine 9 years ago
parent 0c7beb832c
commit b65ea98d6b

@ -303,6 +303,37 @@ class Temperature {
#endif
}
#if ENABLED(BABYSTEPPING)
FORCE_INLINE void babystep_axis(AxisEnum axis, int distance) {
#if ENABLED(COREXY) || ENABLED(COREXZ)
#if ENABLED(BABYSTEP_XY)
switch (axis) {
case X_AXIS: // X on CoreXY and CoreXZ
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[CORE_AXIS_2] += distance * 2;
break;
case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[CORE_AXIS_2] -= distance * 2;
break;
case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ
babystepsTodo[CORE_AXIS_3] += distance;
break;
}
#elif ENABLED(COREXZ)
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[C_AXIS] -= distance * 2;
#else
babystepsTodo[Z_AXIS] += distance;
#endif
#else
babystepsTodo[axis] += distance;
#endif
}
#endif // BABYSTEPPING
private:
void set_current_temp_raw();

@ -558,31 +558,7 @@ void lcd_set_home_offsets() {
int distance = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
#if ENABLED(COREXY) || ENABLED(COREXZ)
#if ENABLED(BABYSTEP_XY)
switch(axis) {
case X_AXIS: // X on CoreXY and CoreXZ
thermalManager.babystepsTodo[A_AXIS] += distance * 2;
thermalManager.babystepsTodo[CORE_AXIS_2] += distance * 2;
break;
case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ
thermalManager.babystepsTodo[A_AXIS] += distance * 2;
thermalManager.babystepsTodo[CORE_AXIS_2] -= distance * 2;
break;
case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ
thermalManager.babystepsTodo[CORE_AXIS_3] += distance;
break;
}
#elif ENABLED(COREXZ)
thermalManager.babystepsTodo[A_AXIS] += distance * 2;
thermalManager.babystepsTodo[C_AXIS] -= distance * 2;
#else
thermalManager.babystepsTodo[Z_AXIS] += distance;
#endif
#else
thermalManager.babystepsTodo[axis] += distance;
#endif
thermalManager.babystep_axis(axis, distance);
babysteps_done += distance;
}
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done));

Loading…
Cancel
Save