Merge pull request #4511 from thinkyhead/rc_encoder_flex

Allow encoder pulse/step override for more LCDs
This commit is contained in:
Scott Lahteine 2016-08-02 16:50:50 -07:00 committed by GitHub
commit cebeb48005
2 changed files with 25 additions and 27 deletions

View file

@ -65,9 +65,13 @@
#define SD_DETECT_INVERTED #define SD_DETECT_INVERTED
#endif #endif
#ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 4 #define ENCODER_PULSES_PER_STEP 4
#endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 1 #define ENCODER_STEPS_PER_MENU_ITEM 1
#endif #endif
#endif
// Generic support for SSD1306 / SH1106 OLED based LCDs. // Generic support for SSD1306 / SH1106 OLED based LCDs.
#if ENABLED(U8GLIB_SSD1306) || ENABLED(U8GLIB_SH1106) #if ENABLED(U8GLIB_SSD1306) || ENABLED(U8GLIB_SH1106)
@ -85,7 +89,6 @@
#ifndef ENCODER_PULSES_PER_STEP #ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 4 #define ENCODER_PULSES_PER_STEP 4
#endif #endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM #ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 1 #define ENCODER_STEPS_PER_MENU_ITEM 1
#endif #endif
@ -146,7 +149,6 @@
#ifndef ENCODER_PULSES_PER_STEP #ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 4 #define ENCODER_PULSES_PER_STEP 4
#endif #endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM #ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 1 #define ENCODER_STEPS_PER_MENU_ITEM 1
#endif #endif
@ -166,6 +168,15 @@
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later) #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
#define ULTIPANEL #define ULTIPANEL
#define NEWPANEL #define NEWPANEL
#define ENCODER_FEEDRATE_DEADZONE 4
#ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 1
#endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 2
#endif
#endif #endif
// Shift register panels // Shift register panels

View file

@ -177,7 +177,8 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
static void menu_action_sddirectory(const char* filename, char* longFilename); static void menu_action_sddirectory(const char* filename, char* longFilename);
#endif #endif
#if DISABLED(LCD_I2C_VIKI) /* Helper macros for menus */
#ifndef ENCODER_FEEDRATE_DEADZONE #ifndef ENCODER_FEEDRATE_DEADZONE
#define ENCODER_FEEDRATE_DEADZONE 10 #define ENCODER_FEEDRATE_DEADZONE 10
#endif #endif
@ -187,20 +188,6 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
#ifndef ENCODER_PULSES_PER_STEP #ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 1 #define ENCODER_PULSES_PER_STEP 1
#endif #endif
#else
#ifndef ENCODER_FEEDRATE_DEADZONE
#define ENCODER_FEEDRATE_DEADZONE 4
#endif
#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
#endif
#ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 1
#endif
#endif
/* Helper macros for menus */
/** /**
* START_SCREEN generates the init code for a screen function * START_SCREEN generates the init code for a screen function