Merge pull request #3127 from thinkyhead/rc_core_babystepping

Implement BABYSTEPPING for COREXY and COREXZ
This commit is contained in:
Scott Lahteine 2016-03-18 23:25:26 -07:00
commit 9bf87aac6a
20 changed files with 60 additions and 29 deletions

View file

@ -268,6 +268,17 @@
#define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
#define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS))
/**
* CoreXY and CoreXZ
*/
#if ENABLED(COREXY)
#define CORE_AXIS_2 B_AXIS
#define CORE_AXIS_3 Z_AXIS
#elif ENABLED(COREXZ)
#define CORE_AXIS_2 C_AXIS
#define CORE_AXIS_3 Y_AXIS
#endif
/**
* SCARA
*/

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -32,8 +32,8 @@
* Babystepping
*/
#if ENABLED(BABYSTEPPING)
#if ENABLED(COREXY) && ENABLED(BABYSTEP_XY)
#error BABYSTEPPING only implemented for Z axis on CoreXY.
#if DISABLED(ULTRA_LCD)
#error BABYSTEPPING requires an LCD controller.
#endif
#if ENABLED(SCARA)
#error BABYSTEPPING is not implemented for SCARA yet.

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -375,7 +375,7 @@
#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -378,7 +378,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -372,7 +372,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -372,7 +372,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -371,7 +371,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -375,7 +375,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING
#if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions
//not implemented for CoreXY and deltabots!
//not implemented for deltabots!
#define BABYSTEP_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif

View file

@ -289,12 +289,6 @@ void checkHitEndstops() {
}
}
#if ENABLED(COREXY)
#define CORE_AXIS_2 B_AXIS
#elif ENABLED(COREXZ)
#define CORE_AXIS_2 C_AXIS
#endif
void enable_endstops(bool check) { check_endstops = check; }
// Check endstops - Called from ISR!

View file

@ -483,21 +483,47 @@ void lcd_set_home_offsets() {
lcd_return_to_status();
}
#if ENABLED(BABYSTEPPING)
static void _lcd_babystep(int axis, const char* msg) {
static void _lcd_babystep(const int axis, const char* msg) {
ENCODER_DIRECTION_NORMAL();
if (encoderPosition != 0) {
babystepsTodo[axis] += (BABYSTEP_MULTIPLICATOR) * (int)encoderPosition;
encoderPosition = 0;
lcdDrawUpdate = 1;
int distance = (int)encoderPosition * BABYSTEP_MULTIPLICATOR;
#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
}
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, (char*)"");
if (LCD_CLICKED) lcd_goto_previous_menu();
}
#if ENABLED(BABYSTEP_XY)
static void lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
static void lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
#endif
static void lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); }
#endif //BABYSTEPPING