Implement BABYSTEPPING for COREXY and COREXZ

This commit is contained in:
Scott Lahteine 2016-03-10 21:35:44 -08:00
parent 7d25c107a8
commit e5fd43f343
20 changed files with 58 additions and 30 deletions

View file

@ -268,6 +268,17 @@
#define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS)) #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
#define Z_MAX_LENGTH (Z_MAX_POS - (Z_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 * SCARA
*/ */

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -32,9 +32,6 @@
* Babystepping * Babystepping
*/ */
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#if ENABLED(COREXY) && ENABLED(BABYSTEP_XY)
#error BABYSTEPPING only implemented for Z axis on CoreXY.
#endif
#if ENABLED(SCARA) #if ENABLED(SCARA)
#error BABYSTEPPING is not implemented for SCARA yet. #error BABYSTEPPING is not implemented for SCARA yet.
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -375,7 +375,7 @@
#define BABYSTEPPING #define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -378,7 +378,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -372,7 +372,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -372,7 +372,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -371,7 +371,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -375,7 +375,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #endif

View file

@ -370,7 +370,7 @@
//#define BABYSTEPPING //#define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
#define BABYSTEP_XY //not only z, but also XY in the menu. more clutter, more functions #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_INVERT_Z false //true for inverse movements in Z
#define BABYSTEP_MULTIPLICATOR 1 //faster movements #define BABYSTEP_MULTIPLICATOR 1 //faster movements
#endif #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; } void enable_endstops(bool check) { check_endstops = check; }
// Check endstops - Called from ISR! // Check endstops - Called from ISR!

View file

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