Browse Source

Apply encoder reverse options to keypad arrows

Scott Lahteine 7 years ago
parent
commit
e151f952a3
1 changed files with 18 additions and 4 deletions
  1. 18
    4
      Marlin/ultralcd.cpp

+ 18
- 4
Marlin/ultralcd.cpp View File

2924
 
2924
 
2925
         #if LCD_HAS_DIRECTIONAL_BUTTONS
2925
         #if LCD_HAS_DIRECTIONAL_BUTTONS
2926
 
2926
 
2927
+          // Manage directional buttons
2928
+          #if ENABLED(REVERSE_MENU_DIRECTION)
2929
+            #define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection)
2930
+          #else
2931
+            #define _ENCODER_UD_STEPS ENCODER_STEPS_PER_MENU_ITEM
2932
+          #endif
2933
+          #if ENABLED(REVERSE_ENCODER_DIRECTION)
2934
+            #define ENCODER_UD_STEPS _ENCODER_UD_STEPS
2935
+            #define ENCODER_LR_PULSES ENCODER_PULSES_PER_STEP
2936
+          #else
2937
+            #define ENCODER_UD_STEPS -(_ENCODER_UD_STEPS)
2938
+            #define ENCODER_LR_PULSES -(ENCODER_PULSES_PER_STEP)
2939
+          #endif
2940
+
2927
           if (false) {
2941
           if (false) {
2928
             // for the else-ifs below
2942
             // for the else-ifs below
2929
           }
2943
           }
2930
           #if BUTTON_EXISTS(UP)
2944
           #if BUTTON_EXISTS(UP)
2931
             else if (BUTTON_PRESSED(UP)) {
2945
             else if (BUTTON_PRESSED(UP)) {
2932
-              encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM);
2946
+              encoderDiff = -(ENCODER_UD_STEPS);
2933
               next_button_update_ms = now + 300;
2947
               next_button_update_ms = now + 300;
2934
             }
2948
             }
2935
           #endif
2949
           #endif
2936
           #if BUTTON_EXISTS(DWN)
2950
           #if BUTTON_EXISTS(DWN)
2937
             else if (BUTTON_PRESSED(DWN)) {
2951
             else if (BUTTON_PRESSED(DWN)) {
2938
-              encoderDiff = ENCODER_STEPS_PER_MENU_ITEM;
2952
+              encoderDiff = ENCODER_UD_STEPS;
2939
               next_button_update_ms = now + 300;
2953
               next_button_update_ms = now + 300;
2940
             }
2954
             }
2941
           #endif
2955
           #endif
2942
           #if BUTTON_EXISTS(LFT)
2956
           #if BUTTON_EXISTS(LFT)
2943
             else if (BUTTON_PRESSED(LFT)) {
2957
             else if (BUTTON_PRESSED(LFT)) {
2944
-              encoderDiff = -(ENCODER_PULSES_PER_STEP);
2958
+              encoderDiff = -(ENCODER_LR_PULSES);
2945
               next_button_update_ms = now + 300;
2959
               next_button_update_ms = now + 300;
2946
             }
2960
             }
2947
           #endif
2961
           #endif
2948
           #if BUTTON_EXISTS(RT)
2962
           #if BUTTON_EXISTS(RT)
2949
             else if (BUTTON_PRESSED(RT)) {
2963
             else if (BUTTON_PRESSED(RT)) {
2950
-              encoderDiff = ENCODER_PULSES_PER_STEP;
2964
+              encoderDiff = ENCODER_LR_PULSES;
2951
               next_button_update_ms = now + 300;
2965
               next_button_update_ms = now + 300;
2952
             }
2966
             }
2953
           #endif
2967
           #endif

Loading…
Cancel
Save