Apply encoder reverse options to keypad arrows

This commit is contained in:
Scott Lahteine 2016-10-22 07:40:02 -05:00
parent 0d3fc7dd89
commit e151f952a3

View File

@ -2924,30 +2924,44 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#if LCD_HAS_DIRECTIONAL_BUTTONS #if LCD_HAS_DIRECTIONAL_BUTTONS
// Manage directional buttons
#if ENABLED(REVERSE_MENU_DIRECTION)
#define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection)
#else
#define _ENCODER_UD_STEPS ENCODER_STEPS_PER_MENU_ITEM
#endif
#if ENABLED(REVERSE_ENCODER_DIRECTION)
#define ENCODER_UD_STEPS _ENCODER_UD_STEPS
#define ENCODER_LR_PULSES ENCODER_PULSES_PER_STEP
#else
#define ENCODER_UD_STEPS -(_ENCODER_UD_STEPS)
#define ENCODER_LR_PULSES -(ENCODER_PULSES_PER_STEP)
#endif
if (false) { if (false) {
// for the else-ifs below // for the else-ifs below
} }
#if BUTTON_EXISTS(UP) #if BUTTON_EXISTS(UP)
else if (BUTTON_PRESSED(UP)) { else if (BUTTON_PRESSED(UP)) {
encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM); encoderDiff = -(ENCODER_UD_STEPS);
next_button_update_ms = now + 300; next_button_update_ms = now + 300;
} }
#endif #endif
#if BUTTON_EXISTS(DWN) #if BUTTON_EXISTS(DWN)
else if (BUTTON_PRESSED(DWN)) { else if (BUTTON_PRESSED(DWN)) {
encoderDiff = ENCODER_STEPS_PER_MENU_ITEM; encoderDiff = ENCODER_UD_STEPS;
next_button_update_ms = now + 300; next_button_update_ms = now + 300;
} }
#endif #endif
#if BUTTON_EXISTS(LFT) #if BUTTON_EXISTS(LFT)
else if (BUTTON_PRESSED(LFT)) { else if (BUTTON_PRESSED(LFT)) {
encoderDiff = -(ENCODER_PULSES_PER_STEP); encoderDiff = -(ENCODER_LR_PULSES);
next_button_update_ms = now + 300; next_button_update_ms = now + 300;
} }
#endif #endif
#if BUTTON_EXISTS(RT) #if BUTTON_EXISTS(RT)
else if (BUTTON_PRESSED(RT)) { else if (BUTTON_PRESSED(RT)) {
encoderDiff = ENCODER_PULSES_PER_STEP; encoderDiff = ENCODER_LR_PULSES;
next_button_update_ms = now + 300; next_button_update_ms = now + 300;
} }
#endif #endif