Merge pull request #3685 from thinkyhead/rc_localize_babystepping

Localize babystepping in the Temperature class
This commit is contained in:
Scott Lahteine 2016-05-05 20:56:04 -07:00
commit 58ea246f98
2 changed files with 32 additions and 25 deletions

View File

@ -303,6 +303,37 @@ class Temperature {
#endif #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: private:
void set_current_temp_raw(); void set_current_temp_raw();

View File

@ -558,31 +558,7 @@ void lcd_set_home_offsets() {
int distance = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR; int distance = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
#if ENABLED(COREXY) || ENABLED(COREXZ) thermalManager.babystep_axis(axis, distance);
#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
babysteps_done += distance; babysteps_done += distance;
} }
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done)); if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done));