From 4dc4e2063fb79e7fad5f7e76b4864c6a8b6a5109 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 11 May 2016 15:39:28 -0700 Subject: [PATCH] Add REVERSE_ENCODER_DIRECTION option --- Marlin/Configuration.h | 7 +++++++ Marlin/example_configurations/Felix/Configuration.h | 7 +++++++ Marlin/example_configurations/Felix/Configuration_DUAL.h | 7 +++++++ Marlin/example_configurations/Hephestos/Configuration.h | 7 +++++++ Marlin/example_configurations/Hephestos_2/Configuration.h | 7 +++++++ Marlin/example_configurations/K8200/Configuration.h | 7 +++++++ .../RepRapWorld/Megatronics/Configuration.h | 7 +++++++ Marlin/example_configurations/RigidBot/Configuration.h | 7 +++++++ Marlin/example_configurations/SCARA/Configuration.h | 7 +++++++ Marlin/example_configurations/TAZ4/Configuration.h | 7 +++++++ Marlin/example_configurations/WITBOX/Configuration.h | 7 +++++++ .../adafruit/ST7565/Configuration.h | 7 +++++++ .../example_configurations/delta/biv2.5/Configuration.h | 7 +++++++ .../example_configurations/delta/generic/Configuration.h | 7 +++++++ .../delta/kossel_mini/Configuration.h | 7 +++++++ .../delta/kossel_pro/Configuration.h | 7 +++++++ .../delta/kossel_xl/Configuration.h | 7 +++++++ Marlin/example_configurations/makibox/Configuration.h | 7 +++++++ .../example_configurations/tvrrug/Round2/Configuration.h | 7 +++++++ Marlin/ultralcd.cpp | 8 +++++++- 20 files changed, 140 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 3b164a4f65..2ab659513a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -862,6 +862,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 57292b218e..8729180d04 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -845,6 +845,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index ba1f9e8b35..43f838510b 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -843,6 +843,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 4bf40859fa..f25cf1e7b0 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -854,6 +854,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index 285ffb536f..c83f6d059b 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -856,6 +856,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 17290bc875..08fcda9278 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -879,6 +879,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 22d7766191..8935f83997 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -862,6 +862,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index 42a086495a..c00ce84c31 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -857,6 +857,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 4bc60ac2aa..6c0b2d29d0 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -870,6 +870,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index 7b52693b94..d957f3cd7d 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -883,6 +883,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // #define ENCODER_STEPS_PER_MENU_ITEM 1 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index aecbdc75d1..0c0ab8e046 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -854,6 +854,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 5eb8301be5..36a2255496 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -862,6 +862,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index 6cbb21ae51..4a54a3d44d 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -991,6 +991,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index e6f049528a..5230887e1b 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -991,6 +991,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index e55d2941ee..b72d45d137 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -995,6 +995,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index 61c6eee008..32efdb3189 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -988,6 +988,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index 37240d1368..dfee03c1fe 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -996,6 +996,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 3d21ed402a..12895c851d 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -865,6 +865,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 32bfc9cd04..0e9511631f 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -856,6 +856,13 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo // //#define ENCODER_STEPS_PER_MENU_ITEM 5 +// +// This option reverses the encoder direction everywhere +// +// Set this option if CLOCKWISE causes values to DECREASE +// +//#define REVERSE_ENCODER_DIRECTION + // // This option reverses the encoder direction for navigating LCD menus. // diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 4584647fde..401b1fab32 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2466,9 +2466,15 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } GET_BUTTON_STATES(buttons); #endif //!NEWPANEL - #if ENABLED(REVERSE_MENU_DIRECTION) + #if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION) + #define ENCODER_DIFF_CW (encoderDiff -= encoderDirection) + #define ENCODER_DIFF_CCW (encoderDiff += encoderDirection) + #elif ENABLED(REVERSE_MENU_DIRECTION) #define ENCODER_DIFF_CW (encoderDiff += encoderDirection) #define ENCODER_DIFF_CCW (encoderDiff -= encoderDirection) + #elif ENABLED(REVERSE_ENCODER_DIRECTION) + #define ENCODER_DIFF_CW (encoderDiff--) + #define ENCODER_DIFF_CCW (encoderDiff++) #else #define ENCODER_DIFF_CW (encoderDiff++) #define ENCODER_DIFF_CCW (encoderDiff--)