From e5fd43f343d36e6943528c9f3e12ca88e6564159 Mon Sep 17 00:00:00 2001 From: Scott Lahteine <sourcetree@thinkyhead.com> Date: Thu, 10 Mar 2016 21:35:44 -0800 Subject: [PATCH 1/2] Implement BABYSTEPPING for COREXY and COREXZ --- Marlin/Conditionals.h | 11 ++++++ Marlin/Configuration_adv.h | 2 +- Marlin/SanityCheck.h | 3 -- .../Felix/Configuration_adv.h | 2 +- .../Hephestos/Configuration_adv.h | 2 +- .../Hephestos_2/Configuration_adv.h | 2 +- .../K8200/Configuration_adv.h | 2 +- .../RigidBot/Configuration_adv.h | 2 +- .../SCARA/Configuration_adv.h | 2 +- .../TAZ4/Configuration_adv.h | 2 +- .../WITBOX/Configuration_adv.h | 2 +- .../delta/biv2.5/Configuration_adv.h | 2 +- .../delta/generic/Configuration_adv.h | 2 +- .../delta/kossel_mini/Configuration_adv.h | 2 +- .../delta/kossel_pro/Configuration_adv.h | 2 +- .../delta/kossel_xl/Configuration_adv.h | 2 +- .../makibox/Configuration_adv.h | 2 +- .../tvrrug/Round2/Configuration_adv.h | 2 +- Marlin/stepper.cpp | 6 ---- Marlin/ultralcd.cpp | 36 ++++++++++++++++--- 20 files changed, 58 insertions(+), 30 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index bb17924a643..1903104bf87 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -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 */ diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index debd9f0d0fb..691fc3563eb 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -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 diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 464a298bc31..80fdefbfb87 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -32,9 +32,6 @@ * Babystepping */ #if ENABLED(BABYSTEPPING) - #if ENABLED(COREXY) && ENABLED(BABYSTEP_XY) - #error BABYSTEPPING only implemented for Z axis on CoreXY. - #endif #if ENABLED(SCARA) #error BABYSTEPPING is not implemented for SCARA yet. #endif diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index c4e3b22f44c..97c9b03b290 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 5ed1b403ad4..636c126ad9a 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index 493bb464c38..baa03581dc7 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 18ee6d85a54..1d5d68de29b 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index d1dfbd2e97a..137b2ab53dd 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index d097fdad80f..e6f33205e8e 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index e36317b6c65..2a2b421ed15 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 5ed1b403ad4..636c126ad9a 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index ba5bbfbe8aa..8fcb3cdd227 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 8990a269e9a..996a38017ed 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index e6f0d753dd7..5be02da9d7b 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index d0eb1fcd4a6..d5c126150c0 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 18d4589968c..87c97a0b9a4 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 96861bc7493..7da39798d83 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -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 diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 0f56db99405..a35bbe1f4aa 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -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 diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 72ee0dfa9e8..9806b8cbb12 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -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! diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 6f9fce382e0..e08dc9322d7 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -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(); } - 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)); } #endif //BABYSTEPPING From d9e1f2268223895649656a70f9a632de6064fd72 Mon Sep 17 00:00:00 2001 From: Scott Lahteine <sourcetree@thinkyhead.com> Date: Fri, 11 Mar 2016 00:49:06 -0800 Subject: [PATCH 2/2] BABYSTEPPING requires ULTRA_LCD --- Marlin/SanityCheck.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 80fdefbfb87..a96ae8b39f7 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -32,6 +32,9 @@ * Babystepping */ #if ENABLED(BABYSTEPPING) + #if DISABLED(ULTRA_LCD) + #error BABYSTEPPING requires an LCD controller. + #endif #if ENABLED(SCARA) #error BABYSTEPPING is not implemented for SCARA yet. #endif