From f379edca78a6d211c3b21b34c7174971ec32d82e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 2 Mar 2015 06:42:48 -0800 Subject: [PATCH] Cleanup rotary encoder encrot* defines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The encrot values are used in only one place, and don’t vary, so remove redundant references. --- Marlin/dogm_lcd_implementation.h | 18 +++++++----------- Marlin/pins_CHEAPTRONIC.h | 6 ------ Marlin/pins_ELEFU_3.h | 6 ------ Marlin/pins_MEGATRONICS.h | 6 ------ Marlin/pins_MEGATRONICS_1.h | 6 ------ Marlin/pins_MEGATRONICS_2.h | 6 ------ Marlin/pins_MEGATRONICS_3.h | 6 ------ Marlin/pins_RAMBO.h | 11 ----------- Marlin/ultralcd.cpp | 11 +++++++++++ .../ultralcd_implementation_hitachi_HD44780.h | 11 ----------- 10 files changed, 18 insertions(+), 69 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index c7df306b32..4e2a567fff 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -21,17 +21,13 @@ **/ #ifdef ULTIPANEL -#define BLEN_A 0 -#define BLEN_B 1 -#define BLEN_C 2 -#define EN_A (1< diff --git a/Marlin/pins_CHEAPTRONIC.h b/Marlin/pins_CHEAPTRONIC.h index 83d67e5f9b..dbf53a7e2e 100644 --- a/Marlin/pins_CHEAPTRONIC.h +++ b/Marlin/pins_CHEAPTRONIC.h @@ -87,9 +87,3 @@ // Cheaptronic v1.0 does not use this port #define SDCARDDETECT -1 - -// Encoder rotation values -#define encrot0 0 -#define encrot1 2 -#define encrot2 3 -#define encrot3 1 diff --git a/Marlin/pins_ELEFU_3.h b/Marlin/pins_ELEFU_3.h index 4c9663a352..e0e0a50969 100644 --- a/Marlin/pins_ELEFU_3.h +++ b/Marlin/pins_ELEFU_3.h @@ -74,12 +74,6 @@ #define BLEN_B 1 #define BLEN_A 0 - //encoder rotation values - #define encrot0 0 - #define encrot1 2 - #define encrot2 3 - #define encrot3 1 - #endif // RA_CONTROL_PANEL #ifdef RA_DISCO diff --git a/Marlin/pins_MEGATRONICS.h b/Marlin/pins_MEGATRONICS.h index 2bd0e33eb6..413906eef5 100644 --- a/Marlin/pins_MEGATRONICS.h +++ b/Marlin/pins_MEGATRONICS.h @@ -83,10 +83,4 @@ #define SDCARDDETECT -1 // Ramps does not use this port - //encoder rotation values - #define encrot0 0 - #define encrot1 2 - #define encrot2 3 - #define encrot3 1 - #endif // ULTRA_LCD && NEWPANEL diff --git a/Marlin/pins_MEGATRONICS_1.h b/Marlin/pins_MEGATRONICS_1.h index f321941f87..1592dfe42d 100644 --- a/Marlin/pins_MEGATRONICS_1.h +++ b/Marlin/pins_MEGATRONICS_1.h @@ -80,9 +80,3 @@ #define BLEN_A 0 #define SDCARDDETECT -1 // Megatronics does not use this port - -// Encoder rotation values -#define encrot0 0 -#define encrot1 2 -#define encrot2 3 -#define encrot3 1 diff --git a/Marlin/pins_MEGATRONICS_2.h b/Marlin/pins_MEGATRONICS_2.h index 064431be29..b05eaaa7ab 100644 --- a/Marlin/pins_MEGATRONICS_2.h +++ b/Marlin/pins_MEGATRONICS_2.h @@ -95,9 +95,3 @@ #define BLEN_A 0 #define SDCARDDETECT -1 // Megatronics does not use this port - -// Encoder rotation values -#define encrot0 0 -#define encrot1 2 -#define encrot2 3 -#define encrot3 1 diff --git a/Marlin/pins_MEGATRONICS_3.h b/Marlin/pins_MEGATRONICS_3.h index 3c53bca28c..04a730670d 100644 --- a/Marlin/pins_MEGATRONICS_3.h +++ b/Marlin/pins_MEGATRONICS_3.h @@ -95,9 +95,3 @@ #define BLEN_A 0 #define SDCARDDETECT -1 // Megatronics does not use this port - -// Encoder rotation values -#define encrot0 0 -#define encrot1 2 -#define encrot2 3 -#define encrot3 1 diff --git a/Marlin/pins_RAMBO.h b/Marlin/pins_RAMBO.h index b2ccdc4339..3849e29489 100644 --- a/Marlin/pins_RAMBO.h +++ b/Marlin/pins_RAMBO.h @@ -116,11 +116,6 @@ #define SDCARDDETECT 81 // Ramps does not use this port - //encoder rotation values - #define encrot0 0 - #define encrot1 2 - #define encrot2 3 - #define encrot3 1 #else //!NEWPANEL - old style panel with shift register //arduino pin witch triggers an piezzo beeper #define BEEPER 33 No Beeper added @@ -138,12 +133,6 @@ #define LCD_PINS_D6 27 #define LCD_PINS_D7 29 - //encoder rotation values - #define encrot0 0 - #define encrot1 2 - #define encrot2 3 - #define encrot3 1 - //bits in the shift register that carry the buttons for: // left up center down right red #define BL_LE 7 diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 2726547034..2f83afe2d1 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1394,6 +1394,17 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } #ifdef ULTIPANEL +//////////////////////// +// Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) +// These values are independent of which pins are used for EN_A and EN_B indications +// The rotary encoder part is also independent to the chipset used for the LCD +#if defined(EN_A) && defined(EN_B) + #define encrot0 0 + #define encrot1 2 + #define encrot2 3 + #define encrot3 1 +#endif + /* Warning: This function is called from interrupt context */ void lcd_buttons_update() { #ifdef NEWPANEL diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 1628bf8f4e..1490d22a9e 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -123,17 +123,6 @@ #define LCD_CLICKED (buttons&(B_MI|B_ST)) #endif -//////////////////////// -// Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) -// These values are independent of which pins are used for EN_A and EN_B indications -// The rotary encoder part is also independent to the chipset used for the LCD -#if defined(EN_A) && defined(EN_B) - #define encrot0 0 - #define encrot1 2 - #define encrot2 3 - #define encrot3 1 -#endif - #endif //ULTIPANEL ////////////////////////////////////