Browse Source

Apply encoder reverse options to keypad arrows

Scott Lahteine 8 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,30 +2924,44 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2924 2924
 
2925 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 2941
           if (false) {
2928 2942
             // for the else-ifs below
2929 2943
           }
2930 2944
           #if BUTTON_EXISTS(UP)
2931 2945
             else if (BUTTON_PRESSED(UP)) {
2932
-              encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM);
2946
+              encoderDiff = -(ENCODER_UD_STEPS);
2933 2947
               next_button_update_ms = now + 300;
2934 2948
             }
2935 2949
           #endif
2936 2950
           #if BUTTON_EXISTS(DWN)
2937 2951
             else if (BUTTON_PRESSED(DWN)) {
2938
-              encoderDiff = ENCODER_STEPS_PER_MENU_ITEM;
2952
+              encoderDiff = ENCODER_UD_STEPS;
2939 2953
               next_button_update_ms = now + 300;
2940 2954
             }
2941 2955
           #endif
2942 2956
           #if BUTTON_EXISTS(LFT)
2943 2957
             else if (BUTTON_PRESSED(LFT)) {
2944
-              encoderDiff = -(ENCODER_PULSES_PER_STEP);
2958
+              encoderDiff = -(ENCODER_LR_PULSES);
2945 2959
               next_button_update_ms = now + 300;
2946 2960
             }
2947 2961
           #endif
2948 2962
           #if BUTTON_EXISTS(RT)
2949 2963
             else if (BUTTON_PRESSED(RT)) {
2950
-              encoderDiff = ENCODER_PULSES_PER_STEP;
2964
+              encoderDiff = ENCODER_LR_PULSES;
2951 2965
               next_button_update_ms = now + 300;
2952 2966
             }
2953 2967
           #endif

Loading…
Cancel
Save